[lld] r262813 - Split BitcodeFile::parse. NFC.
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 07:36:20 PST 2016
This is a nice change in general, but why convert from
GlobalValue::DefaultVisibility to default? We had a fully covered
switch before.
Cheers,
Rafael
On 6 March 2016 at 19:54, Rui Ueyama via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: ruiu
> Date: Sun Mar 6 18:54:17 2016
> New Revision: 262813
>
> URL: http://llvm.org/viewvc/llvm-project?rev=262813&view=rev
> Log:
> Split BitcodeFile::parse. NFC.
>
> Modified:
> lld/trunk/ELF/InputFiles.cpp
>
> Modified: lld/trunk/ELF/InputFiles.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=262813&r1=262812&r2=262813&view=diff
> ==============================================================================
> --- lld/trunk/ELF/InputFiles.cpp (original)
> +++ lld/trunk/ELF/InputFiles.cpp Sun Mar 6 18:54:17 2016
> @@ -414,6 +414,17 @@ bool BitcodeFile::classof(const InputFil
> 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<StringR
> 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;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list