Skip to content

Commit 5523fef

Browse files
committed
[clang][lex] Use preferred path separator in includer-relative lookup
There is a long-standing FIXME in `HeaderSearch.cpp` to use the path separator preferred by the platform instead of forward slash. There was an attempt to fix that (1cf6c28) which got reverted (cf385dc). I couldn't find an explanation, but my guess is that some tests assuming forward slash started failing. This commit fixes tests with that assumption. This is intended to be NFC, but there are two exceptions to that: * Some diagnostic messages might now contain backslash instead of forward slash. * Arguments to the "-remap-file" option that use forward slash might stop kicking in. Separators between potential includer path and header name need to be replaced by backslash in that case.
1 parent 9818bf2 commit 5523fef

File tree

15 files changed

+53
-49
lines changed

15 files changed

+53
-49
lines changed

clang-tools-extra/test/clang-tidy/checkers/misc/header-include-cycle.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
// RUN: mkdir %T/misc-header-include-cycle-headers/system
55
// RUN: cp -r %S/Inputs/system/header-include-cycle* %T/misc-header-include-cycle-headers/system
66
// RUN: cp %s %T/header-include-cycle.cpp
7-
// RUN: clang-tidy %T/header-include-cycle.cpp -checks='-*,misc-header-include-cycle' -header-filter=.* \
7+
// RUN: clang-tidy %T%{fs-sep}header-include-cycle.cpp -checks='-*,misc-header-include-cycle' -header-filter=.* \
88
// RUN: -config="{CheckOptions: {misc-header-include-cycle.IgnoredFilesList: 'header-include-cycle.self-e.hpp'}}" \
9-
// RUN: -- -I%T/misc-header-include-cycle-headers -isystem %T/misc-header-include-cycle-headers/system \
10-
// RUN: --include %T/misc-header-include-cycle-headers/header-include-cycle.self-i.hpp | FileCheck %s \
9+
// RUN: -- -I%T%{fs-sep}misc-header-include-cycle-headers -isystem %T%{fs-sep}misc-header-include-cycle-headers%{fs-sep}system \
10+
// RUN: --include %T%{fs-sep}misc-header-include-cycle-headers%{fs-sep}header-include-cycle.self-i.hpp | FileCheck %s \
1111
// RUN: -check-prefix=CHECK-MESSAGES "-implicit-check-not={{note|warning|error}}:" --dump-input=fail
1212
// RUN: rm -rf %T/misc-header-include-cycle-headers
1313

clang/lib/Lex/HeaderSearch.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,8 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
915915
const FileEntry *Includer = IncluderAndDir.first;
916916

917917
// Concatenate the requested file onto the directory.
918-
// FIXME: Portability. Filename concatenation should be in sys::Path.
919918
TmpDir = IncluderAndDir.second.getName();
920-
TmpDir.push_back('/');
921-
TmpDir.append(Filename.begin(), Filename.end());
919+
llvm::sys::path::append(TmpDir, Filename);
922920

923921
// FIXME: We don't cache the result of getFileInfo across the call to
924922
// getFileAndSuggestModule, because it's a reference to an element of

clang/lib/Tooling/Syntax/Tokens.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,8 +943,8 @@ std::string TokenBuffer::dumpForTests() const {
943943
auto *Entry = SourceMgr->getFileEntryForID(ID);
944944
if (!Entry)
945945
continue; // Skip builtin files.
946-
OS << llvm::formatv("file '{0}'\n", Entry->getName())
947-
<< " spelled tokens:\n"
946+
std::string Path = llvm::sys::path::convert_to_slash(Entry->getName());
947+
OS << llvm::formatv("file '{0}'\n", Path) << " spelled tokens:\n"
948948
<< " ";
949949
DumpTokens(OS, File.SpelledTokens);
950950
OS << "\n";

clang/test/CXX/class/class.friend/p7-cxx20.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Y {
2727
friend void y(){};
2828
};
2929

30-
// CHECK-HU: `-CXXRecordDecl {{.*}} <./header-unit.h:2:1, line:4:1> line:2:7 class Y definition
30+
// CHECK-HU: `-CXXRecordDecl {{.*}} <.{{/|\\\\?}}header-unit.h:2:1, line:4:1> line:2:7 class Y definition
3131
// CHECK-HU: |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 implicit class Y
3232
// CHECK-HU-NEXT: `-FriendDecl {{.*}} <line:3:3, col:19> col:15
3333
// CHECK-HU-NEXT: `-FunctionDecl {{.*}} parent {{.*}} <col:3, col:19> col:15 friend_undeclared y 'void ()' implicit-inline
@@ -48,7 +48,7 @@ export module M;
4848
class Z {
4949
friend void z(){};
5050
};
51-
// CHECK-MOD: |-CXXRecordDecl {{.*}} <./header.h:2:1, line:4:1> line:2:7 in M.<global> hidden class A definition
51+
// CHECK-MOD: |-CXXRecordDecl {{.*}} <.{{/|\\\\?}}header.h:2:1, line:4:1> line:2:7 in M.<global> hidden class A definition
5252
// CHECK-MOD: | |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 in M.<global> hidden implicit class A
5353
// CHECK-MOD-NEXT: | `-FriendDecl {{.*}} <line:3:3, col:19> col:15 in M.<global>
5454
// CHECK-MOD-NEXT: | `-FunctionDecl {{.*}} parent {{.*}} <col:3, col:19> col:15 in M.<global> hidden friend_undeclared a 'void ()' implicit-inline

clang/test/CXX/class/class.mfct/p1-cxx20.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Y {
2727
void y(){};
2828
};
2929

30-
// CHECK-HU: `-CXXRecordDecl {{.*}} <./header-unit.h:2:1, line:4:1> line:2:7 class Y definition
30+
// CHECK-HU: `-CXXRecordDecl {{.*}} <.{{/|\\\\?}}header-unit.h:2:1, line:4:1> line:2:7 class Y definition
3131
// CHECK-HU: |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 implicit class Y
3232
// CHECK-HU-NEXT: `-CXXMethodDecl {{.*}} <line:3:3, col:12> col:8 y 'void ()' implicit-inline
3333

@@ -48,7 +48,7 @@ class Z {
4848
void z(){};
4949
};
5050

51-
// CHECK-MOD: |-CXXRecordDecl {{.*}} <./header.h:2:1, line:4:1> line:2:7 in M.<global> hidden class A definition
51+
// CHECK-MOD: |-CXXRecordDecl {{.*}} <.{{/|\\\\?}}header.h:2:1, line:4:1> line:2:7 in M.<global> hidden class A definition
5252
// CHECK-MOD: | |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 in M.<global> hidden implicit class A
5353
// CHECK-MOD-NEXT: | `-CXXMethodDecl {{.*}} <line:3:3, col:12> col:8 in M.<global> hidden a 'void ()' implicit-inline
5454

clang/test/Index/skip-parsed-bodies/compile_commands.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
// CHECK-NEXT: [enteredMainFile]: t1.cpp
2323
// CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
2424
// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
25-
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:9:27
25+
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: .{{/|\\\\?}}t.h:9:27
2626
// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
2727
// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: 1
2828
// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
2929
// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
30-
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:15:5
30+
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: .{{/|\\\\?}}t.h:15:5
3131
// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
32-
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:19:5
32+
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: .{{/|\\\\?}}t.h:19:5
3333
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val1'
3434
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val2'
3535
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val3'
@@ -43,13 +43,13 @@
4343
// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
4444
// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
4545
// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
46-
// CHECK-NEXT: [ppIncludedFile]: ./pragma_once.h
46+
// CHECK-NEXT: [ppIncludedFile]: .{{/|\\\\?}}pragma_once.h
4747
// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
48-
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:25:5
48+
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: .{{/|\\\\?}}t.h:25:5
4949
// CHECK: [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
50-
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./pragma_once.h:8:7
50+
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: .{{/|\\\\?}}pragma_once.h:8:7
5151
// CHECK: [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
52-
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./imported.h:4:5
52+
// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: .{{/|\\\\?}}imported.h:4:5
5353
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val4'
5454
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_tsval'
5555
// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_impval'
@@ -63,9 +63,9 @@
6363
// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
6464
// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
6565
// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
66-
// CHECK-NEXT: [ppIncludedFile]: ./pragma_once.h
66+
// CHECK-NEXT: [ppIncludedFile]: .{{/|\\\\?}}pragma_once.h
6767
// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
68-
// CHECK-NEXT: [indexDeclaration]: kind: variable | {{.*}} | loc: ./pragma_once.h:3:12
68+
// CHECK-NEXT: [indexDeclaration]: kind: variable | {{.*}} | loc: .{{/|\\\\?}}pragma_once.h:3:12
6969
// CHECK: [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
7070
// CHECK-NOT: [indexEntityReference]: kind: variable | name: some_val |
7171
// CHECK: [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped

clang/test/Misc/remap-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cc1 -remap-file "%s;%S/Inputs/remapped-file" -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-EXIST %s
22
// 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
3-
// 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
3+
// 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
44

55
// CHECK-EXIST: remap-file.c:1:28: warning: incompatible pointer types
66
// CHECK-NONEXIST: nonexistent.c:1:28: warning: incompatible pointer types

clang/test/Modules/cxx20-hu-04.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ int baz(int);
3939
// expected-no-diagnostics
4040

4141
// CHECK-HU: ====== C++20 Module structure ======
42-
// CHECK-HU-NEXT: Header Unit './hu-01.h' is the Primary Module at index #1
42+
// CHECK-HU-NEXT: Header Unit '.{{/|\\\\?}}hu-01.h' is the Primary Module at index #1
4343

4444
//--- hu-02.h
4545
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) {
7373
}
7474
#endif
7575

76-
// CHECK-IMP: remark: importing module './hu-01.h' from 'hu-01.pcm'
76+
// CHECK-IMP: remark: importing module '.{{/|\\\\?}}hu-01.h' from 'hu-01.pcm'
7777
// CHECK-HU2: ====== C++20 Module structure ======
78-
// CHECK-HU2-NEXT: Header Unit './hu-02.h' is the Primary Module at index #2
78+
// CHECK-HU2-NEXT: Header Unit '.{{/|\\\\?}}hu-02.h' is the Primary Module at index #2
7979
// CHECK-HU2-NEXT: Exports:
80-
// CHECK-HU2-NEXT: Header Unit './hu-01.h' is at index #1
80+
// CHECK-HU2-NEXT: Header Unit '.{{/|\\\\?}}hu-01.h' is at index #1
8181
// expected-no-diagnostics
8282

8383
//--- importer-01.cpp
@@ -101,5 +101,5 @@ int success(int x) {
101101
return foo(FORTYTWO + x + KAP);
102102
}
103103

104-
// CHECK-IMP-HU2: remark: importing module './hu-02.h' from 'hu-02.pcm'
105-
// CHECK-IMP-HU2: remark: importing module './hu-01.h' into './hu-02.h' from '[[TDIR]]{{[/\\]}}hu-01.pcm'
104+
// CHECK-IMP-HU2: remark: importing module '.{{/|\\\\?}}hu-02.h' from 'hu-02.pcm'
105+
// CHECK-IMP-HU2: remark: importing module '.{{/|\\\\?}}hu-01.h' into '.{{/|\\\\?}}hu-02.h' from '[[TDIR]]{{[/\\]}}hu-01.pcm'

clang/test/Modules/cxx20-hu-05.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ int baz(int);
2929
#endif // __GUARD
3030

3131
// CHECK-HU: ====== C++20 Module structure ======
32-
// CHECK-HU-NEXT: Header Unit './hu-01.h' is the Primary Module at index #1
32+
// CHECK-HU-NEXT: Header Unit '.{{/|\\\\?}}hu-01.h' is the Primary Module at index #1

clang/test/Modules/cxx20-hu-06.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ inline int bar(int x) {
6565
return FORTYTWO;
6666
}
6767
#endif
68-
// CHECK-IMP: remark: importing module './hu-01.h' from 'hu-01.pcm'
68+
// CHECK-IMP: remark: importing module '.{{/|\\\\?}}hu-01.h' from 'hu-01.pcm'

clang/test/Modules/cxx20-include-translation.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module /*nothing here*/;
8181

8282
// This should be include-translated, when the header unit for h1 is available.
8383
// expected-warning@+1 {{the implementation of header units is in an experimental phase}}
84-
#include "h1.h" // expected-remark {{treating #include as an import of module './h1.h'}}
84+
#include "h1.h" // expected-remark-re {{treating #include as an import of module '.{{/|\\\\?}}h1.h'}}
8585
// Import of a header unit is allowed, named modules are not.
8686
import "h2.h"; // expected-warning {{the implementation of header units is in an experimental phase}}
8787
// A regular, untranslated, header
@@ -104,7 +104,7 @@ export void charlie() {
104104
five();
105105
}
106106

107-
// CHECK: #pragma clang module import "./h1.h"
108-
// CHECK: import ./h2.h
109-
// CHECK: import ./h3.h
110-
// CHECK-NOT: #pragma clang module import "./h4.h"
107+
// CHECK: #pragma clang module import ".{{/|\\\\?}}h1.h"
108+
// CHECK: import .{{/|\\\\?}}h2.h
109+
// CHECK: import .{{/|\\\\?}}h3.h
110+
// CHECK-NOT: #pragma clang module import ".{{/|\\\\?}}h4.h"

clang/test/Preprocessor/file_test_windows.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ filename: __FILE__
2525
#include "Inputs/include-file-test/file_test.h"
2626

2727
// CHECK: filename: "A:\\UNLIKELY_PATH\\empty\\file_test_windows.c"
28-
// CHECK: filename: "A:\\UNLIKELY_PATH\\empty/Inputs/include-file-test/file_test.h"
28+
// CHECK: filename: "A:\\UNLIKELY_PATH\\empty\\Inputs/include-file-test/file_test.h"
2929
// CHECK: basefile: "A:\\UNLIKELY_PATH\\empty\\file_test_windows.c"
3030
// CHECK-NOT: filename:
3131

3232
// CHECK-EVIL: filename: "A:\\UNLIKELY_PATH=empty\\file_test_windows.c"
33-
// CHECK-EVIL: filename: "A:\\UNLIKELY_PATH=empty/Inputs/include-file-test/file_test.h"
33+
// CHECK-EVIL: filename: "A:\\UNLIKELY_PATH=empty\\Inputs/include-file-test/file_test.h"
3434
// CHECK-EVIL: basefile: "A:\\UNLIKELY_PATH=empty\\file_test_windows.c"
3535
// CHECK-EVIL-NOT: filename:
3636

clang/test/Preprocessor/microsoft-header-search-fail.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "x/header.h"
88
#include "z/header.h"
99

10-
// expected-warning-re@include/y/header.h:1 {{#include resolved using non-portable Microsoft search rules as: {{.*}}x/culprit.h}}
10+
// expected-warning-re@include/y/header.h:1 {{#include resolved using non-portable Microsoft search rules as: {{.*}}x{{/|\\\\?}}culprit.h}}
1111
// expected-error@include/z/header.h:1 {{'culprit.h' file not found}}
1212

1313
//--- include/x/header.h

clang/unittests/Lex/PPDependencyDirectivesTest.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,14 @@ TEST_F(PPDependencyDirectivesTest, MacroGuard) {
140140
break;
141141
}
142142

143-
SmallVector<StringRef> ExpectedIncludes{
143+
SmallVector<std::string> IncludedFilesSlash;
144+
for (StringRef IncludedFile : IncludedFiles)
145+
IncludedFilesSlash.push_back(
146+
llvm::sys::path::convert_to_slash(IncludedFile));
147+
SmallVector<std::string> ExpectedIncludes{
144148
"main.c", "./head1.h", "./head2.h", "./head2.h", "./head3.h", "./head3.h",
145149
};
146-
EXPECT_EQ(IncludedFiles, ExpectedIncludes);
150+
EXPECT_EQ(IncludedFilesSlash, ExpectedIncludes);
147151
}
148152

149153
} // anonymous namespace

clang/unittests/Tooling/TransformerTest.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,8 @@ TEST_F(TransformerTest, MultipleFiles) {
16231623
return L.getFilePath() < R.getFilePath();
16241624
});
16251625

1626-
ASSERT_EQ(Changes[0].getFilePath(), "./input.h");
1626+
ASSERT_EQ(llvm::sys::path::convert_to_slash(Changes[0].getFilePath()),
1627+
"./input.h");
16271628
EXPECT_THAT(Changes[0].getInsertedHeaders(), IsEmpty());
16281629
EXPECT_THAT(Changes[0].getRemovedHeaders(), IsEmpty());
16291630
llvm::Expected<std::string> UpdatedCode =
@@ -1660,7 +1661,8 @@ TEST_F(TransformerTest, AddIncludeMultipleFiles) {
16601661
{{"input.h", Header}}));
16611662

16621663
ASSERT_EQ(Changes.size(), 1U);
1663-
ASSERT_EQ(Changes[0].getFilePath(), "./input.h");
1664+
ASSERT_EQ(llvm::sys::path::convert_to_slash(Changes[0].getFilePath()),
1665+
"./input.h");
16641666
EXPECT_THAT(Changes[0].getInsertedHeaders(), ElementsAre("header.h"));
16651667
EXPECT_THAT(Changes[0].getRemovedHeaders(), IsEmpty());
16661668
llvm::Expected<std::string> UpdatedCode =
@@ -1702,14 +1704,14 @@ TEST_F(TransformerTest, MultiFileEdit) {
17021704
"clang-tool", std::make_shared<PCHContainerOperations>(),
17031705
{{"input.h", Header}}));
17041706

1707+
auto GetPathWithSlashes = [](const AtomicChange &C) {
1708+
return llvm::sys::path::convert_to_slash(C.getFilePath());
1709+
};
1710+
17051711
EXPECT_EQ(ErrorCount, 0);
1706-
EXPECT_THAT(
1707-
ChangeSets,
1708-
UnorderedElementsAre(UnorderedElementsAre(
1709-
ResultOf([](const AtomicChange &C) { return C.getFilePath(); },
1710-
"input.cc"),
1711-
ResultOf([](const AtomicChange &C) { return C.getFilePath(); },
1712-
"./input.h"))));
1712+
EXPECT_THAT(ChangeSets, UnorderedElementsAre(UnorderedElementsAre(
1713+
ResultOf(GetPathWithSlashes, "input.cc"),
1714+
ResultOf(GetPathWithSlashes, "./input.h"))));
17131715
}
17141716

17151717
TEST_F(TransformerTest, GeneratesMetadata) {

0 commit comments

Comments
 (0)