Skip to content

Commit

Permalink
Merge pull request llvm#107 from ravi-ramaseshan/fix-windows-1
Browse files Browse the repository at this point in the history
Windows compatibility fixes
  • Loading branch information
jkorous-apple authored Feb 21, 2020
2 parents 1652fa6 + 2c73cff commit e9c0435
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 44 deletions.
2 changes: 2 additions & 0 deletions clang/test/Index/Store/empty-unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ void foo(int i);
// RUN: not c-index-test core -print-record %t/idx2 2> %t2.err
// RUN: FileCheck %s -input-file %t2.err -check-prefix ERR-RECORD
// ERR-RECORD: error loading record: empty file

// REQUIRES: shell
2 changes: 2 additions & 0 deletions clang/test/Index/Store/json-with-module.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
// RUN: diff -u %s.json %t.final.json

@import ModDep;

// REQUIRES: shell
2 changes: 2 additions & 0 deletions clang/test/Index/Store/json-with-pch.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
int main() {
test1_func();
}

// REQUIRES: shell
2 changes: 2 additions & 0 deletions clang/test/Index/Store/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
// RUN: c-index-test core -aggregate-json %t.idx -o %t.json
// RUN: sed -e "s:%S::g" -e "s:%t.o::g" %t.json > %t.final.json
// RUN: diff -u %S/Inputs/json.c.json %t.final.json

// REQUIRES: shell
24 changes: 12 additions & 12 deletions clang/test/Index/Store/print-unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ void foo(int i);
// CHECK: provider: clang-
// CHECK: is-system: 0
// CHECK: has-main: 1
// CHECK: main-path: {{.*}}/print-unit.c
// CHECK: out-file: {{.*}}/print-unit.c.o
// CHECK: main-path: {{.*}}{{/|\\}}print-unit.c
// CHECK: out-file: {{.*}}{{/|\\}}print-unit.c.o
// CHECK: target: x86_64-apple-macosx10.8
// CHECK: is-debug: 1
// CHECK: DEPEND START
// CHECK: Record | user | {{.*}}/print-unit.c | print-unit.c-
// CHECK: Record | user | {{.*}}/Inputs/head.h | head.h-
// CHECK: Record | user | {{.*}}/Inputs/using-overlay.h | using-overlay.h-
// CHECK: Record | system | {{.*}}/Inputs/sys/syshead.h | syshead.h-
// CHECK: Record | system | {{.*}}/Inputs/sys/another.h | another.h-
// CHECK: File | user | {{.*}}/Inputs/print-unit.h{{$}}
// CHECK: Record | user | {{.*}}{{/|\\}}print-unit.c | print-unit.c-
// CHECK: Record | user | {{.*}}{{/|\\}}Inputs{{/|\\}}head.h | head.h-
// CHECK: Record | user | {{.*}}{{/|\\}}Inputs{{/|\\}}using-overlay.h | using-overlay.h-
// CHECK: Record | system | {{.*}}{{/|\\}}Inputs{{/|\\}}sys{{/|\\}}syshead.h | syshead.h-
// CHECK: Record | system | {{.*}}{{/|\\}}Inputs{{/|\\}}sys{{/|\\}}another.h | another.h-
// CHECK: File | user | {{.*}}{{/|\\}}Inputs{{/|\\}}print-unit.h{{$}}
// CHECK: DEPEND END (6)
// CHECK: INCLUDE START
// CHECK: {{.*}}/print-unit.c:3 | {{.*}}/Inputs/print-unit.h
// CHECK: {{.*}}/print-unit.c:4 | {{.*}}/Inputs/sys/syshead.h
// CHECK: {{.*}}/Inputs/print-unit.h:1 | {{.*}}/Inputs/head.h
// CHECK: {{.*}}/Inputs/print-unit.h:2 | {{.*}}/Inputs/using-overlay.h
// CHECK: {{.*}}{{/|\\}}print-unit.c:3 | {{.*}}{{/|\\}}Inputs{{/|\\}}print-unit.h
// CHECK: {{.*}}{{/|\\}}print-unit.c:4 | {{.*}}{{/|\\}}Inputs{{/|\\}}sys{{/|\\}}syshead.h
// CHECK: {{.*}}{{/|\\}}Inputs{{/|\\}}print-unit.h:1 | {{.*}}{{/|\\}}Inputs{{/|\\}}head.h
// CHECK: {{.*}}{{/|\\}}Inputs{{/|\\}}print-unit.h:2 | {{.*}}{{/|\\}}Inputs{{/|\\}}using-overlay.h
// CHECK: INCLUDE END (4)

// OPT: is-debug: 0
30 changes: 15 additions & 15 deletions clang/test/Index/Store/print-units-with-modules.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// CHECK: module-name: ModDep
// CHECK: has-main: 0
// CHECK: main-path: {{$}}
// CHECK: out-file: {{.*}}/ModDep.pcm
// CHECK: out-file: {{.*}}{{/|\\}}ModDep.pcm
// CHECK: DEPEND START
// CHECK: Unit | user | ModTop | {{.*}}/ModTop.pcm | ModTop.pcm
// CHECK: Record | user | ModDep | {{.*}}/Inputs/module/ModDep.h | ModDep.h
// CHECK: Unit | user | ModTop | {{.*}}{{/|\\}}ModTop.pcm | ModTop.pcm
// CHECK: Record | user | ModDep | {{.*}}{{/|\\}}Inputs{{/|\\}}module{{/|\\}}ModDep.h | ModDep.h
// CHECK: DEPEND END (2)

// CHECK: ModSystem.pcm
Expand All @@ -24,9 +24,9 @@
// CHECK: module-name: ModSystem
// CHECK: has-main: 0
// CHECK: main-path: {{$}}
// CHECK: out-file: {{.*}}/ModSystem.pcm
// CHECK: out-file: {{.*}}{{/|\\}}ModSystem.pcm
// CHECK: DEPEND START
// CHECK: Record | system | ModSystem | {{.*}}/Inputs/module/ModSystem.h | ModSystem.h
// CHECK: Record | system | ModSystem | {{.*}}{{/|\\}}Inputs{{/|\\}}module{{/|\\}}ModSystem.h | ModSystem.h
// CHECK: DEPEND END (1)

// CHECK: ModTop.pcm
Expand All @@ -35,23 +35,23 @@
// CHECK: module-name: ModTop
// CHECK: has-main: 0
// CHECK: main-path: {{$}}
// CHECK: out-file: {{.*}}/ModTop.pcm
// CHECK: out-file: {{.*}}{{/|\\}}ModTop.pcm
// CHECK: DEPEND START
// CHECK: Record | user | ModTop | {{.*}}/Inputs/module/ModTop.h | ModTop.h
// CHECK: Record | user | ModTop.Sub1 | {{.*}}/Inputs/module/ModTopSub1.h | ModTopSub1.h
// CHECK: File | user | ModTop.Sub2 | {{.*}}/Inputs/module/ModTopSub2.h{{$}}
// CHECK: Record | user | ModTop | {{.*}}{{/|\\}}Inputs{{/|\\}}module{{/|\\}}ModTop.h | ModTop.h
// CHECK: Record | user | ModTop.Sub1 | {{.*}}{{/|\\}}Inputs{{/|\\}}module{{/|\\}}ModTopSub1.h | ModTopSub1.h
// CHECK: File | user | ModTop.Sub2 | {{.*}}{{/|\\}}Inputs{{/|\\}}module{{/|\\}}ModTopSub2.h{{$}}
// CHECK: DEPEND END (3)

// CHECK: print-units-with-modules.m.tmp.o
// CHECK: is-system: 0
// CHECK: is-module: 0
// CHECK: module-name: <none>
// CHECK: has-main: 1
// CHECK: main-path: {{.*}}/print-units-with-modules.m
// CHECK: out-file: {{.*}}/print-units-with-modules.m.tmp.o
// CHECK: main-path: {{.*}}{{/|\\}}print-units-with-modules.m
// CHECK: out-file: {{.*}}{{/|\\}}print-units-with-modules.m.tmp.o
// CHECK: DEPEND START
// CHECK: Unit | user | ModDep | {{.*}}/ModDep.pcm | ModDep.pcm
// CHECK: Unit | system | ModSystem | {{.*}}/ModSystem.pcm | ModSystem.pcm
// CHECK: File | user | {{.*}}/print-units-with-modules.m{{$}}
// CHECK: File | user | {{.*}}/Inputs/module/module.modulemap{{$}}
// CHECK: Unit | user | ModDep | {{.*}}{{/|\\}}ModDep.pcm | ModDep.pcm
// CHECK: Unit | system | ModSystem | {{.*}}{{/|\\}}ModSystem.pcm | ModSystem.pcm
// CHECK: File | user | {{.*}}{{/|\\}}print-units-with-modules.m{{$}}
// CHECK: File | user | {{.*}}{{/|\\}}Inputs{{/|\\}}module{{/|\\}}module.modulemap{{$}}
// CHECK: DEPEND END (4)
12 changes: 6 additions & 6 deletions clang/test/Index/Store/print-units-with-pch.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ int main() {
// CHECK: is-system: 0
// CHECK: has-main: 0
// CHECK: main-path: {{$}}
// CHECK: out-file: {{.*}}/print-units-with-pch.c.tmp.h.pch
// CHECK: out-file: {{.*}}{{/|\\}}print-units-with-pch.c.tmp.h.pch
// CHECK: DEPEND START
// CHECK: Record | user | {{.*}}/Inputs/head.h | head.h
// CHECK: Record | user | {{.*}}{{/|\\}}Inputs{{/|\\}}head.h | head.h
// CHECK: DEPEND END (1)

// CHECK: print-units-with-pch.c.tmp.o
// CHECK: is-system: 0
// CHECK: has-main: 1
// CHECK: main-path: {{.*}}/print-units-with-pch.c
// CHECK: out-file: {{.*}}/print-units-with-pch.c.tmp.o
// CHECK: main-path: {{.*}}{{/|\\}}print-units-with-pch.c
// CHECK: out-file: {{.*}}{{/|\\}}print-units-with-pch.c.tmp.o
// CHECK: DEPEND START
// CHECK: Unit | user | {{.*}}/print-units-with-pch.c.tmp.h.pch | print-units-with-pch.c.tmp.h.pch
// CHECK: Record | user | {{.*}}/print-units-with-pch.c | print-units-with-pch.c
// CHECK: Unit | user | {{.*}}{{/|\\}}print-units-with-pch.c.tmp.h.pch | print-units-with-pch.c.tmp.h.pch
// CHECK: Record | user | {{.*}}{{/|\\}}print-units-with-pch.c | print-units-with-pch.c
// CHECK: DEPEND END (2)
12 changes: 6 additions & 6 deletions clang/test/Modules/hash-werror.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// RUN: -fmodules-hash-error-diagnostics 2>>%t/out

// RUN: FileCheck --check-prefix=CHECKWERROR %s -input-file %t/out
// CHECKWERROR: remark: building module 'foo' as '/[[PATH:.*]]/foo-
// CHECKWERROR-NOT: remark: building module 'foo' as '/[[PATH]]/foo-
// CHECKWERROR: remark: building module 'foo' as '[[PATH:.*]]{{/|\\}}foo-
// CHECKWERROR-NOT: remark: building module 'foo' as '[[PATH]]{{/|\\}}foo-

// (2) Test -Werror=
// RUN: rm -rf %t/out %t/cache
Expand All @@ -31,8 +31,8 @@
// RUN: -fmodules-hash-error-diagnostics 2>>%t/out

// RUN: FileCheck --check-prefix=CHECKWERROREQUALS %s -input-file %t/out
// CHECKWERROREQUALS: remark: building module 'foo' as '/[[PATH:.*]]/foo-
// CHECKWERROREQUALS-NOT: remark: building module 'foo' as '/[[PATH]]/foo-
// CHECKWERROREQUALS: remark: building module 'foo' as '[[PATH:.*]]{{/|\\}}foo-
// CHECKWERROREQUALS-NOT: remark: building module 'foo' as '[[PATH]]{{/|\\}}foo-

// (3) Test -pedantic-errors
// RUN: rm -rf %t/out %t/cache
Expand All @@ -48,7 +48,7 @@
// RUN: -fmodules-hash-error-diagnostics 2>>%t/out

// RUN: FileCheck --check-prefix=CHECKPEDANTICERROR %s -input-file %t/out
// CHECKPEDANTICERROR: remark: building module 'foo' as '/[[PATH:.*]]/foo-
// CHECKPEDANTICERROR-NOT: remark: building module 'foo' as '/[[PATH]]/foo-
// CHECKPEDANTICERROR: remark: building module 'foo' as '[[PATH:.*]]{{/|\\}}foo-
// CHECKPEDANTICERROR-NOT: remark: building module 'foo' as '[[PATH]]{{/|\\}}foo-

#include "foo.h"
2 changes: 2 additions & 0 deletions clang/test/Refactor/Extract/extract-method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,5 @@ void TemplateExtraction<T1, T2, x>::method() {
}

// RUN: clang-refactor-test perform -action extract-method -selected=template-method %s | FileCheck --check-prefix=CHECK4 %s

// UNSUPPORTED: system-windows
Original file line number Diff line number Diff line change
Expand Up @@ -564,3 +564,5 @@ void parenImpCastsLHSEquivalence(int x) {
}

// RUN: clang-refactor-test initiate -action if-switch-conversion -location-agnostic -at=%s:561:3 %s | FileCheck --check-prefix=CHECK-YES %s

// UNSUPPORTED: system-windows
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,5 @@ struct ProhibitTemplateFunctions {
};
// CHECK-FUNCTION-TEMPLATE: "{{.*}}implement-declared-methods.cpp" "\n\nvoid ProhibitTemplateFunctions::function() { \n <#code#>;\n}\n\nvoid ProhibitTemplateFunctions::anotherFunction() { \n <#code#>;\n}\n" [[@LINE-1]]:3
// RUN: clang-refactor-test perform -action implement-declared-methods -selected=template-function -continuation-file=%s -query-results=query-all-impl %s | FileCheck --check-prefix=CHECK-FUNCTION-TEMPLATE %s

// UNSUPPORTED: system-windows
2 changes: 2 additions & 0 deletions clang/test/Refactor/Rename/DependentExpressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ void renameSimpleDependentDeclarations(const TemplateClass<T, S> &object) {
typename TemplateClass<T, S>::TypeAlias Val2; // CHECK11: [[@LINE]]:33 -> [[@LINE]]:42
// RUN: clang-refactor-test rename-initiate -at=%s:38:9 -at=%s:70:33 -new-name=x %s | FileCheck --check-prefix=CHECK11 %s
}

// UNSUPPORTED: system-windows
6 changes: 5 additions & 1 deletion clang/tools/IndexStore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ add_clang_library(IndexStore SHARED
Support
)

if(APPLE)
if(WIN32)
set_target_properties(IndexStore
PROPERTIES
DEFINE_SYMBOL IndexStore_EXPORTS)
elseif(APPLE)
set(INDEXSTORE_LIBRARY_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")

set(INDEXSTORE_LINK_FLAGS " -Wl,-compatibility_version -Wl,1")
Expand Down
7 changes: 3 additions & 4 deletions clang/tools/c-index-test/core_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,10 +872,9 @@ bool deconstructPathAndRange(StringRef input,
std::string &filepath,
Optional<unsigned> &lineStart,
unsigned &lineCount) {
StringRef path, range;
std::tie(path, range) = input.split(':');
StringRef start, end;
std::tie(start, end) = range.split(':');
StringRef path, start, end;
std::tie(path, end) = input.rsplit(':');
std::tie(path, start) = path.rsplit(':');
filepath = std::string(path);
lineCount = 0;
if (start.empty())
Expand Down

0 comments on commit e9c0435

Please sign in to comment.