Author: Fangrui Song Date: 2023-02-02T13:46:52-08:00 New Revision: 506621fac467496202f2aff5ce9425994560d9eb
URL: https://github.com/llvm/llvm-project/commit/506621fac467496202f2aff5ce9425994560d9eb DIFF: https://github.com/llvm/llvm-project/commit/506621fac467496202f2aff5ce9425994560d9eb.diff LOG: [modularize] StringMap=>map to make iteration order deterministic Added: Modified: clang-tools-extra/modularize/Modularize.cpp clang-tools-extra/test/modularize/ProblemsInconsistent.modularize Removed: ################################################################################ diff --git a/clang-tools-extra/modularize/Modularize.cpp b/clang-tools-extra/modularize/Modularize.cpp index b3da2ffb11c4a..b90ccccf30cd3 100644 --- a/clang-tools-extra/modularize/Modularize.cpp +++ b/clang-tools-extra/modularize/Modularize.cpp @@ -248,6 +248,7 @@ #include "llvm/Support/Path.h" #include <algorithm> #include <iterator> +#include <map> #include <string> #include <vector> @@ -480,7 +481,7 @@ struct HeaderEntry { typedef std::vector<HeaderEntry> HeaderContents; -class EntityMap : public StringMap<SmallVector<Entry, 2> > { +class EntityMap : public std::map<std::string, SmallVector<Entry, 2>> { public: DenseMap<const FileEntry *, HeaderContents> HeaderContentMismatches; @@ -935,7 +936,7 @@ int main(int Argc, const char **Argv) { continue; LocationArray::iterator FI = DI->begin(); StringRef kindName = Entry::getKindName((Entry::EntryKind)KindIndex); - errs() << "error: " << kindName << " '" << E->first() + errs() << "error: " << kindName << " '" << E->first << "' defined at multiple locations:\n"; for (LocationArray::iterator FE = DI->end(); FI != FE; ++FI) { errs() << " " << FI->File->getName() << ":" << FI->Line << ":" diff --git a/clang-tools-extra/test/modularize/ProblemsInconsistent.modularize b/clang-tools-extra/test/modularize/ProblemsInconsistent.modularize index 713bfe9084fe5..33a2706ee9def 100644 --- a/clang-tools-extra/test/modularize/ProblemsInconsistent.modularize +++ b/clang-tools-extra/test/modularize/ProblemsInconsistent.modularize @@ -3,12 +3,12 @@ Inputs/InconsistentHeader1.h Inputs/InconsistentHeader2.h -# CHECK: error: macro 'SYMBOL' defined at multiple locations: -# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:3:9 -# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:7:9 -# CHECK-NEXT: error: macro 'FUNC_STYLE' defined at multiple locations: +# CHECK: error: macro 'FUNC_STYLE' defined at multiple locations: # CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:4:9 # CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:8:9 +# CHECK-NEXT: error: macro 'SYMBOL' defined at multiple locations: +# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:3:9 +# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:7:9 # CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:15:11: # CHECK-NEXT: int var = FUNC_STYLE(1, 0); # CHECK-NEXT: ^ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits