ppluzhnikov updated this revision to Diff 427526.
ppluzhnikov added a comment.

Fix more UNIX and Winx64 failures.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121733/new/

https://reviews.llvm.org/D121733

Files:
  clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp
  clang-tools-extra/test/clang-apply-replacements/conflict.cpp
  clang-tools-extra/test/clang-apply-replacements/order-dependent.cpp
  clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp
  clang-tools-extra/test/clang-tidy/checkers/abseil-no-namespace.cpp
  
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
  clang-tools-extra/test/modularize/ProblemsMissingHeader.modularize
  clang/bindings/python/tests/cindex/test_translation_unit.py
  clang/lib/Basic/FileManager.cpp
  clang/test/ClangScanDeps/header-search-pruning-transitive.c
  clang/test/Frontend/dependency-gen.c
  clang/test/Index/skip-parsed-bodies/compile_commands.json
  clang/test/Modules/cxx20-hu-04.cpp
  clang/test/Modules/cxx20-hu-05.cpp
  clang/test/Modules/cxx20-hu-06.cpp
  clang/test/Modules/filename.cpp
  clang/unittests/Lex/HeaderSearchTest.cpp
  clang/unittests/Tooling/Syntax/TokensTest.cpp
  clang/unittests/Tooling/TransformerTest.cpp

Index: clang/unittests/Tooling/TransformerTest.cpp
===================================================================
--- clang/unittests/Tooling/TransformerTest.cpp
+++ clang/unittests/Tooling/TransformerTest.cpp
@@ -1622,21 +1622,22 @@
               return L.getFilePath() < R.getFilePath();
             });
 
-  ASSERT_EQ(Changes[0].getFilePath(), "./input.h");
-  EXPECT_THAT(Changes[0].getInsertedHeaders(), IsEmpty());
-  EXPECT_THAT(Changes[0].getRemovedHeaders(), IsEmpty());
+  const auto &change_h = Changes[1];
+  ASSERT_EQ(change_h.getFilePath(), "input.h");
+  EXPECT_THAT(change_h.getInsertedHeaders(), IsEmpty());
+  EXPECT_THAT(change_h.getRemovedHeaders(), IsEmpty());
   llvm::Expected<std::string> UpdatedCode =
-      clang::tooling::applyAllReplacements(Header,
-                                           Changes[0].getReplacements());
+      clang::tooling::applyAllReplacements(Header, change_h.getReplacements());
   ASSERT_TRUE(static_cast<bool>(UpdatedCode))
       << "Could not update code: " << llvm::toString(UpdatedCode.takeError());
   EXPECT_EQ(format(*UpdatedCode), "");
 
-  ASSERT_EQ(Changes[1].getFilePath(), "input.cc");
-  EXPECT_THAT(Changes[1].getInsertedHeaders(), IsEmpty());
-  EXPECT_THAT(Changes[1].getRemovedHeaders(), IsEmpty());
-  UpdatedCode = clang::tooling::applyAllReplacements(
-      Source, Changes[1].getReplacements());
+  const auto &change_cc = Changes[0];
+  ASSERT_EQ(change_cc.getFilePath(), "input.cc");
+  EXPECT_THAT(change_cc.getInsertedHeaders(), IsEmpty());
+  EXPECT_THAT(change_cc.getRemovedHeaders(), IsEmpty());
+  UpdatedCode =
+      clang::tooling::applyAllReplacements(Source, change_cc.getReplacements());
   ASSERT_TRUE(static_cast<bool>(UpdatedCode))
       << "Could not update code: " << llvm::toString(UpdatedCode.takeError());
   EXPECT_EQ(format(*UpdatedCode), format("#include \"input.h\"\n"));
@@ -1659,7 +1660,7 @@
       {{"input.h", Header}}));
 
   ASSERT_EQ(Changes.size(), 1U);
-  ASSERT_EQ(Changes[0].getFilePath(), "./input.h");
+  ASSERT_EQ(Changes[0].getFilePath(), "input.h");
   EXPECT_THAT(Changes[0].getInsertedHeaders(), ElementsAre("header.h"));
   EXPECT_THAT(Changes[0].getRemovedHeaders(), IsEmpty());
   llvm::Expected<std::string> UpdatedCode =
@@ -1708,7 +1709,7 @@
           ResultOf([](const AtomicChange &C) { return C.getFilePath(); },
                    "input.cc"),
           ResultOf([](const AtomicChange &C) { return C.getFilePath(); },
-                   "./input.h"))));
+                   "input.h"))));
 }
 
 TEST_F(TransformerTest, GeneratesMetadata) {
Index: clang/unittests/Tooling/Syntax/TokensTest.cpp
===================================================================
--- clang/unittests/Tooling/Syntax/TokensTest.cpp
+++ clang/unittests/Tooling/Syntax/TokensTest.cpp
@@ -292,7 +292,7 @@
       {"int main() {}",
        R"(expanded tokens:
   int main ( ) { }
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     int main ( ) { }
   no mappings.
@@ -301,7 +301,7 @@
       {"\t\n  int\t\n  main\t\n  (\t\n  )\t\n{\t\n  }\t\n",
        R"(expanded tokens:
   int main ( ) { }
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     int main ( ) { }
   no mappings.
@@ -313,7 +313,7 @@
       )cpp",
        R"(expanded tokens:
   <empty>
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     # pragma GCC visibility push ( public ) # pragma GCC visibility pop
   mappings:
@@ -322,7 +322,7 @@
       // Empty files should not crash.
       {R"cpp()cpp", R"(expanded tokens:
   <empty>
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     <empty>
   no mappings.
@@ -336,7 +336,7 @@
 )cpp",
           R"(expanded tokens:
   a
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     a # define MACRO ( ) A # B
   mappings:
@@ -401,7 +401,7 @@
   std::string Expected =
       "expanded tokens:\n"
       "  int a ;\n"
-      "file './input.cpp'\n"
+      "file 'input.cpp'\n"
       "  spelled tokens:\n"
       "    # define FOO a # include \"unresolved_file.h\" # undef FOO "
       "# ifdef X # else # endif # ifndef Y # endif # if 1 # elif 2 # else "
@@ -420,7 +420,7 @@
   )cpp",
        R"(expanded tokens:
   int const a ;
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     # define INT int const INT a ;
   mappings:
@@ -434,7 +434,7 @@
   )cpp",
        R"(expanded tokens:
   const int a ;
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     # define INT ( a ) const int INT ( 10 + 10 ) a ;
   mappings:
@@ -449,7 +449,7 @@
   )cpp",
        R"(expanded tokens:
   int const a ;
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     # define ID ( X ) X # define INT int const ID ( ID ( INT ) ) a ;
   mappings:
@@ -465,7 +465,7 @@
   )cpp",
        "expanded tokens:\n"
        "  int a = 1 * 2 + 3 * 4 + 5 ;\n"
-       "file './input.cpp'\n"
+       "file 'input.cpp'\n"
        "  spelled tokens:\n"
        "    # define ADD ( X , Y ) X + Y # define MULT ( X , Y ) X * Y int "
        "a = ADD ( MULT ( 1 , 2 ) , MULT ( 3 , ADD ( 4 , 5 ) ) ) ;\n"
@@ -482,7 +482,7 @@
     )cpp",
        R"(expanded tokens:
   <empty>
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     # define EMPTY # define EMPTY_FUNC ( X ) EMPTY EMPTY_FUNC ( 1 + 2 + 3 )
   mappings:
@@ -497,7 +497,7 @@
     )cpp",
        R"(expanded tokens:
   int a = 10 + 10 ;
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     # define FOO 10 + 10 ; int a = FOO
   mappings:
@@ -512,7 +512,7 @@
        )cpp",
        R"(expanded tokens:
   1 + 42
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     # define NUM 42 # define ID ( a ) a # define M 1 + ID M ( NUM )
   mappings:
@@ -601,19 +601,19 @@
 
   std::string Expected = R"(expanded tokens:
   int a = 100 ; int b = 1 + 2 ; int c = 1 + 2 * 3 ;
-file './input.cpp'
+file 'input.cpp'
   spelled tokens:
     # include "foo.h" int c = ADD ( 1 , MULT ( 2 , 3 ) ) ;
   mappings:
     ['#'_0, 'int'_3) => ['int'_12, 'int'_12)
     ['ADD'_6, ';'_17) => ['1'_15, ';'_20)
-file './foo.h'
+file 'foo.h'
   spelled tokens:
     # define ADD ( X , Y ) X + Y int a = 100 ; # include "bar.h"
   mappings:
     ['#'_0, 'int'_11) => ['int'_0, 'int'_0)
     ['#'_16, '<eof>'_19) => ['int'_5, 'int'_5)
-file './bar.h'
+file 'bar.h'
   spelled tokens:
     int b = ADD ( 1 , 2 ) ; # define MULT ( X , Y ) X * Y
   mappings:
Index: clang/unittests/Lex/HeaderSearchTest.cpp
===================================================================
--- clang/unittests/Lex/HeaderSearchTest.cpp
+++ clang/unittests/Lex/HeaderSearchTest.cpp
@@ -112,6 +112,23 @@
 }
 
 TEST_F(HeaderSearchTest, Dots) {
+  VFS->addFile("./inc/./foo.h", 0, nullptr, /*User=*/None, /*Group=*/None,
+               llvm::sys::fs::file_type::regular_file);
+  llvm::Expected<FileEntryRef> FileRef = FileMgr.getFileRef("inc/foo.h", false);
+  assert(FileRef);
+  const auto *const FE = &FileRef->getFileEntry();
+  EXPECT_EQ(StringRef(FileRef->getName()), StringRef("inc/foo.h"));
+
+  FileRef = FileMgr.getFileRef("./inc/./foo.h", false);
+  assert(FileRef);
+  EXPECT_EQ(StringRef(FileRef->getName()), StringRef("inc/foo.h"));
+  EXPECT_EQ(FE, &FileRef->getFileEntry());
+
+  FileRef = FileMgr.getFileRef("inc/./foo.h", false);
+  assert(FileRef);
+  EXPECT_EQ(StringRef(FileRef->getName()), StringRef("inc/foo.h"));
+  EXPECT_EQ(FE, &FileRef->getFileEntry());
+
   addSearchDir("/x/./y/");
   EXPECT_EQ(Search.suggestPathToFileForDiagnostics("/x/y/./z",
                                                    /*WorkingDir=*/"",
Index: clang/test/Modules/filename.cpp
===================================================================
--- clang/test/Modules/filename.cpp
+++ clang/test/Modules/filename.cpp
@@ -5,4 +5,4 @@
 
 // Make sure that headers that are referenced by module maps have __FILE__
 // reflect the include path they were found with.
-// CHECK: const char *p = "./Inputs/filename/a.h"
+// CHECK: const char *p = "Inputs/filename/a.h"
Index: clang/test/Modules/cxx20-hu-06.cpp
===================================================================
--- clang/test/Modules/cxx20-hu-06.cpp
+++ clang/test/Modules/cxx20-hu-06.cpp
@@ -65,4 +65,4 @@
   return FORTYTWO;
 }
 #endif
-// CHECK-IMP: remark: importing module './hu-01.h' from 'hu-01.pcm'
+// CHECK-IMP: remark: importing module 'hu-01.h' from 'hu-01.pcm'
Index: clang/test/Modules/cxx20-hu-05.cpp
===================================================================
--- clang/test/Modules/cxx20-hu-05.cpp
+++ clang/test/Modules/cxx20-hu-05.cpp
@@ -29,4 +29,4 @@
 #endif // __GUARD
 
 // CHECK-HU:  ====== C++20 Module structure ======
-// CHECK-HU-NEXT:  Header Unit './hu-01.h' is the Primary Module at index #1
+// CHECK-HU-NEXT:  Header Unit 'hu-01.h' is the Primary Module at index #1
Index: clang/test/Modules/cxx20-hu-04.cpp
===================================================================
--- clang/test/Modules/cxx20-hu-04.cpp
+++ clang/test/Modules/cxx20-hu-04.cpp
@@ -39,7 +39,7 @@
 // expected-no-diagnostics
 
 // CHECK-HU:  ====== C++20 Module structure ======
-// CHECK-HU-NEXT:  Header Unit './hu-01.h' is the Primary Module at index #1
+// CHECK-HU-NEXT:  Header Unit 'hu-01.h' is the Primary Module at index #1
 
 //--- hu-02.h
 export import "hu-01.h";
@@ -73,11 +73,11 @@
 }
 #endif
 
-// CHECK-IMP: remark: importing module './hu-01.h' from 'hu-01.pcm'
+// CHECK-IMP: remark: importing module 'hu-01.h' from 'hu-01.pcm'
 // CHECK-HU2:  ====== C++20 Module structure ======
-// CHECK-HU2-NEXT:  Header Unit './hu-02.h' is the Primary Module at index #2
+// CHECK-HU2-NEXT:  Header Unit 'hu-02.h' is the Primary Module at index #2
 // CHECK-HU2-NEXT:   Exports:
-// CHECK-HU2-NEXT:    Header Unit './hu-01.h' is at index #1
+// CHECK-HU2-NEXT:    Header Unit 'hu-01.h' is at index #1
 // expected-no-diagnostics
 
 //--- importer-01.cpp
@@ -101,5 +101,5 @@
   return foo(FORTYTWO + x + KAP);
 }
 
-// CHECK-IMP-HU2: remark: importing module './hu-02.h' from 'hu-02.pcm'
-// CHECK-IMP-HU2: remark: importing module './hu-01.h' into './hu-02.h' from '[[TDIR]]{{[/\\]}}hu-01.pcm'
+// CHECK-IMP-HU2: remark: importing module 'hu-02.h' from 'hu-02.pcm'
+// CHECK-IMP-HU2: remark: importing module 'hu-01.h' into 'hu-02.h' from '[[TDIR]]{{[/\\]}}hu-01.pcm'
Index: clang/test/Index/skip-parsed-bodies/compile_commands.json
===================================================================
--- clang/test/Index/skip-parsed-bodies/compile_commands.json
+++ clang/test/Index/skip-parsed-bodies/compile_commands.json
@@ -1,73 +1,73 @@
 [
-{
-  "directory": ".",
-  "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t1.cpp",
-  "file": "t1.cpp"
-},
-{
-  "directory": ".",
-  "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t2.cpp -DBLAH",
-  "file": "t2.cpp"
-},
-{
-  "directory": ".",
-  "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t3.cpp -DBLAH",
-  "file": "t3.cpp"
-}
+  {
+    "directory": ".",
+    "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t1.cpp",
+    "file": "t1.cpp"
+  },
+  {
+    "directory": ".",
+    "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t2.cpp -DBLAH",
+    "file": "t2.cpp"
+  },
+  {
+    "directory": ".",
+    "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t3.cpp -DBLAH",
+    "file": "t3.cpp"
+  }
 ]
 
-// RUN: c-index-test -index-compile-db %s | FileCheck %s
+    // RUN: c-index-test -index-compile-db %s | FileCheck %s
 
-// CHECK:      [startedTranslationUnit]
-// CHECK-NEXT: [enteredMainFile]: t1.cpp
-// CHECK:      [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
-// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
-// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:9:27
-// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
-// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: 1
-// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
-// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
-// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:15:5
-// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
-// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:19:5
-// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val1'
-// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val2'
-// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val3'
+    // CHECK:      [startedTranslationUnit]
+    // CHECK-NEXT: [enteredMainFile]: t1.cpp
+    // CHECK:      [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
+    // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
+    // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: t.h:9:27
+    // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
+    // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: 1
+    // CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
+    // CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
+    // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: t.h:15:5
+    // CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
+    // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: t.h:19:5
+    // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val1'
+    // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val2'
+    // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val3'
 
-// CHECK-NEXT: [startedTranslationUnit]
-// CHECK-NEXT: [enteredMainFile]: t2.cpp
-// CHECK:      [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
-// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
-// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
-// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isContainer: skipped
-// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
-// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
-// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
-// CHECK-NEXT: [ppIncludedFile]: ./pragma_once.h
-// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
-// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:25:5
-// CHECK:      [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
-// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./pragma_once.h:8:7
-// CHECK:      [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
-// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./imported.h:4:5
-// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val4'
-// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_tsval'
-// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_impval'
+    // CHECK-NEXT: [startedTranslationUnit]
+    // CHECK-NEXT: [enteredMainFile]: t2.cpp
+    // CHECK:      [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
+    // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
+    // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
+    // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isContainer: skipped
+    // CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
+    // CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
+    // CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
+    // CHECK-NEXT: [ppIncludedFile]: pragma_once.h
+    // CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
+    // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: t.h:25:5
+    // CHECK:      [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
+    // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: pragma_once.h:8:7
+    // CHECK:      [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
+    // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: imported.h:4:5
+    // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val4'
+    // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_tsval'
+    // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_impval'
 
-// CHECK-NEXT: [startedTranslationUnit]
-// CHECK-NEXT: [enteredMainFile]: t3.cpp
-// CHECK:      [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
-// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
-// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
-// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: skipped
-// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
-// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
-// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
-// CHECK-NEXT: [ppIncludedFile]: ./pragma_once.h
-// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
-// CHECK-NEXT: [indexDeclaration]: kind: variable | {{.*}} | loc: ./pragma_once.h:3:12
-// CHECK:      [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
-// CHECK-NOT:  [indexEntityReference]: kind: variable | name: some_val |
-// CHECK:      [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
-// CHECK-NOT:  [indexEntityReference]: kind: variable | name: some_val |
-// CHECK-NOT:  [diagnostic]: {{.*}} undeclared identifier
+    // CHECK-NEXT: [startedTranslationUnit]
+    // CHECK-NEXT: [enteredMainFile]: t3.cpp
+    // CHECK:      [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
+    // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
+    // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
+    // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: skipped
+    // CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
+    // CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
+    // CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
+    // CHECK-NEXT: [ppIncludedFile]: pragma_once.h
+    // CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
+    // CHECK-NEXT: [indexDeclaration]: kind: variable | {{.*}} | loc: pragma_once.h:3:12
+    // CHECK:      [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
+    // CHECK-NOT:  [indexEntityReference]: kind: variable | name: some_val |
+    // CHECK:      [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
+    // CHECK-NOT:  [indexEntityReference]: kind: variable | name: some_val |
+    // CHECK-NOT:  [diagnostic]: {{.*}} undeclared identifier
Index: clang/test/Frontend/dependency-gen.c
===================================================================
--- clang/test/Frontend/dependency-gen.c
+++ clang/test/Frontend/dependency-gen.c
@@ -16,7 +16,7 @@
 // RUN: %clang -MD -MF - %s -fsyntax-only -I .//./a/b/ | FileCheck -check-prefix=CHECK-FOUR %s
 // CHECK-FOUR: {{ }}a{{[/\\]}}b{{[/\\]}}x.h
 // RUN: %clang -MD -MF - %s -fsyntax-only -I a/b/. | FileCheck -check-prefix=CHECK-FIVE %s
-// CHECK-FIVE: {{ }}a{{[/\\]}}b{{[/\\]}}.{{[/\\]}}x.h
+// CHECK-FIVE: {{ }}a{{[/\\]}}b{{[/\\]}}x.h
 // RUN: cd a/b
 // RUN: %clang -MD -MF - %s -fsyntax-only -I ./ | FileCheck -check-prefix=CHECK-SIX %s
 // CHECK-SIX: {{ }}x.h
Index: clang/test/ClangScanDeps/header-search-pruning-transitive.c
===================================================================
--- clang/test/ClangScanDeps/header-search-pruning-transitive.c
+++ clang/test/ClangScanDeps/header-search-pruning-transitive.c
@@ -37,6 +37,9 @@
 //--- test.c
 #include "X.h"
 
+// clang-format mangles this .c file in unreasonable ways.
+// clang-format off
+
 //--- cdb_with_a.json.template
 [{
   "file": "DIR/test.c",
@@ -72,8 +75,8 @@
 // CHECK:            ],
 // CHECK-NEXT:       "context-hash": "[[HASH_X:.*]]",
 // CHECK-NEXT:       "file-deps": [
-// CHECK-NEXT:         "[[PREFIX]]/./X.h",
-// CHECK-NEXT:         "[[PREFIX]]/./module.modulemap"
+// CHECK-NEXT:         "[[PREFIX]]/X.h",
+// CHECK-NEXT:         "[[PREFIX]]/module.modulemap"
 // CHECK-NEXT:       ],
 // CHECK-NEXT:       "name": "X"
 // CHECK-NEXT:     },
@@ -84,11 +87,11 @@
 // CHECK:            ],
 // CHECK-NEXT:       "context-hash": "[[HASH_Y_WITH_A]]",
 // CHECK-NEXT:       "file-deps": [
-// CHECK-NEXT:         "[[PREFIX]]/./Y.h",
-// CHECK-NEXT:         "[[PREFIX]]/./a/a.h",
-// CHECK-NEXT:         "[[PREFIX]]/./begin/begin.h",
-// CHECK-NEXT:         "[[PREFIX]]/./end/end.h",
-// CHECK-NEXT:         "[[PREFIX]]/./module.modulemap"
+// CHECK-NEXT:         "[[PREFIX]]/Y.h",
+// CHECK-NEXT:         "[[PREFIX]]/a/a.h",
+// CHECK-NEXT:         "[[PREFIX]]/begin/begin.h",
+// CHECK-NEXT:         "[[PREFIX]]/end/end.h",
+// CHECK-NEXT:         "[[PREFIX]]/module.modulemap"
 // CHECK-NEXT:       ],
 // CHECK-NEXT:       "name": "Y"
 // CHECK-NEXT:     }
@@ -127,8 +130,8 @@
 // also has a different context hash from the first version of module X.
 // CHECK-NOT:        "context-hash": "[[HASH_X]]",
 // CHECK:            "file-deps": [
-// CHECK-NEXT:         "[[PREFIX]]/./X.h",
-// CHECK-NEXT:         "[[PREFIX]]/./module.modulemap"
+// CHECK-NEXT:         "[[PREFIX]]/X.h",
+// CHECK-NEXT:         "[[PREFIX]]/module.modulemap"
 // CHECK-NEXT:       ],
 // CHECK-NEXT:       "name": "X"
 // CHECK-NEXT:     },
@@ -139,10 +142,10 @@
 // CHECK:            ],
 // CHECK-NEXT:       "context-hash": "[[HASH_Y_WITHOUT_A]]",
 // CHECK-NEXT:       "file-deps": [
-// CHECK-NEXT:         "[[PREFIX]]/./Y.h",
-// CHECK-NEXT:         "[[PREFIX]]/./begin/begin.h",
-// CHECK-NEXT:         "[[PREFIX]]/./end/end.h",
-// CHECK-NEXT:         "[[PREFIX]]/./module.modulemap"
+// CHECK-NEXT:         "[[PREFIX]]/Y.h",
+// CHECK-NEXT:         "[[PREFIX]]/begin/begin.h",
+// CHECK-NEXT:         "[[PREFIX]]/end/end.h",
+// CHECK-NEXT:         "[[PREFIX]]/module.modulemap"
 // CHECK-NEXT:       ],
 // CHECK-NEXT:       "name": "Y"
 // CHECK-NEXT:     }
Index: clang/lib/Basic/FileManager.cpp
===================================================================
--- clang/lib/Basic/FileManager.cpp
+++ clang/lib/Basic/FileManager.cpp
@@ -136,6 +136,13 @@
 
   ++NumDirLookups;
 
+  SmallString<128> CleanDirName;
+  if (DirName.size() > 1) {
+    CleanDirName = DirName;
+    llvm::sys::path::remove_dots(CleanDirName);
+    DirName = CleanDirName;
+  }
+
   // See if there was already an entry in the map.  Note that the map
   // contains both virtual and real directories.
   auto SeenDirInsertResult =
@@ -205,6 +212,11 @@
 FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) {
   ++NumFileLookups;
 
+  SmallString<128> CleanFilename = Filename;
+  // Explicitly not removing "../" because doing so can break symlinks.
+  llvm::sys::path::remove_dots(CleanFilename, /*remove_dot_dot=*/false);
+  Filename = CleanFilename;
+
   // See if there is already an entry in the map.
   auto SeenFileInsertResult =
       SeenFileEntries.insert({Filename, std::errc::no_such_file_or_directory});
Index: clang/bindings/python/tests/cindex/test_translation_unit.py
===================================================================
--- clang/bindings/python/tests/cindex/test_translation_unit.py
+++ clang/bindings/python/tests/cindex/test_translation_unit.py
@@ -85,7 +85,7 @@
 int x;
 int SOME_DEFINE;
 """),
-                ('./fake.h', """
+                ('fake.h', """
 #define SOME_DEFINE y
 """)
                 ])
Index: clang-tools-extra/test/modularize/ProblemsMissingHeader.modularize
===================================================================
--- clang-tools-extra/test/modularize/ProblemsMissingHeader.modularize
+++ clang-tools-extra/test/modularize/ProblemsMissingHeader.modularize
@@ -1,3 +1,3 @@
 # RUN: not modularize %S/Inputs/MissingHeader/module.modulemap 2>&1 | FileCheck %s
 
-# CHECK: {{.*}}{{[/\\]}}Inputs/MissingHeader/module.modulemap:8:10: error : Header not found: Missing.h
+# CHECK: {{.*}}{{[/\\]}}Inputs{{[/\\]}}MissingHeader{{[/\\]}}module.modulemap:8:10: error : Header not found: Missing.h
Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
@@ -49,14 +49,14 @@
 //  CHECK-FIXES-ENABLED-NEXT:   STYLE_SECOND_BAD();
 //   CHECK-FIXES-SHARED-NEXT: }
 
-// CHECK-MESSAGES-DISABLED: global-style1/header.h:3:6: warning: invalid case style for function 'style_first_good'
-// CHECK-MESSAGES-ENABLED:  global-style1/header.h:5:6: warning: invalid case style for global function 'styleFirstBad'
-// CHECK-MESSAGES-ENABLED:  global-style1/header.h:7:5: warning: invalid case style for global function 'thisIsMainLikeIgnored'
-// CHECK-MESSAGES-DISABLED: global-style1/header.h:7:31: warning: invalid case style for parameter 'argc'
-// CHECK-MESSAGES-DISABLED: global-style1/header.h:7:49: warning: invalid case style for parameter 'argv'
-
-// CHECK-MESSAGES-DISABLED: global-style2/header.h:3:6: warning: invalid case style for function 'STYLE_SECOND_GOOD'
-// CHECK-MESSAGES-ENABLED:  global-style2/header.h:5:6: warning: invalid case style for global function 'styleSecondBad'
-// CHECK-MESSAGES-ENABLED:  global-style2/header.h:7:5: warning: invalid case style for global function 'thisIsMainLikeNotIgnored'
-// CHECK-MESSAGES-SHARED:   global-style2/header.h:7:34: warning: invalid case style for parameter 'argc'
-// CHECK-MESSAGES-SHARED:   global-style2/header.h:7:52: warning: invalid case style for parameter 'argv'
+// CHECK-MESSAGES-DISABLED: global-style1{{[/\\]}}header.h:3:6: warning: invalid case style for function 'style_first_good'
+// CHECK-MESSAGES-ENABLED:  global-style1{{[/\\]}}header.h:5:6: warning: invalid case style for global function 'styleFirstBad'
+// CHECK-MESSAGES-ENABLED:  global-style1{{[/\\]}}header.h:7:5: warning: invalid case style for global function 'thisIsMainLikeIgnored'
+// CHECK-MESSAGES-DISABLED: global-style1{{[/\\]}}header.h:7:31: warning: invalid case style for parameter 'argc'
+// CHECK-MESSAGES-DISABLED: global-style1{{[/\\]}}header.h:7:49: warning: invalid case style for parameter 'argv'
+
+// CHECK-MESSAGES-DISABLED: global-style2{{[/\\]}}header.h:3:6: warning: invalid case style for function 'STYLE_SECOND_GOOD'
+// CHECK-MESSAGES-ENABLED:  global-style2{{[/\\]}}header.h:5:6: warning: invalid case style for global function 'styleSecondBad'
+// CHECK-MESSAGES-ENABLED:  global-style2{{[/\\]}}header.h:7:5: warning: invalid case style for global function 'thisIsMainLikeNotIgnored'
+// CHECK-MESSAGES-SHARED:   global-style2{{[/\\]}}header.h:7:34: warning: invalid case style for parameter 'argc'
+// CHECK-MESSAGES-SHARED:   global-style2{{[/\\]}}header.h:7:52: warning: invalid case style for parameter 'argv'
Index: clang-tools-extra/test/clang-tidy/checkers/abseil-no-namespace.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/abseil-no-namespace.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/abseil-no-namespace.cpp
@@ -7,7 +7,7 @@
 
 /// Warning will be triggered on code that is not internal that is included.
 #include "absl/external-file.h"
-// CHECK: absl/external-file.h:1:11: warning: namespace 'absl' is reserved
+// CHECK: absl{{[/\\]}}external-file.h:1:11: warning: namespace 'absl' is reserved
 
 namespace absl {}
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: namespace 'absl' is reserved for implementation of the Abseil library and should not be opened in user code [abseil-no-namespace]
Index: clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp
@@ -6,7 +6,7 @@
 // CHECK-NOT: warning:
 
 #include "absl/external-file.h"
-// CHECK: absl/external-file.h:6:24: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil [abseil-no-internal-dependencies]
+// CHECK: absl{{[/\\]}}external-file.h:6:24: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil [abseil-no-internal-dependencies]
 
 void DirectAcess() {
   absl::strings_internal::InternalFunction();
Index: clang-tools-extra/test/clang-apply-replacements/order-dependent.cpp
===================================================================
--- clang-tools-extra/test/clang-apply-replacements/order-dependent.cpp
+++ clang-tools-extra/test/clang-apply-replacements/order-dependent.cpp
@@ -4,4 +4,5 @@
 // RUN: sed "s#\$(path)#%/T/Inputs/order-dependent#" %S/Inputs/order-dependent/file2.yaml > %T/Inputs/order-dependent/file2.yaml
 // RUN: sed "s#\$(path)#%/T/Inputs/order-dependent#" %S/Inputs/order-dependent/expected.txt > %T/Inputs/order-dependent/expected.txt
 // RUN: not clang-apply-replacements %T/Inputs/order-dependent > %T/Inputs/order-dependent/output.txt 2>&1
-// RUN: diff -b %T/Inputs/order-dependent/output.txt %T/Inputs/order-dependent/expected.txt
+// RUN: sed 's#\\#/#g' %T/Inputs/order-dependent/output.txt > %T/Inputs/order-dependent/output-u.txt
+// RUN: diff -b %T/Inputs/order-dependent/output-u.txt %T/Inputs/order-dependent/expected.txt
Index: clang-tools-extra/test/clang-apply-replacements/conflict.cpp
===================================================================
--- clang-tools-extra/test/clang-apply-replacements/conflict.cpp
+++ clang-tools-extra/test/clang-apply-replacements/conflict.cpp
@@ -4,7 +4,8 @@
 // RUN: sed "s#\$(path)#%/S/Inputs/conflict#" %S/Inputs/conflict/file3.yaml > %T/Inputs/conflict/file3.yaml
 // RUN: sed "s#\$(path)#%/S/Inputs/conflict#" %S/Inputs/conflict/expected.txt > %T/Inputs/conflict/expected.txt
 // RUN: not clang-apply-replacements %T/Inputs/conflict > %T/Inputs/conflict/output.txt 2>&1
-// RUN: diff -b %T/Inputs/conflict/output.txt %T/Inputs/conflict/expected.txt
+// RUN: sed 's#\\#/#g' %T/Inputs/conflict/output.txt > %T/Inputs/conflict/output-u.txt
+// RUN: diff -b %T/Inputs/conflict/output-u.txt %T/Inputs/conflict/expected.txt
 //
 // Check that the yaml files are *not* deleted after running clang-apply-replacements without remove-change-desc-files even when there is a failure.
 // RUN: ls -1 %T/Inputs/conflict | FileCheck %s --check-prefix=YAML
Index: clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp
+++ clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp
@@ -67,7 +67,9 @@
       // recent enough version of Google Test.
       llvm::StringRef FileName = PP->getSourceManager().getFilename(
           MD->getMacroInfo()->getDefinitionLoc());
-      ReplacementFound = FileName.endswith("gtest/gtest-typed-test.h") &&
+      SmallString<32> TypedTestFileName("gtest/gtest-typed-test.h");
+      llvm::sys::path::make_preferred(TypedTestFileName);
+      ReplacementFound = FileName.endswith(TypedTestFileName) &&
                          PP->getSpelling(MacroNameTok) == "TYPED_TEST_SUITE";
     }
   }
@@ -103,7 +105,9 @@
 
     llvm::StringRef FileName = PP->getSourceManager().getFilename(
         MD.getMacroInfo()->getDefinitionLoc());
-    if (!FileName.endswith("gtest/gtest-typed-test.h"))
+    SmallString<32> TypedTestFileName("gtest/gtest-typed-test.h");
+    llvm::sys::path::make_preferred(TypedTestFileName);
+    if (!FileName.endswith(TypedTestFileName))
       return;
 
     DiagnosticBuilder Diag = Check->diag(Loc, RenameCaseToSuiteMessage);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to