diff options
| author | Ben Langmuir <blangmuir@apple.com> | 2014-09-10 21:29:41 +0000 |
|---|---|---|
| committer | Ben Langmuir <blangmuir@apple.com> | 2014-09-10 21:29:41 +0000 |
| commit | 5418f40127d5e0b1f3d26f292b786e7eabd93c6c (patch) | |
| tree | 6730814fa1ba3ad63e6bccfe6c7c7e3cda403bbf /clang/test | |
| parent | 1109ed42450bedcc0000994414f741988034540a (diff) | |
| download | bcm5719-llvm-5418f40127d5e0b1f3d26f292b786e7eabd93c6c.tar.gz bcm5719-llvm-5418f40127d5e0b1f3d26f292b786e7eabd93c6c.zip | |
Avoid a couple of assertions when preprocessing with modules
1. We were hitting the NextIsPrevious assertion because we were trying
to merge decl chains that were independent of each other because we had
no Sema object to allow them to find existing decls. This is fixed by
delaying loading the "preloaded" decls until Sema is available.
2. We were trying to get identifier info from an annotation token, which
asserts. The fix is to special-case the module annotations in the
preprocessed output printer.
Fixed in a single commit because when you hit 1 you almost invariably
hit 2 as well.
llvm-svn: 217550
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Modules/Inputs/diamond_left.h | 2 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/diamond_top.h | 1 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/preprocess-prefix.h | 2 | ||||
| -rw-r--r-- | clang/test/Modules/preprocess.m | 21 |
4 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/diamond_left.h b/clang/test/Modules/Inputs/diamond_left.h index fce2e48882f..6494551e4bf 100644 --- a/clang/test/Modules/Inputs/diamond_left.h +++ b/clang/test/Modules/Inputs/diamond_left.h @@ -1,3 +1,5 @@ +int top_left_before(void *); + @import diamond_top; float left(float *); diff --git a/clang/test/Modules/Inputs/diamond_top.h b/clang/test/Modules/Inputs/diamond_top.h index 34998cd4324..30da14f6449 100644 --- a/clang/test/Modules/Inputs/diamond_top.h +++ b/clang/test/Modules/Inputs/diamond_top.h @@ -2,3 +2,4 @@ int top(int *); int top_left(char *c); +int top_left_before(void *); diff --git a/clang/test/Modules/Inputs/preprocess-prefix.h b/clang/test/Modules/Inputs/preprocess-prefix.h new file mode 100644 index 00000000000..04d01758320 --- /dev/null +++ b/clang/test/Modules/Inputs/preprocess-prefix.h @@ -0,0 +1,2 @@ +int left_and_right(int *); +#import "diamond_left.h" diff --git a/clang/test/Modules/preprocess.m b/clang/test/Modules/preprocess.m new file mode 100644 index 00000000000..a1c024d6ffb --- /dev/null +++ b/clang/test/Modules/preprocess.m @@ -0,0 +1,21 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -include %S/Inputs/preprocess-prefix.h -E %s | FileCheck -strict-whitespace %s +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -x objective-c-header -emit-pch %S/Inputs/preprocess-prefix.h -o %t.pch +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -include-pch %t.pch -E %s | FileCheck -strict-whitespace %s +#import "diamond_right.h" +#import "diamond_right.h" // to check that imports get their own line +void test() { + top_left_before(); + left_and_right(); +} + + +// CHECK: int left_and_right(int *);{{$}} +// CHECK-NEXT: @import diamond_left; /* clang -E: implicit import for "{{.*}}diamond_left.h" */{{$}} + +// CHECK: @import diamond_right; /* clang -E: implicit import for "/Users/blangmuir/src/clang/test/Modules/Inputs/diamond_right.h" */{{$}} +// CHECK: @import diamond_right; /* clang -E: implicit import for "/Users/blangmuir/src/clang/test/Modules/Inputs/diamond_right.h" */{{$}} +// CHECK-NEXT: void test() {{{$}} +// CHECK-NEXT: top_left_before();{{$}} +// CHECK-NEXT: left_and_right();{{$}} +// CHECK-NEXT: }{{$}} |

