aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/misc/header-include-cycle.cpp6
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp4
-rw-r--r--clang/lib/Tooling/Syntax/Tokens.cpp4
-rw-r--r--clang/test/CXX/class/class.friend/p7-cxx20.cpp4
-rw-r--r--clang/test/CXX/class/class.mfct/p1-cxx20.cpp4
-rw-r--r--clang/test/Index/skip-parsed-bodies/compile_commands.json18
-rw-r--r--clang/test/Misc/remap-file.c2
-rw-r--r--clang/test/Modules/cxx20-hu-04.cpp12
-rw-r--r--clang/test/Modules/cxx20-hu-05.cpp2
-rw-r--r--clang/test/Modules/cxx20-hu-06.cpp2
-rw-r--r--clang/test/Modules/cxx20-include-translation.cpp10
-rw-r--r--clang/test/Preprocessor/file_test_windows.c4
-rw-r--r--clang/test/Preprocessor/microsoft-header-search-fail.c2
-rw-r--r--clang/unittests/Lex/PPDependencyDirectivesTest.cpp8
-rw-r--r--clang/unittests/Tooling/TransformerTest.cpp20
15 files changed, 53 insertions, 49 deletions
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/header-include-cycle.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/header-include-cycle.cpp
index 57f48d3..d3c71ad 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/header-include-cycle.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/header-include-cycle.cpp
@@ -4,10 +4,10 @@
// RUN: mkdir %T/misc-header-include-cycle-headers/system
// RUN: cp -r %S/Inputs/system/header-include-cycle* %T/misc-header-include-cycle-headers/system
// RUN: cp %s %T/header-include-cycle.cpp
-// RUN: clang-tidy %T/header-include-cycle.cpp -checks='-*,misc-header-include-cycle' -header-filter=.* \
+// RUN: clang-tidy %T%{fs-sep}header-include-cycle.cpp -checks='-*,misc-header-include-cycle' -header-filter=.* \
// RUN: -config="{CheckOptions: {misc-header-include-cycle.IgnoredFilesList: 'header-include-cycle.self-e.hpp'}}" \
-// RUN: -- -I%T/misc-header-include-cycle-headers -isystem %T/misc-header-include-cycle-headers/system \
-// RUN: --include %T/misc-header-include-cycle-headers/header-include-cycle.self-i.hpp | FileCheck %s \
+// RUN: -- -I%T%{fs-sep}misc-header-include-cycle-headers -isystem %T%{fs-sep}misc-header-include-cycle-headers%{fs-sep}system \
+// RUN: --include %T%{fs-sep}misc-header-include-cycle-headers%{fs-sep}header-include-cycle.self-i.hpp | FileCheck %s \
// RUN: -check-prefix=CHECK-MESSAGES "-implicit-check-not={{note|warning|error}}:" --dump-input=fail
// RUN: rm -rf %T/misc-header-include-cycle-headers
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index 80e1bad..798a249b4 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -915,10 +915,8 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
const FileEntry *Includer = IncluderAndDir.first;
// Concatenate the requested file onto the directory.
- // FIXME: Portability. Filename concatenation should be in sys::Path.
TmpDir = IncluderAndDir.second.getName();
- TmpDir.push_back('/');
- TmpDir.append(Filename.begin(), Filename.end());
+ llvm::sys::path::append(TmpDir, Filename);
// FIXME: We don't cache the result of getFileInfo across the call to
// getFileAndSuggestModule, because it's a reference to an element of
diff --git a/clang/lib/Tooling/Syntax/Tokens.cpp b/clang/lib/Tooling/Syntax/Tokens.cpp
index 9c2f470..baf9d76 100644
--- a/clang/lib/Tooling/Syntax/Tokens.cpp
+++ b/clang/lib/Tooling/Syntax/Tokens.cpp
@@ -943,8 +943,8 @@ std::string TokenBuffer::dumpForTests() const {
auto *Entry = SourceMgr->getFileEntryForID(ID);
if (!Entry)
continue; // Skip builtin files.
- OS << llvm::formatv("file '{0}'\n", Entry->getName())
- << " spelled tokens:\n"
+ std::string Path = llvm::sys::path::convert_to_slash(Entry->getName());
+ OS << llvm::formatv("file '{0}'\n", Path) << " spelled tokens:\n"
<< " ";
DumpTokens(OS, File.SpelledTokens);
OS << "\n";
diff --git a/clang/test/CXX/class/class.friend/p7-cxx20.cpp b/clang/test/CXX/class/class.friend/p7-cxx20.cpp
index 2baae8c..054e6fb 100644
--- a/clang/test/CXX/class/class.friend/p7-cxx20.cpp
+++ b/clang/test/CXX/class/class.friend/p7-cxx20.cpp
@@ -27,7 +27,7 @@ class Y {
friend void y(){};
};
-// CHECK-HU: `-CXXRecordDecl {{.*}} <./header-unit.h:2:1, line:4:1> line:2:7 class Y definition
+// CHECK-HU: `-CXXRecordDecl {{.*}} <.{{/|\\\\?}}header-unit.h:2:1, line:4:1> line:2:7 class Y definition
// CHECK-HU: |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 implicit class Y
// CHECK-HU-NEXT: `-FriendDecl {{.*}} <line:3:3, col:19> col:15
// CHECK-HU-NEXT: `-FunctionDecl {{.*}} parent {{.*}} <col:3, col:19> col:15 friend_undeclared y 'void ()' implicit-inline
@@ -48,7 +48,7 @@ export module M;
class Z {
friend void z(){};
};
-// CHECK-MOD: |-CXXRecordDecl {{.*}} <./header.h:2:1, line:4:1> line:2:7 in M.<global> hidden class A definition
+// CHECK-MOD: |-CXXRecordDecl {{.*}} <.{{/|\\\\?}}header.h:2:1, line:4:1> line:2:7 in M.<global> hidden class A definition
// CHECK-MOD: | |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 in M.<global> hidden implicit class A
// CHECK-MOD-NEXT: | `-FriendDecl {{.*}} <line:3:3, col:19> col:15 in M.<global>
// CHECK-MOD-NEXT: | `-FunctionDecl {{.*}} parent {{.*}} <col:3, col:19> col:15 in M.<global> hidden friend_undeclared a 'void ()' implicit-inline
diff --git a/clang/test/CXX/class/class.mfct/p1-cxx20.cpp b/clang/test/CXX/class/class.mfct/p1-cxx20.cpp
index f8c91b1..096617f 100644
--- a/clang/test/CXX/class/class.mfct/p1-cxx20.cpp
+++ b/clang/test/CXX/class/class.mfct/p1-cxx20.cpp
@@ -27,7 +27,7 @@ class Y {
void y(){};
};
-// CHECK-HU: `-CXXRecordDecl {{.*}} <./header-unit.h:2:1, line:4:1> line:2:7 class Y definition
+// CHECK-HU: `-CXXRecordDecl {{.*}} <.{{/|\\\\?}}header-unit.h:2:1, line:4:1> line:2:7 class Y definition
// CHECK-HU: |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 implicit class Y
// CHECK-HU-NEXT: `-CXXMethodDecl {{.*}} <line:3:3, col:12> col:8 y 'void ()' implicit-inline
@@ -48,7 +48,7 @@ class Z {
void z(){};
};
-// CHECK-MOD: |-CXXRecordDecl {{.*}} <./header.h:2:1, line:4:1> line:2:7 in M.<global> hidden class A definition
+// CHECK-MOD: |-CXXRecordDecl {{.*}} <.{{/|\\\\?}}header.h:2:1, line:4:1> line:2:7 in M.<global> hidden class A definition
// CHECK-MOD: | |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 in M.<global> hidden implicit class A
// CHECK-MOD-NEXT: | `-CXXMethodDecl {{.*}} <line:3:3, col:12> col:8 in M.<global> hidden a 'void ()' implicit-inline
diff --git a/clang/test/Index/skip-parsed-bodies/compile_commands.json b/clang/test/Index/skip-parsed-bodies/compile_commands.json
index 21021a9..991227a8 100644
--- a/clang/test/Index/skip-parsed-bodies/compile_commands.json
+++ b/clang/test/Index/skip-parsed-bodies/compile_commands.json
@@ -22,14 +22,14 @@
// 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: [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: [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: [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'
@@ -43,13 +43,13 @@
// 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: [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-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-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: [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'
@@ -63,9 +63,9 @@
// 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: [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-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
diff --git a/clang/test/Misc/remap-file.c b/clang/test/Misc/remap-file.c
index a2a56d9..d6b925a 100644
--- a/clang/test/Misc/remap-file.c
+++ b/clang/test/Misc/remap-file.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -remap-file "%s;%S/Inputs/remapped-file" -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-EXIST %s
// RUN: %clang_cc1 -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-NONEXIST %s
-// RUN: %clang_cc1 -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file-2" -remap-file "%S/nonexistent.h;%S/Inputs/remapped-file-3" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-HEADER %s
+// RUN: %clang_cc1 -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file-2" -remap-file "%S%{fs-sep}nonexistent.h;%S/Inputs/remapped-file-3" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-HEADER %s
// CHECK-EXIST: remap-file.c:1:28: warning: incompatible pointer types
// CHECK-NONEXIST: nonexistent.c:1:28: warning: incompatible pointer types
diff --git a/clang/test/Modules/cxx20-hu-04.cpp b/clang/test/Modules/cxx20-hu-04.cpp
index aed1bdb..8546b33 100644
--- a/clang/test/Modules/cxx20-hu-04.cpp
+++ b/clang/test/Modules/cxx20-hu-04.cpp
@@ -39,7 +39,7 @@ int baz(int);
// 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"; // expected-warning {{the implementation of header units is in an experimental phase}}
@@ -73,11 +73,11 @@ inline int bar(int x) {
}
#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 @@ int success(int x) {
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'
diff --git a/clang/test/Modules/cxx20-hu-05.cpp b/clang/test/Modules/cxx20-hu-05.cpp
index b0d7c0f..8147da7 100644
--- a/clang/test/Modules/cxx20-hu-05.cpp
+++ b/clang/test/Modules/cxx20-hu-05.cpp
@@ -29,4 +29,4 @@ int baz(int);
#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
diff --git a/clang/test/Modules/cxx20-hu-06.cpp b/clang/test/Modules/cxx20-hu-06.cpp
index 1048e49..ccbae15 100644
--- a/clang/test/Modules/cxx20-hu-06.cpp
+++ b/clang/test/Modules/cxx20-hu-06.cpp
@@ -65,4 +65,4 @@ inline int bar(int x) {
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'
diff --git a/clang/test/Modules/cxx20-include-translation.cpp b/clang/test/Modules/cxx20-include-translation.cpp
index 2528e83..b36eb17 100644
--- a/clang/test/Modules/cxx20-include-translation.cpp
+++ b/clang/test/Modules/cxx20-include-translation.cpp
@@ -81,7 +81,7 @@ module /*nothing here*/;
// This should be include-translated, when the header unit for h1 is available.
// expected-warning@+1 {{the implementation of header units is in an experimental phase}}
-#include "h1.h" // expected-remark {{treating #include as an import of module './h1.h'}}
+#include "h1.h" // expected-remark-re {{treating #include as an import of module '.{{/|\\\\?}}h1.h'}}
// Import of a header unit is allowed, named modules are not.
import "h2.h"; // expected-warning {{the implementation of header units is in an experimental phase}}
// A regular, untranslated, header
@@ -104,7 +104,7 @@ export void charlie() {
five();
}
-// CHECK: #pragma clang module import "./h1.h"
-// CHECK: import ./h2.h
-// CHECK: import ./h3.h
-// CHECK-NOT: #pragma clang module import "./h4.h"
+// CHECK: #pragma clang module import ".{{/|\\\\?}}h1.h"
+// CHECK: import .{{/|\\\\?}}h2.h
+// CHECK: import .{{/|\\\\?}}h3.h
+// CHECK-NOT: #pragma clang module import ".{{/|\\\\?}}h4.h"
diff --git a/clang/test/Preprocessor/file_test_windows.c b/clang/test/Preprocessor/file_test_windows.c
index 7cc8a8d..8932400 100644
--- a/clang/test/Preprocessor/file_test_windows.c
+++ b/clang/test/Preprocessor/file_test_windows.c
@@ -25,12 +25,12 @@ filename: __FILE__
#include "Inputs/include-file-test/file_test.h"
// CHECK: filename: "A:\\UNLIKELY_PATH\\empty\\file_test_windows.c"
-// CHECK: filename: "A:\\UNLIKELY_PATH\\empty/Inputs/include-file-test/file_test.h"
+// CHECK: filename: "A:\\UNLIKELY_PATH\\empty\\Inputs/include-file-test/file_test.h"
// CHECK: basefile: "A:\\UNLIKELY_PATH\\empty\\file_test_windows.c"
// CHECK-NOT: filename:
// CHECK-EVIL: filename: "A:\\UNLIKELY_PATH=empty\\file_test_windows.c"
-// CHECK-EVIL: filename: "A:\\UNLIKELY_PATH=empty/Inputs/include-file-test/file_test.h"
+// CHECK-EVIL: filename: "A:\\UNLIKELY_PATH=empty\\Inputs/include-file-test/file_test.h"
// CHECK-EVIL: basefile: "A:\\UNLIKELY_PATH=empty\\file_test_windows.c"
// CHECK-EVIL-NOT: filename:
diff --git a/clang/test/Preprocessor/microsoft-header-search-fail.c b/clang/test/Preprocessor/microsoft-header-search-fail.c
index 1468fc5..c377cb1 100644
--- a/clang/test/Preprocessor/microsoft-header-search-fail.c
+++ b/clang/test/Preprocessor/microsoft-header-search-fail.c
@@ -7,7 +7,7 @@
#include "x/header.h"
#include "z/header.h"
-// expected-warning-re@include/y/header.h:1 {{#include resolved using non-portable Microsoft search rules as: {{.*}}x/culprit.h}}
+// expected-warning-re@include/y/header.h:1 {{#include resolved using non-portable Microsoft search rules as: {{.*}}x{{/|\\\\?}}culprit.h}}
// expected-error@include/z/header.h:1 {{'culprit.h' file not found}}
//--- include/x/header.h
diff --git a/clang/unittests/Lex/PPDependencyDirectivesTest.cpp b/clang/unittests/Lex/PPDependencyDirectivesTest.cpp
index 2a3f241..4685021 100644
--- a/clang/unittests/Lex/PPDependencyDirectivesTest.cpp
+++ b/clang/unittests/Lex/PPDependencyDirectivesTest.cpp
@@ -140,10 +140,14 @@ TEST_F(PPDependencyDirectivesTest, MacroGuard) {
break;
}
- SmallVector<StringRef> ExpectedIncludes{
+ SmallVector<std::string> IncludedFilesSlash;
+ for (StringRef IncludedFile : IncludedFiles)
+ IncludedFilesSlash.push_back(
+ llvm::sys::path::convert_to_slash(IncludedFile));
+ SmallVector<std::string> ExpectedIncludes{
"main.c", "./head1.h", "./head2.h", "./head2.h", "./head3.h", "./head3.h",
};
- EXPECT_EQ(IncludedFiles, ExpectedIncludes);
+ EXPECT_EQ(IncludedFilesSlash, ExpectedIncludes);
}
} // anonymous namespace
diff --git a/clang/unittests/Tooling/TransformerTest.cpp b/clang/unittests/Tooling/TransformerTest.cpp
index 09fcf04..cbd84ab 100644
--- a/clang/unittests/Tooling/TransformerTest.cpp
+++ b/clang/unittests/Tooling/TransformerTest.cpp
@@ -1623,7 +1623,8 @@ TEST_F(TransformerTest, MultipleFiles) {
return L.getFilePath() < R.getFilePath();
});
- ASSERT_EQ(Changes[0].getFilePath(), "./input.h");
+ ASSERT_EQ(llvm::sys::path::convert_to_slash(Changes[0].getFilePath()),
+ "./input.h");
EXPECT_THAT(Changes[0].getInsertedHeaders(), IsEmpty());
EXPECT_THAT(Changes[0].getRemovedHeaders(), IsEmpty());
llvm::Expected<std::string> UpdatedCode =
@@ -1660,7 +1661,8 @@ TEST_F(TransformerTest, AddIncludeMultipleFiles) {
{{"input.h", Header}}));
ASSERT_EQ(Changes.size(), 1U);
- ASSERT_EQ(Changes[0].getFilePath(), "./input.h");
+ ASSERT_EQ(llvm::sys::path::convert_to_slash(Changes[0].getFilePath()),
+ "./input.h");
EXPECT_THAT(Changes[0].getInsertedHeaders(), ElementsAre("header.h"));
EXPECT_THAT(Changes[0].getRemovedHeaders(), IsEmpty());
llvm::Expected<std::string> UpdatedCode =
@@ -1702,14 +1704,14 @@ TEST_F(TransformerTest, MultiFileEdit) {
"clang-tool", std::make_shared<PCHContainerOperations>(),
{{"input.h", Header}}));
+ auto GetPathWithSlashes = [](const AtomicChange &C) {
+ return llvm::sys::path::convert_to_slash(C.getFilePath());
+ };
+
EXPECT_EQ(ErrorCount, 0);
- EXPECT_THAT(
- ChangeSets,
- UnorderedElementsAre(UnorderedElementsAre(
- ResultOf([](const AtomicChange &C) { return C.getFilePath(); },
- "input.cc"),
- ResultOf([](const AtomicChange &C) { return C.getFilePath(); },
- "./input.h"))));
+ EXPECT_THAT(ChangeSets, UnorderedElementsAre(UnorderedElementsAre(
+ ResultOf(GetPathWithSlashes, "input.cc"),
+ ResultOf(GetPathWithSlashes, "./input.h"))));
}
TEST_F(TransformerTest, GeneratesMetadata) {