[llvm-commits] [llvm] r157431 - in /llvm/trunk: include/llvm/TableGen/Record.h lib/TableGen/TGParser.cpp test/TableGen/ForeachLoop.td
Jakob Stoklund Olesen
stoklund at 2pi.dk
Thu May 24 15:17:37 PDT 2012
Author: stoklund
Date: Thu May 24 17:17:36 2012
New Revision: 157431
URL: http://llvm.org/viewvc/llvm-project?rev=157431&view=rev
Log:
Don't put TGParser scratch results in the output.
Only fully expanded Records should go into RecordKeeper.
Modified:
llvm/trunk/include/llvm/TableGen/Record.h
llvm/trunk/lib/TableGen/TGParser.cpp
llvm/trunk/test/TableGen/ForeachLoop.td
Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=157431&r1=157430&r2=157431&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Thu May 24 17:17:36 2012
@@ -1558,12 +1558,14 @@
return I == Defs.end() ? 0 : I->second;
}
void addClass(Record *R) {
- assert(getClass(R->getNameInitAsString()) == 0 && "Class already exists!");
- Classes.insert(std::make_pair(R->getNameInitAsString(), R));
+ bool Ins = Classes.insert(std::make_pair(R->getName(), R)).second;
+ (void)Ins;
+ assert(Ins && "Class already exists");
}
void addDef(Record *R) {
- assert(getDef(R->getNameInitAsString()) == 0 && "Def already exists!");
- Defs.insert(std::make_pair(R->getNameInitAsString(), R));
+ bool Ins = Defs.insert(std::make_pair(R->getName(), R)).second;
+ (void)Ins;
+ assert(Ins && "Record already exists");
}
/// removeClass - Remove, but do not delete, the specified record.
Modified: llvm/trunk/lib/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=157431&r1=157430&r2=157431&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp (original)
+++ llvm/trunk/lib/TableGen/TGParser.cpp Thu May 24 17:17:36 2012
@@ -1903,7 +1903,7 @@
// Parse ObjectName and make a record for it.
Record *CurRec = new Record(ParseObjectName(CurMultiClass), DefLoc, Records);
- if (!CurMultiClass) {
+ if (!CurMultiClass && Loops.empty()) {
// Top-level def definition.
// Ensure redefinition doesn't happen.
@@ -1913,7 +1913,7 @@
return true;
}
Records.addDef(CurRec);
- } else {
+ } else if (CurMultiClass) {
// Otherwise, a def inside a multiclass, add it to the multiclass.
for (unsigned i = 0, e = CurMultiClass->DefPrototypes.size(); i != e; ++i)
if (CurMultiClass->DefPrototypes[i]->getNameInit()
Modified: llvm/trunk/test/TableGen/ForeachLoop.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/ForeachLoop.td?rev=157431&r1=157430&r2=157431&view=diff
==============================================================================
--- llvm/trunk/test/TableGen/ForeachLoop.td (original)
+++ llvm/trunk/test/TableGen/ForeachLoop.td Thu May 24 17:17:36 2012
@@ -9,6 +9,7 @@
foreach i = [0, 1, 2, 3, 4, 5, 6, 7] in
def R#i : Register<"R"#i, i>;
+// CHECK-NOT: !strconcat
// CHECK: def R0
// CHECK: string Name = "R0";
More information about the llvm-commits
mailing list