[clang] 7352f42 - [clang-tblgen] Fix non-determinism in generating AttrSubMatchRulesParserStringSwitches.inc

Igor Kudrin via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 9 19:09:44 PST 2021


Author: Igor Kudrin
Date: 2021-11-10T10:08:06+07:00
New Revision: 7352f42cdc3c44038408edcdc4eb9890546020eb

URL: https://github.com/llvm/llvm-project/commit/7352f42cdc3c44038408edcdc4eb9890546020eb
DIFF: https://github.com/llvm/llvm-project/commit/7352f42cdc3c44038408edcdc4eb9890546020eb.diff

LOG: [clang-tblgen] Fix non-determinism in generating AttrSubMatchRulesParserStringSwitches.inc

llvm::MapVector, compared to std::map, guarantees the same iteration
order in different runs.

Differential Revision: https://reviews.llvm.org/D113168

Added: 
    

Modified: 
    clang/utils/TableGen/ClangAttrEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 2a55a5eb59581..c692e8b5b6bc8 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -16,6 +16,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
@@ -2043,7 +2044,7 @@ void PragmaClangAttributeSupport::generateParsingHelpers(raw_ostream &OS) {
   OS << "  return None;\n";
   OS << "}\n\n";
 
-  std::map<const Record *, std::vector<AttributeSubjectMatchRule>>
+  llvm::MapVector<const Record *, std::vector<AttributeSubjectMatchRule>>
       SubMatchRules;
   for (const auto &Rule : Rules) {
     if (!Rule.isSubRule())


        


More information about the cfe-commits mailing list