[llvm-commits] [llvm] r139617 - /llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue Sep 13 11:41:43 PDT 2011
Author: akirtzidis
Date: Tue Sep 13 13:41:43 2011
New Revision: 139617
URL: http://llvm.org/viewvc/llvm-project?rev=139617&view=rev
Log:
[tablegen] In ClangAttrEmitter.cpp handle SourceLocation arguments to attributes.
Modified:
llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp
Modified: llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=139617&r1=139616&r2=139617&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp Tue Sep 13 13:41:43 2011
@@ -42,18 +42,19 @@
return Strings;
}
-std::string ReadPCHRecord(StringRef type) {
+static std::string ReadPCHRecord(StringRef type) {
return StringSwitch<std::string>(type)
.EndsWith("Decl *", "GetLocalDeclAs<"
+ std::string(type, 0, type.size()-1) + ">(F, Record[Idx++])")
.Case("QualType", "getLocalType(F, Record[Idx++])")
.Case("Expr *", "ReadSubExpr()")
.Case("IdentifierInfo *", "GetIdentifierInfo(F, Record, Idx)")
+ .Case("SourceLocation", "ReadSourceLocation(F, Record, Idx)")
.Default("Record[Idx++]");
}
// Assumes that the way to get the value is SA->getname()
-std::string WritePCHRecord(StringRef type, StringRef name) {
+static std::string WritePCHRecord(StringRef type, StringRef name) {
return StringSwitch<std::string>(type)
.EndsWith("Decl *", "AddDeclRef(" + std::string(name) +
", Record);\n")
@@ -61,6 +62,8 @@
.Case("Expr *", "AddStmt(" + std::string(name) + ");\n")
.Case("IdentifierInfo *",
"AddIdentifierRef(" + std::string(name) + ", Record);\n")
+ .Case("SourceLocation",
+ "AddSourceLocation(" + std::string(name) + ", Record);\n")
.Default("Record.push_back(" + std::string(name) + ");\n");
}
@@ -487,6 +490,8 @@
Ptr = new SimpleArgument(Arg, Attr, "QualType");
else if (ArgName == "UnsignedArgument")
Ptr = new SimpleArgument(Arg, Attr, "unsigned");
+ else if (ArgName == "SourceLocArgument")
+ Ptr = new SimpleArgument(Arg, Attr, "SourceLocation");
else if (ArgName == "VariadicUnsignedArgument")
Ptr = new VariadicArgument(Arg, Attr, "unsigned");
else if (ArgName == "VariadicExprArgument")
More information about the llvm-commits
mailing list