[llvm] r228644 - AsmParser: Add stubs for specialized MDNodes, NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Feb 9 17:08:16 PST 2015
Author: dexonsmith
Date: Mon Feb 9 19:08:16 2015
New Revision: 228644
URL: http://llvm.org/viewvc/llvm-project?rev=228644&view=rev
Log:
AsmParser: Add stubs for specialized MDNodes, NFC
Well, the exact error from the failed parse will change, but...
Modified:
llvm/trunk/include/llvm/IR/Metadata.def
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/AsmParser/LLParser.h
Modified: llvm/trunk/include/llvm/IR/Metadata.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.def?rev=228644&r1=228643&r2=228644&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Metadata.def (original)
+++ llvm/trunk/include/llvm/IR/Metadata.def Mon Feb 9 19:08:16 2015
@@ -13,7 +13,9 @@
#if !(defined HANDLE_METADATA || defined HANDLE_METADATA_LEAF || \
defined HANDLE_METADATA_BRANCH || defined HANDLE_MDNODE_LEAF || \
- defined HANDLE_MDNODE_BRANCH)
+ defined HANDLE_MDNODE_BRANCH || \
+ defined HANDLE_SPECIALIZED_MDNODE_LEAF || \
+ defined HANDLE_SPECIALIZED_MDNODE_BRANCH)
#error "Missing macro definition of HANDLE_METADATA*"
#endif
@@ -42,44 +44,56 @@
#define HANDLE_MDNODE_BRANCH(CLASS) HANDLE_METADATA_BRANCH(CLASS)
#endif
+// Handler for specialized leaf nodes under MDNode.
+#ifndef HANDLE_SPECIALIZED_MDNODE_LEAF
+#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) HANDLE_MDNODE_LEAF(CLASS)
+#endif
+
+// Handler for specialized non-leaf nodes under MDNode.
+#ifndef HANDLE_SPECIALIZED_MDNODE_BRANCH
+#define HANDLE_SPECIALIZED_MDNODE_BRANCH(CLASS) HANDLE_MDNODE_BRANCH(CLASS)
+#endif
+
HANDLE_METADATA_LEAF(MDString)
HANDLE_METADATA_BRANCH(ValueAsMetadata)
HANDLE_METADATA_LEAF(ConstantAsMetadata)
HANDLE_METADATA_LEAF(LocalAsMetadata)
HANDLE_MDNODE_BRANCH(MDNode)
HANDLE_MDNODE_LEAF(MDTuple)
-HANDLE_MDNODE_LEAF(MDLocation)
-HANDLE_MDNODE_BRANCH(DebugNode)
-HANDLE_MDNODE_LEAF(GenericDebugNode)
-HANDLE_MDNODE_LEAF(MDSubrange)
-HANDLE_MDNODE_LEAF(MDEnumerator)
-HANDLE_MDNODE_BRANCH(MDScope)
-HANDLE_MDNODE_BRANCH(MDType)
-HANDLE_MDNODE_LEAF(MDBasicType)
-HANDLE_MDNODE_BRANCH(MDDerivedTypeBase)
-HANDLE_MDNODE_LEAF(MDDerivedType)
-HANDLE_MDNODE_BRANCH(MDCompositeTypeBase)
-HANDLE_MDNODE_LEAF(MDCompositeType)
-HANDLE_MDNODE_LEAF(MDSubroutineType)
-HANDLE_MDNODE_LEAF(MDFile)
-HANDLE_MDNODE_LEAF(MDCompileUnit)
-HANDLE_MDNODE_LEAF(MDSubprogram)
-HANDLE_MDNODE_BRANCH(MDLexicalBlockBase)
-HANDLE_MDNODE_LEAF(MDLexicalBlock)
-HANDLE_MDNODE_LEAF(MDLexicalBlockFile)
-HANDLE_MDNODE_LEAF(MDNamespace)
-HANDLE_MDNODE_BRANCH(MDTemplateParameter)
-HANDLE_MDNODE_LEAF(MDTemplateTypeParameter)
-HANDLE_MDNODE_LEAF(MDTemplateValueParameter)
-HANDLE_MDNODE_BRANCH(MDVariable)
-HANDLE_MDNODE_LEAF(MDGlobalVariable)
-HANDLE_MDNODE_LEAF(MDLocalVariable)
-HANDLE_MDNODE_LEAF(MDExpression)
-HANDLE_MDNODE_LEAF(MDObjCProperty)
-HANDLE_MDNODE_LEAF(MDImportedEntity)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDLocation)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(DebugNode)
+HANDLE_SPECIALIZED_MDNODE_LEAF(GenericDebugNode)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDSubrange)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDEnumerator)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(MDScope)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(MDType)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDBasicType)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(MDDerivedTypeBase)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDDerivedType)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(MDCompositeTypeBase)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDCompositeType)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDSubroutineType)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDFile)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDCompileUnit)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDSubprogram)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(MDLexicalBlockBase)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDLexicalBlock)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDLexicalBlockFile)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDNamespace)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(MDTemplateParameter)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDTemplateTypeParameter)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDTemplateValueParameter)
+HANDLE_SPECIALIZED_MDNODE_BRANCH(MDVariable)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDGlobalVariable)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDLocalVariable)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDExpression)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDObjCProperty)
+HANDLE_SPECIALIZED_MDNODE_LEAF(MDImportedEntity)
#undef HANDLE_METADATA
#undef HANDLE_METADATA_LEAF
#undef HANDLE_METADATA_BRANCH
#undef HANDLE_MDNODE_LEAF
#undef HANDLE_MDNODE_BRANCH
+#undef HANDLE_SPECIALIZED_MDNODE_LEAF
+#undef HANDLE_SPECIALIZED_MDNODE_BRANCH
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=228644&r1=228643&r2=228644&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Feb 9 19:08:16 2015
@@ -3083,13 +3083,11 @@ bool LLParser::ParseMDField(StringRef Na
bool LLParser::ParseSpecializedMDNode(MDNode *&N, bool IsDistinct) {
assert(Lex.getKind() == lltok::MetadataVar && "Expected metadata type name");
-#define DISPATCH_TO_PARSER(CLASS) \
+
+#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) \
if (Lex.getStrVal() == #CLASS) \
return Parse##CLASS(N, IsDistinct);
-
- DISPATCH_TO_PARSER(MDLocation);
- DISPATCH_TO_PARSER(GenericDebugNode);
-#undef DISPATCH_TO_PARSER
+#include "llvm/IR/Metadata.def"
return TokError("expected metadata type");
}
@@ -3146,6 +3144,64 @@ bool LLParser::ParseGenericDebugNode(MDN
(Context, tag.Val, header.Val, operands.Val));
return false;
}
+
+bool LLParser::ParseMDSubrange(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDEnumerator(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDBasicType(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDDerivedType(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDCompositeType(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDSubroutineType(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDFile(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDCompileUnit(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDLexicalBlock(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDLexicalBlockFile(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDNamespace(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDTemplateTypeParameter(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDTemplateValueParameter(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDGlobalVariable(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDLocalVariable(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDExpression(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDObjCProperty(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
+bool LLParser::ParseMDImportedEntity(MDNode *&Result, bool IsDistinct) {
+ return TokError("unimplemented parser");
+}
#undef PARSE_MD_FIELD
#undef NOP_FIELD
#undef REQUIRE_FIELD
Modified: llvm/trunk/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=228644&r1=228643&r2=228644&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.h (original)
+++ llvm/trunk/lib/AsmParser/LLParser.h Mon Feb 9 19:08:16 2015
@@ -401,8 +401,10 @@ namespace llvm {
template <class ParserTy>
bool ParseMDFieldsImpl(ParserTy parseField, LocTy &ClosingLoc);
bool ParseSpecializedMDNode(MDNode *&N, bool IsDistinct = false);
- bool ParseMDLocation(MDNode *&Result, bool IsDistinct);
- bool ParseGenericDebugNode(MDNode *&Result, bool IsDistinct);
+
+#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) \
+ bool Parse##CLASS(MDNode *&Result, bool IsDistinct);
+#include "llvm/IR/Metadata.def"
// Function Parsing.
struct ArgInfo {
More information about the llvm-commits
mailing list