summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 828f873d37b..a5f4dd73d30 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -643,11 +643,18 @@ bool LLParser::ParseNamedMetadata() {
NamedMDNode *NMD = M->getOrInsertNamedMetadata(Name);
if (Lex.getKind() != lltok::rbrace)
do {
- if (ParseToken(lltok::exclaim, "Expected '!' here"))
- return true;
-
MDNode *N = nullptr;
- if (ParseMDNodeID(N)) return true;
+ // Parse DIExpressions inline as a special case. They are still MDNodes,
+ // so they can still appear in named metadata. Remove this logic if they
+ // become plain Metadata.
+ if (Lex.getKind() == lltok::MetadataVar &&
+ Lex.getStrVal() == "DIExpression") {
+ if (ParseDIExpression(N, /*IsDistinct=*/false))
+ return true;
+ } else if (ParseToken(lltok::exclaim, "Expected '!' here") ||
+ ParseMDNodeID(N)) {
+ return true;
+ }
NMD->addOperand(N);
} while (EatIfPresent(lltok::comma));
OpenPOWER on IntegriCloud