erikjv updated this revision to Diff 87376.
erikjv added a comment.
Fixed all failing tests on Windows.
https://reviews.llvm.org/D27810
Files:
lib/Basic/FileManager.cpp
lib/Basic/VirtualFileSystem.cpp
lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
test/CodeGen/debug-prefix-map.c
test/Driver/ps4-header-search.c
test/Frontend/dependency-gen.c
test/Frontend/include-duplicate-removal.c
test/Index/annotate-module.m
test/Index/index-module.m
test/Index/skip-parsed-bodies/compile_commands.json
test/Modules/filename.cpp
test/Modules/malformed.cpp
test/Modules/relative-dep-gen.cpp
test/Preprocessor/headermap-rel2.c
test/Preprocessor/iwithprefix.c
unittests/Basic/FileManagerTest.cpp
Index: unittests/Basic/FileManagerTest.cpp
===================================================================
--- unittests/Basic/FileManagerTest.cpp
+++ unittests/Basic/FileManagerTest.cpp
@@ -12,6 +12,7 @@
#include "clang/Basic/FileSystemStatCache.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Path.h"
#include "gtest/gtest.h"
using namespace llvm;
@@ -29,15 +30,17 @@
llvm::StringMap<FileData, llvm::BumpPtrAllocator> StatCalls;
void InjectFileOrDirectory(const char *Path, ino_t INode, bool IsFile) {
+ SmallString<128> NativePath(Path);
+ llvm::sys::path::native(NativePath);
FileData Data;
- Data.Name = Path;
+ Data.Name = NativePath.c_str();
Data.Size = 0;
Data.ModTime = 0;
Data.UniqueID = llvm::sys::fs::UniqueID(1, INode);
Data.IsDirectory = !IsFile;
Data.IsNamedPipe = false;
Data.InPCH = false;
- StatCalls[Path] = Data;
+ StatCalls[NativePath] = Data;
}
public:
@@ -89,7 +92,11 @@
dir = file->getDir();
ASSERT_TRUE(dir != nullptr);
+#ifdef LLVM_ON_WIN32
+ EXPECT_EQ("x\\y", dir->getName());
+#else
EXPECT_EQ("x/y", dir->getName());
+#endif
}
// Before any virtual file is added, no virtual directory exists.
@@ -115,7 +122,9 @@
const DirectoryEntry *dir = manager.getDirectory("virtual/dir");
ASSERT_TRUE(dir != nullptr);
- EXPECT_EQ("virtual/dir", dir->getName());
+ SmallString<10> ExpectedName("virtual/dir");
+ llvm::sys::path::native(ExpectedName);
+ EXPECT_EQ(ExpectedName, dir->getName());
dir = manager.getDirectory("virtual");
ASSERT_TRUE(dir != nullptr);
@@ -140,11 +149,15 @@
const FileEntry *file = manager.getFile("/tmp/test");
ASSERT_TRUE(file != nullptr);
- EXPECT_EQ("/tmp/test", file->getName());
+ SmallString<10> ExpectedName("/tmp/test");
+ llvm::sys::path::native(ExpectedName);
+ EXPECT_EQ(ExpectedName, file->getName());
const DirectoryEntry *dir = file->getDir();
ASSERT_TRUE(dir != nullptr);
- EXPECT_EQ("/tmp", dir->getName());
+ ExpectedName = "/tmp";
+ llvm::sys::path::native(ExpectedName);
+ EXPECT_EQ(ExpectedName, dir->getName());
#ifdef LLVM_ON_WIN32
file = manager.getFile(FileName);
@@ -164,11 +177,15 @@
manager.getVirtualFile("virtual/dir/bar.h", 100, 0);
const FileEntry *file = manager.getFile("virtual/dir/bar.h");
ASSERT_TRUE(file != nullptr);
- EXPECT_EQ("virtual/dir/bar.h", file->getName());
+ SmallString<10> ExpectedName("virtual/dir/bar.h");
+ llvm::sys::path::native(ExpectedName);
+ EXPECT_EQ(ExpectedName, file->getName());
const DirectoryEntry *dir = file->getDir();
ASSERT_TRUE(dir != nullptr);
- EXPECT_EQ("virtual/dir", dir->getName());
+ ExpectedName = "virtual/dir";
+ llvm::sys::path::native(ExpectedName);
+ EXPECT_EQ(ExpectedName, dir->getName());
}
// getFile() returns different FileEntries for different paths when
Index: test/Preprocessor/iwithprefix.c
===================================================================
--- test/Preprocessor/iwithprefix.c
+++ test/Preprocessor/iwithprefix.c
@@ -8,9 +8,9 @@
// RUN: FileCheck %s < %t.out
// CHECK: #include <...> search starts here:
-// CHECK: {{.*}}.tmps/first
+// CHECK: {{.*}}.tmps{{/|\\}}first
// CHECK: {{/|\\}}lib{{(32|64)?}}{{/|\\}}clang{{/|\\}}{{[.0-9]+}}{{/|\\}}include
-// CHECK: {{.*}}.tmps/second
+// CHECK: {{.*}}.tmps{{/|\\}}second
// CHECK-NOT: {{.*}}.tmps
Index: test/Preprocessor/headermap-rel2.c
===================================================================
--- test/Preprocessor/headermap-rel2.c
+++ test/Preprocessor/headermap-rel2.c
@@ -5,9 +5,9 @@
// RUN: %clang_cc1 -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isystem %S/Inputs/headermap-rel2/system/usr/include -I %S/Inputs/headermap-rel2 -H 2> %t.out
// RUN: FileCheck %s -input-file %t.out
-// CHECK: Product/someheader.h
-// CHECK: system/usr/include{{[/\\]+}}someheader.h
-// CHECK: system/usr/include{{[/\\]+}}someheader.h
+// CHECK: Product{{/|\\\\}}someheader.h
+// CHECK: system{{/|\\\\}}usr{{/|\\\\}}include{{/|\\\\}}someheader.h
+// CHECK: system{{/|\\\\}}usr{{/|\\\\}}include{{/|\\\\}}someheader.h
#include "someheader.h"
#include <someheader.h>
Index: test/Modules/relative-dep-gen.cpp
===================================================================
--- test/Modules/relative-dep-gen.cpp
+++ test/Modules/relative-dep-gen.cpp
@@ -30,9 +30,9 @@
#include "Inputs/relative-dep-gen-1.h"
// CHECK-BUILD: mod.pcm:
-// CHECK-BUILD: {{[ \t]}}Inputs/relative-dep-gen{{(-cwd)?}}.modulemap
-// CHECK-BUILD: {{[ \t]}}Inputs/relative-dep-gen-1.h
-// CHECK-BUILD: {{[ \t]}}Inputs/relative-dep-gen-2.h
+// CHECK-BUILD: {{[ \t]}}Inputs{{/|\\}}relative-dep-gen{{(-cwd)?}}.modulemap
+// CHECK-BUILD: {{[ \t]}}Inputs{{/|\\}}relative-dep-gen-1.h
+// CHECK-BUILD: {{[ \t]}}Inputs{{/|\\}}relative-dep-gen-2.h
// CHECK-USE: use.o:
// CHECK-USE-DAG: {{[ \t]}}relative-dep-gen.cpp
// CHECK-USE-DAG: {{[ \t]}}Inputs{{[/\\]}}relative-dep-gen-1.h
Index: test/Modules/malformed.cpp
===================================================================
--- test/Modules/malformed.cpp
+++ test/Modules/malformed.cpp
@@ -12,18 +12,18 @@
#include STR(HEADER)
// CHECK-A: While building module 'malformed_a'
-// CHECK-A: {{^}}Inputs/malformed/a1.h:1:{{.*}} error: expected '}' at end of module
-// CHECK-A: {{^}}Inputs/malformed/a1.h:1:{{.*}} note: to match this '{'
+// CHECK-A: {{^}}Inputs{{/|\\}}malformed{{/|\\}}a1.h:1:{{.*}} error: expected '}' at end of module
+// CHECK-A: {{^}}Inputs{{/|\\}}malformed{{/|\\}}a1.h:1:{{.*}} note: to match this '{'
//
// CHECK-A: While building module 'malformed_a'
-// CHECK-A: {{^}}Inputs/malformed/a2.h:1:{{.*}} error: extraneous closing brace
+// CHECK-A: {{^}}Inputs{{/|\\}}malformed{{/|\\}}a2.h:1:{{.*}} error: extraneous closing brace
// CHECK-B: While building module 'malformed_b'
-// CHECK-B: {{^}}Inputs/malformed/b1.h:2:{{.*}} error: import of module 'malformed_b.b2' appears within 'S'
+// CHECK-B: {{^}}Inputs{{/|\\}}malformed{{/|\\}}b1.h:2:{{.*}} error: import of module 'malformed_b.b2' appears within 'S'
void test() { f<int>(); }
// Test that we use relative paths to name files within an imported module.
//
// CHECK-C: In module 'c' imported from malformed.cpp:12:
-// CHECK-C: {{^}}Inputs/malformed/c.h:1:33: error: type 'int' cannot be used prior to '::'
+// CHECK-C: {{^}}Inputs{{/|\\}}malformed{{/|\\}}c.h:1:33: error: type 'int' cannot be used prior to '::'
// CHECK-C: {{^}}malformed.cpp:[[@LINE-5]]:15: note: in instantiation of
Index: test/Modules/filename.cpp
===================================================================
--- test/Modules/filename.cpp
+++ 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: test/Index/skip-parsed-bodies/compile_commands.json
===================================================================
--- test/Index/skip-parsed-bodies/compile_commands.json
+++ 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
Index: test/Index/index-module.m
===================================================================
--- test/Index/index-module.m
+++ test/Index/index-module.m
@@ -12,7 +12,7 @@
// RUN: -Xclang -fdisable-module-hash | FileCheck %s
// CHECK-NOT: [indexDeclaration]
-// CHECK: [ppIncludedFile]: {{.*}}/Modules/Inputs/DependsOnModule.framework{{[/\\]}}Headers{{[/\\]}}DependsOnModule.h | name: "DependsOnModule/DependsOnModule.h" | hash loc: 2:1 | isImport: 0 | isAngled: 1 | isModule: 1
+// CHECK: [ppIncludedFile]: {{.*}}{{[/\\]}}Modules{{[/\\]}}Inputs{{[/\\]}}DependsOnModule.framework{{[/\\]}}Headers{{[/\\]}}DependsOnModule.h | name: "DependsOnModule/DependsOnModule.h" | hash loc: 2:1 | isImport: 0 | isAngled: 1 | isModule: 1
// CHECK-NEXT: [importedASTFile]: [[PCM:.*[/\\]DependsOnModule\.pcm]] | loc: 2:1 | name: "DependsOnModule" | isImplicit: 1
// CHECK-NOT: [indexDeclaration]
// CHECK: [importedASTFile]: [[PCM]] | loc: 3:1 | name: "DependsOnModule" | isImplicit: 0
@@ -23,13 +23,13 @@
// RUN: c-index-test -index-tu %t.cache.sys/DependsOnModule.pcm | FileCheck %s -check-prefix=CHECK-DMOD-AST
// CHECK-DMOD: [startedTranslationUnit]
-// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_MODULE_H:.*/Modules/Inputs/DependsOnModule\.framework[/\\]Headers[/\\]DependsOnModule\.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule
-// CHECK-DMOD-NEXT: [ppIncludedFile]: {{.*}}/Modules/Inputs/Module.framework{{[/\\]}}Headers{{[/\\]}}Module.h | name: "Module/Module.h" | hash loc: {{.*}}/Modules/Inputs/DependsOnModule.framework{{[/\\]}}Headers{{[/\\]}}DependsOnModule.h:1:1 | isImport: 0 | isAngled: 1 | isModule: 1 | module: Module
-// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_OTHER_H:.*/Modules/Inputs/DependsOnModule\.framework[/\\]Headers[/\\]other\.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule
-// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_NOT_CXX_H:.*/Modules/Inputs/DependsOnModule\.framework[/\\]Headers[/\\]not_cxx\.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule.NotCXX
-// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_SUB_H:.*/Modules/Inputs/DependsOnModule\.framework[/\\]Frameworks[/\\]SubFramework\.framework[/\\]Headers[/\\]SubFramework\.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule.SubFramework
-// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_SUB_OTHER_H:.*/Modules/Inputs/DependsOnModule.framework[/\\]Frameworks/SubFramework\.framework/Headers/Other\.h]] | name: "SubFramework/Other.h" | hash loc: [[DMOD_SUB_H]]:1:1 | isImport: 0 | isAngled: 0 | isModule: 0 | module: DependsOnModule.SubFramework.Other
-// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_PRIVATE_H:.*/Modules/Inputs/DependsOnModule.framework[/\\]PrivateHeaders[/\\]DependsOnModulePrivate.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule.Private.DependsOnModule
+// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_MODULE_H:.*[/\\]Modules[/\\]Inputs[/\\]DependsOnModule\.framework[/\\]Headers[/\\]DependsOnModule\.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule
+// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_IGNORE1:.*[/\\]Modules[/\\]Inputs[/\\]Module\.framework[/\\]Headers[/\\]Module.h]] | name: "Module/Module.h" | hash loc: [[DMOD_IGNORE2:.*[/\\]Modules[/\\]Inputs[/\\]DependsOnModule\.framework[/\\]Headers[/\\]DependsOnModule.h:1:1]] | isImport: 0 | isAngled: 1 | isModule: 1 | module: Module
+// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_OTHER_H:.*[/\\]Modules[/\\]Inputs[/\\]DependsOnModule\.framework[/\\]Headers[/\\]other\.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule
+// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_NOT_CXX_H:.*[/\\]Modules[/\\]Inputs[/\\]DependsOnModule\.framework[/\\]Headers[/\\]not_cxx\.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule.NotCXX
+// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_SUB_H:.*[/\\]Modules[/\\]Inputs[/\\]DependsOnModule\.framework[/\\]Frameworks[/\\]SubFramework\.framework[/\\]Headers[/\\]SubFramework\.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule.SubFramework
+// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_SUB_OTHER_H:.*[/\\]Modules[/\\]Inputs[/\\]DependsOnModule.framework[/\\]Frameworks[/\\]SubFramework\.framework[/\\]Headers[/\\]Other\.h]] | name: "SubFramework/Other.h" | hash loc: [[DMOD_SUB_H]]:1:1 | isImport: 0 | isAngled: 0 | isModule: 0 | module: DependsOnModule.SubFramework.Other
+// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_PRIVATE_H:.*[/\\]Modules[/\\]Inputs[/\\]DependsOnModule.framework[/\\]PrivateHeaders[/\\]DependsOnModulePrivate.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule.Private.DependsOnModule
// CHECK-DMOD-NEXT: [importedASTFile]: {{.*}}.cache{{(.sys)?[/\\]}}Module.pcm | loc: [[DMOD_MODULE_H]]:1:1 | name: "Module" | isImplicit: 1
// CHECK-DMOD-NEXT: [indexDeclaration]: kind: variable | name: depends_on_module_other | {{.*}} | loc: [[DMOD_OTHER_H]]:1:5
// CHECK-DMOD-NEXT: [indexDeclaration]: kind: variable | name: template | {{.*}} | loc: [[DMOD_NOT_CXX_H]]:1:12
@@ -43,8 +43,8 @@
// RUN: c-index-test -index-tu %t.cache/Module.pcm | FileCheck %s -check-prefix=CHECK-TMOD
// CHECK-TMOD: [startedTranslationUnit]
-// CHECK-TMOD-NEXT: [ppIncludedFile]: [[TMOD_MODULE_H:.*/Modules/Inputs/Module\.framework[/\\]Headers[/\\]Module\.h]] | {{.*}} | hash loc: <invalid>
-// CHECK-TMOD-NEXT: [ppIncludedFile]: [[TMODHDR:.*/Modules/Inputs/Module.framework[/\\]Headers.]]Sub.h | name: "Module/Sub.h" | hash loc: [[TMOD_MODULE_H]]:23:1 | isImport: 0 | isAngled: 1
+// CHECK-TMOD-NEXT: [ppIncludedFile]: [[TMOD_MODULE_H:.*[/\\]Modules[/\\]Inputs[/\\]Module\.framework[/\\]Headers[/\\]Module\.h]] | {{.*}} | hash loc: <invalid>
+// CHECK-TMOD-NEXT: [ppIncludedFile]: [[TMODHDR:.*[/\\]Modules[/\\]Inputs[/\\]Module.framework[/\\]Headers.]]Sub.h | name: "Module/Sub.h" | hash loc: [[TMOD_MODULE_H]]:23:1 | isImport: 0 | isAngled: 1
// CHECK-TMOD-NEXT: [ppIncludedFile]: [[TMODHDR]]Sub2.h | name: "Module/Sub2.h" | hash loc: [[TMODHDR]]Sub.h:1:1 | isImport: 0 | isAngled: 1
// CHECK-TMOD-NEXT: [ppIncludedFile]: [[TMODHDR]]Buried{{[/\\]}}Treasure.h | name: "Module/Buried/Treasure.h" | hash loc: [[TMOD_MODULE_H]]:24:1 | isImport: 0 | isAngled: 1
// CHECK-TMOD-NEXT: [ppIncludedFile]: [[TMOD_SUB_H:.*[/\\]Modules[/\\]Inputs[/\\]Module\.framework[/\\]Frameworks[/\\]SubFramework\.framework[/\\]Headers[/\\]SubFramework\.h]] | {{.*}} | hash loc: <invalid>
Index: test/Index/annotate-module.m
===================================================================
--- test/Index/annotate-module.m
+++ test/Index/annotate-module.m
@@ -9,7 +9,7 @@
// RUN: c-index-test -test-annotate-tokens=%s:2:1:5:1 %s -fmodules-cache-path=%t.cache -fmodules -gmodules -F %S/../Modules/Inputs \
// RUN: | FileCheck %s
-// CHECK: Punctuation: "#" [2:1 - 2:2] inclusion directive=[[INC_DIR:DependsOnModule[/\\]DependsOnModule\.h \(.*/Modules/Inputs/DependsOnModule\.framework[/\\]Headers[/\\]DependsOnModule.h\)]]
+// CHECK: Punctuation: "#" [2:1 - 2:2] inclusion directive=[[INC_DIR:DependsOnModule[/\\]DependsOnModule\.h \(.*[/\\]Modules[/\\]Inputs[/\\]DependsOnModule\.framework[/\\]Headers[/\\]DependsOnModule\.h\)]]
// CHECK-NEXT: Identifier: "include" [2:2 - 2:9] inclusion directive=[[INC_DIR]]
// CHECK-NEXT: Punctuation: "<" [2:10 - 2:11] inclusion directive=[[INC_DIR]]
// CHECK-NEXT: Identifier: "DependsOnModule" [2:11 - 2:26] inclusion directive=[[INC_DIR]]
@@ -29,7 +29,7 @@
// RUN: c-index-test -test-annotate-tokens=%S/../Modules/Inputs/Module.framework/Headers/Sub.h:1:1:3:1 %s -fmodules-cache-path=%t.cache -fmodules -F %S/../Modules/Inputs \
// RUN: | FileCheck %s -check-prefix=CHECK-MOD
-// CHECK-MOD: Punctuation: "#" [1:1 - 1:2] inclusion directive=[[INC_DIR:Module[/\\]Sub2\.h \(.*/Modules/Inputs/Module\.framework[/\\]Headers[/\\]Sub2.h\)]]
+// CHECK-MOD: Punctuation: "#" [1:1 - 1:2] inclusion directive=[[INC_DIR:Module[/\\]Sub2\.h \(.*[/\\]Modules[/\\]Inputs[/\\]Module\.framework[/\\]Headers[/\\]Sub2\.h\)]]
// CHECK-MOD-NEXT: Identifier: "include" [1:2 - 1:9] inclusion directive=[[INC_DIR]]
// CHECK-MOD-NEXT: Punctuation: "<" [1:10 - 1:11] inclusion directive=[[INC_DIR]]
// CHECK-MOD-NEXT: Identifier: "Module" [1:11 - 1:17] inclusion directive=[[INC_DIR]]
Index: test/Frontend/include-duplicate-removal.c
===================================================================
--- test/Frontend/include-duplicate-removal.c
+++ test/Frontend/include-duplicate-removal.c
@@ -3,10 +3,10 @@
#include <test.h>
// CHECK: ignoring duplicate directory
-// CHECK-SAME: Inputs/SystemHeaderPrefix"{{$}}
+// CHECK-SAME: Inputs{{[/\\]}}SystemHeaderPrefix"{{$}}
// CHECK: #include "..."
-// CHECK-NEXT: {{.*}}Inputs/SystemHeaderPrefix{{$}}
+// CHECK-NEXT: {{.*}}Inputs{{[/\\]}}SystemHeaderPrefix{{$}}
// CHECK-NEXT: #include <...>
// CHECK-NEXT: {{.*}}Inputs{{$}}
-// CHECK-NEXT: {{.*}}Inputs/SystemHeaderPrefix{{$}}
+// CHECK-NEXT: {{.*}}Inputs{{[/\\]}}SystemHeaderPrefix{{$}}
Index: test/Frontend/dependency-gen.c
===================================================================
--- test/Frontend/dependency-gen.c
+++ test/Frontend/dependency-gen.c
@@ -4,19 +4,19 @@
// RUN: echo > %t.dir/a/b/x.h
// RUN: cd %t.dir
// RUN: %clang -MD -MF - %s -fsyntax-only -I a/b | FileCheck -check-prefix=CHECK-ONE %s
-// CHECK-ONE: {{ }}a/b{{[/\\]}}x.h
+// CHECK-ONE: {{ }}a{{[/\\]}}b{{[/\\]}}x.h
// PR8974 (-include flag)
// RUN: %clang -MD -MF - %s -fsyntax-only -include a/b/x.h -DINCLUDE_FLAG_TEST | FileCheck -check-prefix=CHECK-TWO %s
-// CHECK-TWO: {{ }}a/b/x.h
+// CHECK-TWO: {{ }}a{{[/\\]}}b{{[/\\]}}x.h
// rdar://problem/9734352 (paths involving ".")
// RUN: %clang -MD -MF - %s -fsyntax-only -I ./a/b | FileCheck -check-prefix=CHECK-THREE %s
-// CHECK-THREE: {{ }}a/b{{[/\\]}}x.h
+// CHECK-THREE: {{ }}a{{[/\\]}}b{{[/\\]}}x.h
// RUN: %clang -MD -MF - %s -fsyntax-only -I .//./a/b/ | FileCheck -check-prefix=CHECK-FOUR %s
-// CHECK-FOUR: {{ }}a/b{{[/\\]}}x.h
+// 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: test/Driver/ps4-header-search.c
===================================================================
--- test/Driver/ps4-header-search.c
+++ test/Driver/ps4-header-search.c
@@ -1,10 +1,10 @@
// REQUIRES: x86-registered-target
// RUN: env SCE_ORBIS_SDK_DIR=%S/Inputs/scei-ps4_tree %clang -target x86_64-scei-ps4 -E -v %s 2>&1 | FileCheck %s --check-prefix=ENVPS4
-// ENVPS4: Inputs/scei-ps4_tree/target/include{{$}}
-// ENVPS4: Inputs/scei-ps4_tree/target/include_common{{$}}
+// ENVPS4: Inputs{{[/\\]}}scei-ps4_tree{{[/\\]}}target{{[/\\]}}include{{$}}
+// ENVPS4: Inputs{{[/\\]}}scei-ps4_tree{{[/\\]}}target{{[/\\]}}include_common{{$}}
// RUN: %clang -isysroot %S/Inputs/scei-ps4_tree -target x86_64-scei-ps4 -E -v %s 2>&1 | FileCheck %s --check-prefix=SYSROOTPS4
// SYSROOTPS4: "{{[^"]*}}clang{{[^"]*}}"
-// SYSROOTPS4: Inputs/scei-ps4_tree/target/include{{$}}
-// SYSROOTPS4: Inputs/scei-ps4_tree/target/include_common{{$}}
+// SYSROOTPS4: Inputs{{[/\\]}}scei-ps4_tree{{[/\\]}}target{{[/\\]}}include{{$}}
+// SYSROOTPS4: Inputs{{[/\\]}}scei-ps4_tree{{[/\\]}}target{{[/\\]}}include_common{{$}}
Index: test/CodeGen/debug-prefix-map.c
===================================================================
--- test/CodeGen/debug-prefix-map.c
+++ test/CodeGen/debug-prefix-map.c
@@ -18,17 +18,17 @@
// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/var/empty{{/|\\5C}}<stdin>"
// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/var/empty{{[/\\]}}{{.*}}"
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/var/empty{{[/\\]}}Inputs/stdio.h"
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/var/empty{{/|\\5C}}Inputs{{/|\\5C}}stdio.h"
// CHECK-NO-MAIN-FILE-NAME-NOT: !DIFile(filename:
// CHECK-EVIL: !DIFile(filename: "/var=empty{{[/\\]}}{{.*}}"
-// CHECK-EVIL: !DIFile(filename: "/var=empty{{[/\\]}}Inputs/stdio.h"
+// CHECK-EVIL: !DIFile(filename: "/var=empty{{/|\\5C}}Inputs{{/|\\5C}}stdio.h"
// CHECK-EVIL-NOT: !DIFile(filename:
// CHECK: !DIFile(filename: "/var/empty{{[/\\]}}{{.*}}"
-// CHECK: !DIFile(filename: "/var/empty{{[/\\]}}Inputs/stdio.h"
+// CHECK: !DIFile(filename: "/var/empty{{/|\\5C}}Inputs{{/|\\5C}}stdio.h"
// CHECK-NOT: !DIFile(filename:
// CHECK-COMPILATION-DIR: !DIFile(filename: "/var/empty{{[/\\]}}{{.*}}", directory: "/var/empty")
-// CHECK-COMPILATION-DIR: !DIFile(filename: "/var/empty{{[/\\]}}Inputs/stdio.h", directory: "/var/empty")
+// CHECK-COMPILATION-DIR: !DIFile(filename: "/var/empty{{/|\\5C}}Inputs{{/|\\5C}}stdio.h", directory: "/var/empty")
// CHECK-COMPILATION-DIR-NOT: !DIFile(filename:
Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===================================================================
--- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -1713,7 +1713,8 @@
FullSourceLoc Loc = BR.getLocation(SM).asLocation();
while (Loc.isMacroID()) {
Loc = Loc.getSpellingLoc();
- if (SM.getFilename(Loc).endswith("sys/queue.h")) {
+ StringRef FN = SM.getFilename(Loc);
+ if (FN.endswith("sys/queue.h") || FN.endswith("sys\\queue.h")) {
BR.markInvalid(getTag(), nullptr);
return nullptr;
}
Index: lib/Basic/VirtualFileSystem.cpp
===================================================================
--- lib/Basic/VirtualFileSystem.cpp
+++ lib/Basic/VirtualFileSystem.cpp
@@ -504,6 +504,8 @@
assert(!EC);
(void)EC;
+ llvm::sys::path::native(Path);
+
if (useNormalizedPaths())
llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
Index: lib/Basic/FileManager.cpp
===================================================================
--- lib/Basic/FileManager.cpp
+++ lib/Basic/FileManager.cpp
@@ -160,10 +160,15 @@
#ifdef LLVM_ON_WIN32
// Fixing a problem with "clang C:test.c" on Windows.
// Stat("C:") does not recognize "C:" as a valid directory
- std::string DirNameStr;
+ SmallString<128> DirNameStr;
if (DirName.size() > 1 && DirName.back() == ':' &&
DirName.equals_lower(llvm::sys::path::root_name(DirName))) {
DirNameStr = DirName.str() + '.';
+ llvm::sys::path::native(DirNameStr);
+ DirName = DirNameStr;
+ } else {
+ DirNameStr = DirName.str();
+ llvm::sys::path::native(DirNameStr);
DirName = DirNameStr;
}
#endif
@@ -214,6 +219,12 @@
const FileEntry *FileManager::getFile(StringRef Filename, bool openFile,
bool CacheFailure) {
+#ifdef LLVM_ON_WIN32
+ SmallString<128> NativePath(Filename.str());
+ llvm::sys::path::native(NativePath);
+ Filename = NativePath;
+#endif // LLVM_ON_WIN32
+
++NumFileLookups;
// See if there is already an entry in the map.
@@ -324,6 +335,11 @@
const FileEntry *
FileManager::getVirtualFile(StringRef Filename, off_t Size,
time_t ModificationTime) {
+#ifdef LLVM_ON_WIN32
+ SmallString<128> NativePath(Filename.str());
+ llvm::sys::path::native(NativePath);
+ Filename = NativePath;
+#endif
++NumFileLookups;
// See if there is already an entry in the map.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits