TableGen: Keep the order of DECL_CONTEXT() for DeclNodes.td. RecordVector may be...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Mon, 11 Apr 2011 23:20:28 +0000 (23:20 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Mon, 11 Apr 2011 23:20:28 +0000 (23:20 +0000)
The result of DeclNodes.inc was unstable on msys, Windows 7 x64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129317 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/ClangASTNodesEmitter.cpp

index 187ab4679994edea88cb26293d9018b05cca87d3..d9d5a3ccd90720c29cab0a8ccc69ae1461c0487c 100644 (file)
@@ -155,10 +155,13 @@ void ClangDeclContextEmitter::run(raw_ostream &OS) {
     }
   }
 
-  for (RecordSet::iterator i = DeclContexts.begin(), e = DeclContexts.end();
-       i != e; ++i) {
-    OS << "DECL_CONTEXT(" << (*i)->getName() << ")\n";
-  }
+  // To keep identical order, RecordVector may be used
+  // instead of RecordSet.
+  for (RecordVector::iterator
+         i = DeclContextsVector.begin(), e = DeclContextsVector.end();
+       i != e; ++i)
+    if (DeclContexts.find(*i) != DeclContexts.end())
+      OS << "DECL_CONTEXT(" << (*i)->getName() << ")\n";
 
   OS << "#undef DECL_CONTEXT\n";
   OS << "#undef DECL_CONTEXT_BASE\n";