diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-03-07 00:54:17 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-03-07 00:54:17 +0000 |
| commit | fd4fee599e8cb4a41a6c6962f49b0215a802af09 (patch) | |
| tree | 62f3a7b93354fba6be0bb0f398c3669e1e24caa4 | |
| parent | b923d641d03de1304171af08043ba3148787abf0 (diff) | |
| download | bcm5719-llvm-fd4fee599e8cb4a41a6c6962f49b0215a802af09.tar.gz bcm5719-llvm-fd4fee599e8cb4a41a6c6962f49b0215a802af09.zip | |
Split BitcodeFile::parse. NFC.
llvm-svn: 262813
| -rw-r--r-- | lld/ELF/InputFiles.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 88177a8c963..f67fe47941a 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -414,6 +414,17 @@ bool BitcodeFile::classof(const InputFile *F) { return F->kind() == BitcodeKind; } +static uint8_t getGvVisibility(const GlobalValue *GV) { + switch (GV->getVisibility()) { + case GlobalValue::HiddenVisibility: + return STV_HIDDEN; + case GlobalValue::ProtectedVisibility: + return STV_PROTECTED; + default: + return STV_DEFAULT; + } +} + void BitcodeFile::parse(DenseSet<StringRef> &ComdatGroups) { LLVMContext Context; std::unique_ptr<IRObjectFile> Obj = check(IRObjectFile::create(MB, Context)); @@ -432,23 +443,14 @@ void BitcodeFile::parse(DenseSet<StringRef> &ComdatGroups) { if (const Comdat *C = GV->getComdat()) if (!KeptComdats.count(C)) continue; - switch (GV->getVisibility()) { - case GlobalValue::DefaultVisibility: - Visibility = STV_DEFAULT; - break; - case GlobalValue::HiddenVisibility: - Visibility = STV_HIDDEN; - break; - case GlobalValue::ProtectedVisibility: - Visibility = STV_PROTECTED; - break; - } + Visibility = getGvVisibility(GV); } SmallString<64> Name; raw_svector_ostream OS(Name); Sym.printName(OS); StringRef NameRef = Saver.save(StringRef(Name)); + SymbolBody *Body; uint32_t Flags = Sym.getFlags(); bool IsWeak = Flags & BasicSymbolRef::SF_Weak; |

