diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-01 21:57:44 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-01 21:57:44 +0000 |
commit | c137ea6cf5febeff6aad20c51921e48a4817a2e1 (patch) | |
tree | cf56feb86a0b5d7ab724b0d5bd9878505ce20440 /lib/AsmParser | |
parent | fecbc59be6a53fb487a2405799d7a452e022142d (diff) | |
download | external_llvm-c137ea6cf5febeff6aad20c51921e48a4817a2e1.zip external_llvm-c137ea6cf5febeff6aad20c51921e48a4817a2e1.tar.gz external_llvm-c137ea6cf5febeff6aad20c51921e48a4817a2e1.tar.bz2 |
Convert LLParser to use LLVMContext for creating constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74648 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 7 | ||||
-rw-r--r-- | lib/AsmParser/LLParser.h | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 4ab0f26..011d113 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -18,6 +18,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" +#include "llvm/LLVMContext.h" #include "llvm/MDNode.h" #include "llvm/Module.h" #include "llvm/ValueSymbolTable.h" @@ -1653,11 +1654,11 @@ bool LLParser::ParseValID(ValID &ID) { ID.Kind = ValID::t_APFloat; break; case lltok::kw_true: - ID.ConstantVal = ConstantInt::getTrue(); + ID.ConstantVal = Context.getConstantIntTrue(); ID.Kind = ValID::t_Constant; break; case lltok::kw_false: - ID.ConstantVal = ConstantInt::getFalse(); + ID.ConstantVal = Context.getConstantIntFalse(); ID.Kind = ValID::t_Constant; break; case lltok::kw_null: ID.Kind = ValID::t_Null; break; @@ -2037,7 +2038,7 @@ bool LLParser::ConvertGlobalValIDToValue(const Type *Ty, ValID &ID, if (!isa<IntegerType>(Ty)) return Error(ID.Loc, "integer constant must have integer type"); ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits()); - V = ConstantInt::get(ID.APSIntVal); + V = Context.getConstantInt(ID.APSIntVal); return false; case ValID::t_APFloat: if (!Ty->isFloatingPoint() || diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index 41c2ee7..924c929 100644 --- a/lib/AsmParser/LLParser.h +++ b/lib/AsmParser/LLParser.h @@ -15,6 +15,7 @@ #define LLVM_ASMPARSER_LLPARSER_H #include "LLLexer.h" +#include "llvm/Module.h" #include "llvm/Type.h" #include <map> @@ -29,13 +30,14 @@ namespace llvm { class GlobalValue; class MDString; class MDNode; + class LLVMContext; struct ValID; class LLParser { public: typedef LLLexer::LocTy LocTy; private: - + const LLVMContext& Context; LLLexer Lex; Module *M; @@ -72,7 +74,8 @@ namespace llvm { std::map<unsigned, std::pair<GlobalValue*, LocTy> > ForwardRefValIDs; std::vector<GlobalValue*> NumberedVals; public: - LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : Lex(F, Err), M(m) {} + LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : + Context(M->getContext()), Lex(F, Err), M(m) {} bool Run(); private: |