diff options
author | Eli Bendersky <eliben@google.com> | 2013-01-16 00:50:52 +0000 |
---|---|---|
committer | Eli Bendersky <eliben@google.com> | 2013-01-16 00:50:52 +0000 |
commit | 171192f149dce679cd520f85ffced4789448b017 (patch) | |
tree | 5309b43318eeb9fd135de09dc105fc63c94013fb /lib | |
parent | 68b8d4f4ce9d2ab3b6f5b3d8adf6db1b3b3d3419 (diff) | |
download | external_llvm-171192f149dce679cd520f85ffced4789448b017.zip external_llvm-171192f149dce679cd520f85ffced4789448b017.tar.gz external_llvm-171192f149dce679cd520f85ffced4789448b017.tar.bz2 |
Use the ExtensionDirectiveHandler type in other places where it makes sense.
Since we already have this type it's a shame to keep dragging a pair of object
and method around explicitly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 9 | ||||
-rw-r--r-- | lib/MC/MCParser/COFFAsmParser.cpp | 7 | ||||
-rw-r--r-- | lib/MC/MCParser/DarwinAsmParser.cpp | 7 | ||||
-rw-r--r-- | lib/MC/MCParser/ELFAsmParser.cpp | 8 |
4 files changed, 16 insertions, 15 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 43c872b..0db3430 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -122,8 +122,6 @@ private: /// ExtensionDirectiveMap - maps directive names to handler methods in parser /// extensions. Extensions register themselves in this map by calling /// AddDirectiveHandler. - typedef std::pair<MCAsmParserExtension*, DirectiveHandler> - ExtensionDirectiveHandler; StringMap<ExtensionDirectiveHandler> ExtensionDirectiveMap; /// MacroMap - Map of currently defined macros. @@ -160,10 +158,9 @@ public: virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false); - virtual void AddDirectiveHandler(MCAsmParserExtension *Object, - StringRef Directive, - DirectiveHandler Handler) { - ExtensionDirectiveMap[Directive] = std::make_pair(Object, Handler); + virtual void AddDirectiveHandler(StringRef Directive, + ExtensionDirectiveHandler Handler) { + ExtensionDirectiveMap[Directive] = Handler; } public: diff --git a/lib/MC/MCParser/COFFAsmParser.cpp b/lib/MC/MCParser/COFFAsmParser.cpp index e7c564a..d0cc0c5 100644 --- a/lib/MC/MCParser/COFFAsmParser.cpp +++ b/lib/MC/MCParser/COFFAsmParser.cpp @@ -24,10 +24,11 @@ using namespace llvm; namespace { class COFFAsmParser : public MCAsmParserExtension { - template<bool (COFFAsmParser::*Handler)(StringRef, SMLoc)> + template<bool (COFFAsmParser::*HandlerMethod)(StringRef, SMLoc)> void AddDirectiveHandler(StringRef Directive) { - getParser().AddDirectiveHandler(this, Directive, - HandleDirective<COFFAsmParser, Handler>); + MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( + this, HandleDirective<COFFAsmParser, HandlerMethod>); + getParser().AddDirectiveHandler(Directive, Handler); } bool ParseSectionSwitch(StringRef Section, diff --git a/lib/MC/MCParser/DarwinAsmParser.cpp b/lib/MC/MCParser/DarwinAsmParser.cpp index 7b042df..c4974e5 100644 --- a/lib/MC/MCParser/DarwinAsmParser.cpp +++ b/lib/MC/MCParser/DarwinAsmParser.cpp @@ -26,10 +26,11 @@ namespace { /// \brief Implementation of directive handling which is shared across all /// Darwin targets. class DarwinAsmParser : public MCAsmParserExtension { - template<bool (DarwinAsmParser::*Handler)(StringRef, SMLoc)> + template<bool (DarwinAsmParser::*HandlerMethod)(StringRef, SMLoc)> void AddDirectiveHandler(StringRef Directive) { - getParser().AddDirectiveHandler(this, Directive, - HandleDirective<DarwinAsmParser, Handler>); + MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( + this, HandleDirective<DarwinAsmParser, HandlerMethod>); + getParser().AddDirectiveHandler(Directive, Handler); } bool ParseSectionSwitch(const char *Segment, const char *Section, diff --git a/lib/MC/MCParser/ELFAsmParser.cpp b/lib/MC/MCParser/ELFAsmParser.cpp index 87126f0..eb39415 100644 --- a/lib/MC/MCParser/ELFAsmParser.cpp +++ b/lib/MC/MCParser/ELFAsmParser.cpp @@ -22,10 +22,12 @@ using namespace llvm; namespace { class ELFAsmParser : public MCAsmParserExtension { - template<bool (ELFAsmParser::*Handler)(StringRef, SMLoc)> + template<bool (ELFAsmParser::*HandlerMethod)(StringRef, SMLoc)> void AddDirectiveHandler(StringRef Directive) { - getParser().AddDirectiveHandler(this, Directive, - HandleDirective<ELFAsmParser, Handler>); + MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( + this, HandleDirective<ELFAsmParser, HandlerMethod>); + + getParser().AddDirectiveHandler(Directive, Handler); } bool ParseSectionSwitch(StringRef Section, unsigned Type, |