summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-03-07 22:09:05 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-03-07 22:09:05 +0000
commit81e72b4d4ea92d9b6ab0721ef062638d2114a621 (patch)
tree19011b0338d9902da1cb98738df7f389e7026964 /llvm/lib/AsmParser/LLParser.cpp
parent4e14a497a3c0e0855ff37cc3b80d9a7ae88891ad (diff)
downloadbcm5719-llvm-81e72b4d4ea92d9b6ab0721ef062638d2114a621.tar.gz
bcm5719-llvm-81e72b4d4ea92d9b6ab0721ef062638d2114a621.zip
[AsmParser] Add a function to parse a standalone type.
This is useful for MIR serialization. Indeed generic machine instructions must have a type and we don't want to duplicate the logic in the MIParser. llvm-svn: 262868
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 3f97cd61ae4..9b9054dbaed 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -63,6 +63,18 @@ bool LLParser::parseStandaloneConstantValue(Constant *&C,
return false;
}
+bool LLParser::parseStandaloneType(Type *&Ty, const SlotMapping *Slots) {
+ restoreParsingState(Slots);
+ Lex.Lex();
+
+ Ty = nullptr;
+ if (ParseType(Ty))
+ return true;
+ if (Lex.getKind() != lltok::Eof)
+ return Error(Lex.getLoc(), "expected end of string");
+ return false;
+}
+
void LLParser::restoreParsingState(const SlotMapping *Slots) {
if (!Slots)
return;
OpenPOWER on IntegriCloud