diff options
author | Vitaly Buka <vitalybuka@google.com> | 2018-03-20 00:38:33 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2018-03-20 00:38:33 +0000 |
commit | 0d03881eb57e30f99ad3ab811842c90a7a0d8748 (patch) | |
tree | 92c8e3617a0ca1282d52be151f05a545c80c83c9 /llvm/lib/Object/RecordStreamer.h | |
parent | a3a8cc80b3a8029ad93a7ec2a3da7b7bd31f56ac (diff) | |
download | bcm5719-llvm-0d03881eb57e30f99ad3ab811842c90a7a0d8748.tar.gz bcm5719-llvm-0d03881eb57e30f99ad3ab811842c90a7a0d8748.zip |
Object: Move attribute calculation into RecordStreamer. NFC
Summary: Preparation for D44274
Reviewers: pcc, espindola
Subscribers: hiraditya
Differential Revision: https://reviews.llvm.org/D44276
llvm-svn: 327928
Diffstat (limited to 'llvm/lib/Object/RecordStreamer.h')
-rw-r--r-- | llvm/lib/Object/RecordStreamer.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/llvm/lib/Object/RecordStreamer.h b/llvm/lib/Object/RecordStreamer.h index e1e23f260ac..60b2d3ec3e8 100644 --- a/llvm/lib/Object/RecordStreamer.h +++ b/llvm/lib/Object/RecordStreamer.h @@ -20,17 +20,24 @@ namespace llvm { +class GlobalValue; +class Module; + class RecordStreamer : public MCStreamer { public: enum State { NeverSeen, Global, Defined, DefinedGlobal, DefinedWeak, Used, UndefinedWeak}; private: + const Module &M; StringMap<State> Symbols; // Map of aliases created by .symver directives, saved so we can update // their symbol binding after parsing complete. This maps from each // aliasee to its list of aliases. - DenseMap<const MCSymbol *, std::vector<MCSymbol *>> SymverAliasMap; + DenseMap<const MCSymbol *, std::vector<StringRef>> SymverAliasMap; + + /// Get the state recorded for the given symbol. + State getSymbolState(const MCSymbol *Sym); void markDefined(const MCSymbol &Symbol); void markGlobal(const MCSymbol &Symbol, MCSymbolAttr Attribute); @@ -38,7 +45,7 @@ private: void visitUsedSymbol(const MCSymbol &Sym) override; public: - RecordStreamer(MCContext &Context); + RecordStreamer(MCContext &Context, const Module &M); using const_iterator = StringMap<State>::const_iterator; @@ -56,18 +63,9 @@ public: /// Record .symver aliases for later processing. void emitELFSymverDirective(StringRef AliasName, const MCSymbol *Aliasee) override; - /// Return the map of .symver aliasee to associated aliases. - DenseMap<const MCSymbol *, std::vector<MCSymbol *>> &symverAliases() { - return SymverAliasMap; - } - - /// Get the state recorded for the given symbol. - State getSymbolState(const MCSymbol *Sym) { - auto SI = Symbols.find(Sym->getName()); - if (SI == Symbols.end()) - return NeverSeen; - return SI->second; - } + // Emit ELF .symver aliases and ensure they have the same binding as the + // defined symbol they alias with. + void flushSymverDirectives(); }; } // end namespace llvm |