diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-07-17 02:26:10 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-07-17 02:26:10 +0000 |
commit | d1e3b44d6c0094eda2e2a854d5fdb6a0d7ba327e (patch) | |
tree | c1fdd7abf103a2b2b0bf0e654faf9dcca4021375 /include/llvm | |
parent | dd7d28a17b19d03115592de74e8291e47afbcc72 (diff) | |
download | external_llvm-d1e3b44d6c0094eda2e2a854d5fdb6a0d7ba327e.zip external_llvm-d1e3b44d6c0094eda2e2a854d5fdb6a0d7ba327e.tar.gz external_llvm-d1e3b44d6c0094eda2e2a854d5fdb6a0d7ba327e.tar.bz2 |
MC/AsmParser: Lift Run() and TargetParser to base class.
Also, add constructor function for creating AsmParser instances.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108604 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/MC/MCParser/AsmParser.h | 6 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/MCAsmParser.h | 16 |
2 files changed, 17 insertions, 5 deletions
diff --git a/include/llvm/MC/MCParser/AsmParser.h b/include/llvm/MC/MCParser/AsmParser.h index 0e8570a..24d8590 100644 --- a/include/llvm/MC/MCParser/AsmParser.h +++ b/include/llvm/MC/MCParser/AsmParser.h @@ -46,7 +46,6 @@ private: SourceMgr &SrcMgr; MCAsmParserExtension *GenericParser; MCAsmParserExtension *PlatformParser; - TargetAsmParser *TargetParser; /// This is the current buffer index we're lexing from as managed by the /// SourceMgr object. @@ -65,7 +64,7 @@ public: const MCAsmInfo &MAI); ~AsmParser(); - bool Run(bool NoInitialTextSection, bool NoFinalize = false); + virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false); void AddDirectiveHandler(MCAsmParserExtension *Object, StringRef Directive, @@ -74,9 +73,6 @@ public: } public: - TargetAsmParser &getTargetParser() const { return *TargetParser; } - void setTargetParser(TargetAsmParser &P); - /// @name MCAsmParser Interface /// { diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index d0ccd0f..c18bb39 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -14,6 +14,7 @@ namespace llvm { class AsmToken; +class MCAsmInfo; class MCAsmLexer; class MCAsmParserExtension; class MCContext; @@ -22,6 +23,8 @@ class MCStreamer; class SMLoc; class SourceMgr; class StringRef; +class Target; +class TargetAsmParser; class Twine; /// MCAsmParser - Generic assembler parser interface, for use by target specific @@ -33,6 +36,9 @@ public: private: MCAsmParser(const MCAsmParser &); // DO NOT IMPLEMENT void operator=(const MCAsmParser &); // DO NOT IMPLEMENT + + TargetAsmParser *TargetParser; + protected: // Can only create subclasses. MCAsmParser(); @@ -52,6 +58,12 @@ public: /// getStreamer - Return the output streamer for the assembler. virtual MCStreamer &getStreamer() = 0; + TargetAsmParser &getTargetParser() const { return *TargetParser; } + void setTargetParser(TargetAsmParser &P); + + /// Run - Run the parser on the input source buffer. + virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0; + /// Warning - Emit a warning at the location \arg L, with the message \arg /// Msg. virtual void Warning(SMLoc L, const Twine &Msg) = 0; @@ -102,6 +114,10 @@ public: virtual bool ParseAbsoluteExpression(int64_t &Res) = 0; }; +/// \brief Create an MCAsmParser instance. +MCAsmParser *createMCAsmParser(const Target &, SourceMgr &, MCContext &, + MCStreamer &, const MCAsmInfo &); + } // End llvm namespace #endif |