summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-05-27 15:17:06 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-05-27 15:17:06 +0000
commit53992adde3eda3ccf9da63bc7e45673f043de18f (patch)
tree3558f327a6f9ab59c5d7a06528d84e1560445247 /test
parent7e411337c0ed226dace6e07f1420486768161308 (diff)
downloadFreeBSD-src-53992adde3eda3ccf9da63bc7e45673f043de18f.zip
FreeBSD-src-53992adde3eda3ccf9da63bc7e45673f043de18f.tar.gz
Update clang to r104832.
Diffstat (limited to 'test')
-rw-r--r--test/Analysis/dead-stores.c12
-rw-r--r--test/Analysis/inline.c4
-rw-r--r--test/Analysis/inline2.c3
-rw-r--r--test/Analysis/inline3.c3
-rw-r--r--test/Analysis/inline4.c4
-rw-r--r--test/Analysis/malloc.c24
-rw-r--r--test/Analysis/method-call.cpp2
-rw-r--r--test/Analysis/misc-ps-region-store.m19
-rw-r--r--test/Analysis/misc-ps.m14
-rw-r--r--test/Analysis/retain-release.m12
-rw-r--r--test/CXX/class.access/class.friend/p1.cpp2
-rw-r--r--test/CXX/class.access/p4.cpp20
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp15
-rw-r--r--test/CXX/expr/expr.post/expr.ref/p3.cpp15
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p4.cpp10
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp3
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp6
-rw-r--r--test/CXX/temp/temp.names/p2.cpp13
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p2.cpp4
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p5.cpp2
-rw-r--r--test/CodeCompletion/call.c2
-rw-r--r--test/CodeCompletion/call.cpp2
-rw-r--r--test/CodeCompletion/ordinary-name.cpp8
-rw-r--r--test/CodeCompletion/truncation.c7
-rw-r--r--test/CodeGen/blocks.c2
-rw-r--r--test/CodeGen/builtins.c32
-rw-r--r--test/CodeGen/complex.c4
-rw-r--r--test/CodeGen/microsoft-call-conv.c50
-rw-r--r--test/CodeGen/stdcall-fastcall.c37
-rw-r--r--test/CodeGenCXX/PR5863-unreachable-block.cpp13
-rw-r--r--test/CodeGenCXX/PR6747.cpp11
-rw-r--r--test/CodeGenCXX/anonymous-namespaces.cpp10
-rw-r--r--test/CodeGenCXX/anonymous-union-member-initializer.cpp44
-rw-r--r--test/CodeGenCXX/array-value-initialize.cpp30
-rw-r--r--test/CodeGenCXX/c99-variable-length-array.cpp27
-rw-r--r--test/CodeGenCXX/class-layout.cpp4
-rw-r--r--test/CodeGenCXX/condition.cpp166
-rw-r--r--test/CodeGenCXX/cxx-apple-kext.cpp2
-rw-r--r--test/CodeGenCXX/destructors.cpp65
-rw-r--r--test/CodeGenCXX/dynamic-cast.cpp15
-rw-r--r--test/CodeGenCXX/dyncast.cpp2
-rw-r--r--test/CodeGenCXX/implicit-copy-constructor.cpp72
-rw-r--r--test/CodeGenCXX/key-function-vtable.cpp11
-rw-r--r--test/CodeGenCXX/mangle-subst-std.cpp44
-rw-r--r--test/CodeGenCXX/nrvo.cpp84
-rw-r--r--test/CodeGenCXX/pointers-to-data-members.cpp68
-rw-r--r--test/CodeGenCXX/references.cpp72
-rw-r--r--test/CodeGenCXX/rtti-linkage.cpp69
-rw-r--r--test/CodeGenCXX/static-init-3.cpp28
-rw-r--r--test/CodeGenCXX/static-init.cpp19
-rw-r--r--test/CodeGenCXX/static-local-in-local-class.cpp12
-rw-r--r--test/CodeGenCXX/template-linkage.cpp20
-rw-r--r--test/CodeGenCXX/threadsafe-statics-exceptions.cpp26
-rw-r--r--test/CodeGenCXX/thunks.cpp112
-rw-r--r--test/CodeGenCXX/virtual-base-destructor-call.cpp1
-rw-r--r--test/CodeGenCXX/virtual-functions-incomplete-types.cpp2
-rw-r--r--test/CodeGenCXX/vtable-layout.cpp1672
-rw-r--r--test/CodeGenCXX/vtable-linkage.cpp94
-rw-r--r--test/CodeGenCXX/x86_32-arguments.cpp96
-rw-r--r--test/CodeGenCXX/x86_64-arguments.cpp8
-rw-r--r--test/CodeGenObjC/atomic-aggregate-property.m1
-rw-r--r--test/CodeGenObjC/blocks-1.m10
-rw-r--r--test/CodeGenObjC/blocks-2.m2
-rw-r--r--test/CodeGenObjC/blocks-ivar-debug.m20
-rw-r--r--test/CodeGenObjC/blocks.m8
-rw-r--r--test/CodeGenObjC/default-property-synthesis.m38
-rw-r--r--test/CodeGenObjC/ivar-layout-64-bitfields.m1
-rw-r--r--test/CodeGenObjC/ivar-layout-64.m6
-rw-r--r--test/CodeGenObjC/ivar-layout-no-optimize.m2
-rw-r--r--test/CodeGenObjC/objc-gc-aggr-assign.m62
-rw-r--r--test/CodeGenObjC/objc2-new-gc-api-strongcast.m4
-rw-r--r--test/CodeGenObjC/objc2-no-write-barrier.m2
-rw-r--r--test/CodeGenObjC/objc2-retain-codegen.m1
-rw-r--r--test/CodeGenObjC/objc2-strong-cast-1.m1
-rw-r--r--test/CodeGenObjC/objc2-strong-cast.m1
-rw-r--r--test/CodeGenObjC/objc2-weak-assign.m2
-rw-r--r--test/CodeGenObjC/objc2-weak-compare.m2
-rw-r--r--test/CodeGenObjC/objc2-weak-ivar-debug.m2
-rw-r--r--test/CodeGenObjC/objc2-weak-ivar.m1
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-2.m4
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-3.m3
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-4.m3
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-5.m3
-rw-r--r--test/CodeGenObjC/objc2-write-barrier.m7
-rw-r--r--test/CodeGenObjC/property-complex.m4
-rw-r--r--test/CodeGenObjC/protocols.m9
-rw-r--r--test/CodeGenObjCXX/encode.mm52
-rw-r--r--test/CodeGenObjCXX/mangle-blocks.mm50
-rw-r--r--test/CodeGenObjCXX/property-objects.mm51
-rw-r--r--test/Coverage/ast-printing.cpp2
-rw-r--r--test/Driver/bindings.c2
-rw-r--r--test/Driver/clang_f_opts.c6
-rw-r--r--test/FixIt/typo.m50
-rw-r--r--test/Index/annotate-tokens-include.c6
-rw-r--r--test/Index/annotate-tokens-include.h1
-rw-r--r--test/Index/annotate-tokens.c78
-rw-r--r--test/Index/annotate-tokens.m272
-rw-r--r--test/Index/c-index-api-loadTU-test.m38
-rw-r--r--test/Index/complete-at-directives.m14
-rw-r--r--test/Index/complete-at-exprstmt.m6
-rw-r--r--test/Index/complete-exprs.c15
-rw-r--r--test/Index/complete-member-access.m4
-rw-r--r--test/Index/complete-recovery.m21
-rw-r--r--test/Index/load-stmts.cpp30
-rw-r--r--test/Index/print-typekind.c20
-rw-r--r--test/Index/properties-class-extensions.m28
-rw-r--r--test/Index/remap-load.c4
-rw-r--r--test/Index/usrs.cpp107
-rw-r--r--test/Index/usrs.m28
-rw-r--r--test/Lexer/gnu_keywords.c8
-rw-r--r--test/Lexer/hexfloat.cpp4
-rw-r--r--test/Makefile2
-rw-r--r--test/Misc/diag-aka-types.cpp10
-rw-r--r--test/PCH/Inputs/namespaces.h27
-rw-r--r--test/PCH/cxx_exprs.cpp4
-rw-r--r--test/PCH/cxx_exprs.h58
-rw-r--r--test/PCH/namespaces.cpp29
-rw-r--r--test/Parser/cxx-undeclared-identifier.cpp6
-rw-r--r--test/Parser/namespaces.cpp8
-rw-r--r--test/Parser/pragma-options.c12
-rw-r--r--test/Parser/recovery.c5
-rw-r--r--test/Parser/switch-recovery.cpp12
-rw-r--r--test/Rewriter/rewrite-block-argument.m33
-rw-r--r--test/Rewriter/rewrite-local-static-id.mm24
-rw-r--r--test/Rewriter/rewrite-no-nextline.mm10
-rw-r--r--test/Sema/attr-sentinel.c8
-rw-r--r--test/Sema/c89.c2
-rw-r--r--test/Sema/compare.c20
-rw-r--r--test/Sema/conditional-expr.c9
-rw-r--r--test/Sema/conversion.c10
-rw-r--r--test/Sema/format-strings.c3
-rw-r--r--test/Sema/init.c14
-rw-r--r--test/Sema/pragma-align-mac68k-unsupported.c4
-rw-r--r--test/Sema/pragma-align-mac68k.c98
-rw-r--r--test/Sema/pragma-pack-and-options-align.c34
-rw-r--r--test/Sema/scope-check.c20
-rw-r--r--test/Sema/switch.c30
-rw-r--r--test/Sema/unused-expr.c8
-rw-r--r--test/SemaCXX/alignof-sizeof-reference.cpp6
-rw-r--r--test/SemaCXX/anonymous-union.cpp34
-rw-r--r--test/SemaCXX/attr-deprecated.cpp126
-rw-r--r--test/SemaCXX/blocks.cpp32
-rw-r--r--test/SemaCXX/c99-variable-length-array.cpp116
-rw-r--r--test/SemaCXX/c99.cpp5
-rw-r--r--test/SemaCXX/class.cpp23
-rw-r--r--test/SemaCXX/compare.cpp20
-rw-r--r--test/SemaCXX/conditional-expr.cpp37
-rw-r--r--test/SemaCXX/constant-expression.cpp4
-rw-r--r--test/SemaCXX/default-assignment-operator.cpp17
-rw-r--r--test/SemaCXX/empty-class-layout.cpp18
-rw-r--r--test/SemaCXX/enum.cpp10
-rw-r--r--test/SemaCXX/flexible-array-test.cpp45
-rw-r--r--test/SemaCXX/i-c-e-cxx.cpp2
-rw-r--r--test/SemaCXX/implicit-virtual-member-functions.cpp4
-rw-r--r--test/SemaCXX/invalid-instantiated-field-decl.cpp35
-rw-r--r--test/SemaCXX/member-pointer.cpp17
-rw-r--r--test/SemaCXX/namespace-alias.cpp20
-rw-r--r--test/SemaCXX/nested-name-spec.cpp16
-rw-r--r--test/SemaCXX/new-delete.cpp15
-rw-r--r--test/SemaCXX/offsetof.cpp2
-rw-r--r--test/SemaCXX/overload-call.cpp30
-rw-r--r--test/SemaCXX/references.cpp15
-rw-r--r--test/SemaCXX/return-noreturn.cpp17
-rw-r--r--test/SemaCXX/scope-check.cpp123
-rw-r--r--test/SemaCXX/switch.cpp19
-rw-r--r--test/SemaCXX/vararg-non-pod.cpp10
-rw-r--r--test/SemaCXX/vector.cpp188
-rw-r--r--test/SemaCXX/virtual-member-functions-key-function.cpp10
-rw-r--r--test/SemaCXX/warn-missing-noreturn.cpp14
-rw-r--r--test/SemaCXX/warn-reorder-ctor-initialization.cpp10
-rw-r--r--test/SemaCXX/warn-weak-vtables.cpp10
-rw-r--r--test/SemaObjC/block-attr.m1
-rw-r--r--test/SemaObjC/error-property-gc-attr.m5
-rw-r--r--test/SemaObjC/method-conflict.m11
-rw-r--r--test/SemaObjC/objc2-warn-weak-decl.m1
-rw-r--r--test/SemaObjC/warn-assign-property-nscopying.m1
-rw-r--r--test/SemaObjC/warn-weak-field.m1
-rw-r--r--test/SemaObjCXX/const-cast.mm13
-rw-r--r--test/SemaObjCXX/conversion-to-objc-pointer-2.mm87
-rw-r--r--test/SemaObjCXX/conversion-to-objc-pointer.mm50
-rw-r--r--test/SemaObjCXX/deduction.mm58
-rw-r--r--test/SemaObjCXX/ivar-construct.mm29
-rw-r--r--test/SemaObjCXX/ivar-struct.mm7
-rw-r--r--test/SemaObjCXX/objc2-merge-gc-attribue-decl.mm51
-rw-r--r--test/SemaObjCXX/static-cast.mm29
-rw-r--r--test/SemaObjCXX/vla.mm2
-rw-r--r--test/SemaObjCXX/void_to_obj.mm15
-rw-r--r--test/SemaTemplate/attributes.cpp8
-rw-r--r--test/SemaTemplate/current-instantiation.cpp13
-rw-r--r--test/SemaTemplate/dependent-base-classes.cpp2
-rw-r--r--test/SemaTemplate/dependent-expr.cpp16
-rw-r--r--test/SemaTemplate/dependent-template-recover.cpp18
-rw-r--r--test/SemaTemplate/dependent-type-identity.cpp16
-rw-r--r--test/SemaTemplate/enum-argument.cpp13
-rw-r--r--test/SemaTemplate/instantiate-anonymous-union.cpp18
-rw-r--r--test/SemaTemplate/instantiate-attr.cpp6
-rw-r--r--test/SemaTemplate/instantiate-complete.cpp29
-rw-r--r--test/SemaTemplate/instantiate-declref-ice.cpp3
-rw-r--r--test/SemaTemplate/instantiate-expr-2.cpp31
-rw-r--r--test/SemaTemplate/instantiate-expr-3.cpp2
-rw-r--r--test/SemaTemplate/instantiate-field.cpp55
-rw-r--r--test/SemaTemplate/instantiate-function-2.cpp10
-rw-r--r--test/SemaTemplate/instantiate-member-pointers.cpp12
-rw-r--r--test/SemaTemplate/instantiate-non-dependent-types.cpp14
-rw-r--r--test/SemaTemplate/instantiate-overload-candidates.cpp21
-rw-r--r--test/SemaTemplate/nested-name-spec-template.cpp7
-rw-r--r--test/SemaTemplate/overload-candidates.cpp40
-rw-r--r--test/SemaTemplate/partial-spec-instantiate.cpp20
-rw-r--r--test/SemaTemplate/temp_explicit.cpp26
-rw-r--r--test/SemaTemplate/template-id-expr.cpp38
-rw-r--r--test/SemaTemplate/unused-variables.cpp21
-rw-r--r--test/SemaTemplate/virtual-member-functions.cpp39
213 files changed, 5485 insertions, 1232 deletions
diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c
index 209ca65..1c60027 100644
--- a/test/Analysis/dead-stores.c
+++ b/test/Analysis/dead-stores.c
@@ -450,3 +450,15 @@ int f26_nestedblocks() {
return y;
}
+// The FOREACH macro in QT uses 'break' statements within statement expressions
+// placed within the increment code of for loops.
+void rdar8014335() {
+ for (int i = 0 ; i != 10 ; ({ break; })) {
+ for ( ; ; ({ ++i; break; })) ;
+ // Note that the next value stored to 'i' is never executed
+ // because the next statement to be executed is the 'break'
+ // in the increment code of the first loop.
+ i = i * 3; // expected-warning{{Value stored to 'i' is never read}}
+ }
+}
+
diff --git a/test/Analysis/inline.c b/test/Analysis/inline.c
index acaf74d..50c1a54 100644
--- a/test/Analysis/inline.c
+++ b/test/Analysis/inline.c
@@ -1,5 +1,5 @@
-// RUN: false
-// XFAIL: *
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
+
int f1() {
int y = 1;
y++;
diff --git a/test/Analysis/inline2.c b/test/Analysis/inline2.c
index ec965a6..efdb75c 100644
--- a/test/Analysis/inline2.c
+++ b/test/Analysis/inline2.c
@@ -1,5 +1,4 @@
-// RUN: false
-// XFAIL: *
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
// Test parameter 'a' is registered to LiveVariables analysis data although it
// is not referenced in the function body.
diff --git a/test/Analysis/inline3.c b/test/Analysis/inline3.c
index 8f45858..884b3ed 100644
--- a/test/Analysis/inline3.c
+++ b/test/Analysis/inline3.c
@@ -1,5 +1,4 @@
-// RUN: false
-// XFAIL: *
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
// Test when entering f1(), we set the right AnalysisContext to Environment.
// Otherwise, block-level expr '1 && a' would not be block-level.
diff --git a/test/Analysis/inline4.c b/test/Analysis/inline4.c
index b2b3c34..5a1d193 100644
--- a/test/Analysis/inline4.c
+++ b/test/Analysis/inline4.c
@@ -1,5 +1,5 @@
-// RUN: false
-// XFAIL: *
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
+
int g(int a) {
return a;
}
diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c
index 21b6d46..fe24bc1 100644
--- a/test/Analysis/malloc.c
+++ b/test/Analysis/malloc.c
@@ -6,16 +6,16 @@ void *realloc(void *ptr, size_t size);
void *calloc(size_t nmemb, size_t size);
void f1() {
- int *p = malloc(10);
+ int *p = malloc(12);
return; // expected-warning{{Allocated memory never released. Potential memory leak.}}
}
void f1_b() {
- int *p = malloc(10); // expected-warning{{Allocated memory never released. Potential memory leak.}}
+ int *p = malloc(12); // expected-warning{{Allocated memory never released. Potential memory leak.}}
}
void f2() {
- int *p = malloc(10);
+ int *p = malloc(12);
free(p);
free(p); // expected-warning{{Try to free a memory block that has been released}}
}
@@ -25,7 +25,7 @@ void f2() {
// or inter-procedural analysis, this is a conservative answer.
int *f3() {
static int *p = 0;
- p = malloc(10);
+ p = malloc(12);
return p; // no-warning
}
@@ -34,18 +34,18 @@ int *f3() {
// functions or inter-procedural analysis, this is a conservative answer.
static int *p_f4 = 0;
int *f4() {
- p_f4 = malloc(10);
+ p_f4 = malloc(12);
return p_f4; // no-warning
}
int *f5() {
- int *q = malloc(10);
+ int *q = malloc(12);
q = realloc(q, 20);
return q; // no-warning
}
void f6() {
- int *p = malloc(10);
+ int *p = malloc(12);
if (!p)
return; // no-warning
else
@@ -67,3 +67,13 @@ void f7() {
free(x);
x[0] = 'a'; // expected-warning{{Use dynamically allocated memory after it is freed.}}
}
+
+void PR6123() {
+ int *x = malloc(11); // expected-warning{{Cast a region whose size is not a multiple of the destination type size.}}
+}
+
+void PR7217() {
+ int *buf = malloc(2); // expected-warning{{Cast a region whose size is not a multiple of the destination type size.}}
+ buf[1] = 'c'; // not crash
+
+}
diff --git a/test/Analysis/method-call.cpp b/test/Analysis/method-call.cpp
index dd89159..47f1444 100644
--- a/test/Analysis/method-call.cpp
+++ b/test/Analysis/method-call.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
struct A {
int x;
A(int a) { x = a; }
diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m
index 4255141..52516ab 100644
--- a/test/Analysis/misc-ps-region-store.m
+++ b/test/Analysis/misc-ps-region-store.m
@@ -1014,3 +1014,22 @@ void pr6854(void * arg) {
float f = *(float*) a;
}
+// <rdar://problem/8032791> False positive due to symbolic store not find
+// value because of 'const' qualifier
+double rdar_8032791_2();
+double rdar_8032791_1() {
+ struct R8032791 { double x[2]; double y; }
+ data[3] = {
+ {{1.0, 3.0}, 3.0}, // 1 2 3
+ {{1.0, 1.0}, 0.0}, // 1 1 2 2 3 3
+ {{1.0, 3.0}, 1.0} // 1 2 3
+ };
+
+ double x = 0.0;
+ for (unsigned i = 0 ; i < 3; i++) {
+ const struct R8032791 *p = &data[i];
+ x += p->y + rdar_8032791_2(); // no-warning
+ }
+ return x;
+}
+
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index 2b21eec..8323c62 100644
--- a/test/Analysis/misc-ps.m
+++ b/test/Analysis/misc-ps.m
@@ -8,6 +8,10 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code %s
+#ifndef __clang_analyzer__
+#error __clang__analyzer__ not defined
+#endif
+
typedef struct objc_ivar *Ivar;
typedef struct objc_selector *SEL;
typedef signed char BOOL;
@@ -957,3 +961,13 @@ void pr6938_b() {
}) == 0) {
}
}
+
+//===----------------------------------------------------------------------===//
+// <rdar://problem/7979430> - The CFG for code containing an empty
+// @synchronized block was previously broken (and would crash the analyzer).
+//===----------------------------------------------------------------------===//
+
+void r7979430(id x) {
+ @synchronized(x) {}
+}
+
diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m
index 3f79c0c..9e5151d 100644
--- a/test/Analysis/retain-release.m
+++ b/test/Analysis/retain-release.m
@@ -1332,3 +1332,15 @@ void test_blocks_1_indirect_retain_via_call(void) {
^(NSObject *o){ [o retain]; }(number);
}
+//===--------------------------------------------------------------------===//
+// Test sending message to super that returns an object alias. Previously
+// this caused a crash in the analyzer.
+//===--------------------------------------------------------------------===//
+
+@interface Rdar8015556 : NSObject {} @end
+@implementation Rdar8015556
+- (id)retain {
+ return [super retain];
+}
+@end
+
diff --git a/test/CXX/class.access/class.friend/p1.cpp b/test/CXX/class.access/class.friend/p1.cpp
index 991698d..563ae4f 100644
--- a/test/CXX/class.access/class.friend/p1.cpp
+++ b/test/CXX/class.access/class.friend/p1.cpp
@@ -189,7 +189,7 @@ namespace test4 {
struct Inequal {};
bool test() {
Holder<Inequal> a, b;
- return a == b; // expected-note {{requested here}}
+ return a == b; // expected-note {{requested here}}
}
}
diff --git a/test/CXX/class.access/p4.cpp b/test/CXX/class.access/p4.cpp
index 1cd8966..e8afbe7 100644
--- a/test/CXX/class.access/p4.cpp
+++ b/test/CXX/class.access/p4.cpp
@@ -97,7 +97,7 @@ namespace test2 {
A A::foo; // okay
class B : A { }; // expected-error {{base class 'test2::A' has private constructor}}
- B b;
+ B b; // expected-note{{implicit default constructor}}
class C : virtual A {
public:
@@ -105,7 +105,7 @@ namespace test2 {
};
class D : C { }; // expected-error {{inherited virtual base class 'test2::A' has private constructor}}
- D d;
+ D d; // expected-note{{implicit default constructor}}
}
// Implicit destructor calls.
@@ -143,13 +143,15 @@ namespace test3 {
};
class Derived3 : // expected-error 2 {{inherited virtual base class 'Base<2>' has private destructor}} \
- // expected-error 2 {{inherited virtual base class 'Base<3>' has private destructor}}
+ // expected-error 2 {{inherited virtual base class 'Base<3>' has private destructor}} \
+ // expected-note 2{{implicit default constructor}}
Base<0>, // expected-error 2 {{base class 'Base<0>' has private destructor}}
virtual Base<1>, // expected-error 2 {{base class 'Base<1>' has private destructor}}
Base2, // expected-error 2 {{base class 'test3::Base2' has private destructor}}
virtual Base3
- {};
- Derived3 d3;
+ {};
+ Derived3 d3; // expected-note {{implicit default constructor}}\
+ // expected-note{{implicit default destructor}}}
}
// Conversion functions.
@@ -205,13 +207,13 @@ namespace test5 {
class Test1 { A a; }; // expected-error {{private member}}
void test1() {
Test1 a;
- a = Test1();
+ a = Test1(); // expected-note{{implicit default copy}}
}
class Test2 : A {}; // expected-error {{private member}}
void test2() {
Test2 a;
- a = Test2();
+ a = Test2(); // expected-note{{implicit default copy}}
}
}
@@ -224,12 +226,12 @@ namespace test6 {
class Test1 { A a; }; // expected-error {{field of type 'test6::A' has private copy constructor}}
void test1(const Test1 &t) {
- Test1 a = t;
+ Test1 a = t; // expected-note{{implicit default copy}}
}
class Test2 : A {}; // expected-error {{base class 'test6::A' has private copy constructor}}
void test2(const Test2 &t) {
- Test2 a = t;
+ Test2 a = t; // expected-note{{implicit default copy}}
}
}
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
index fd2df01..4660971 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
@@ -81,3 +81,18 @@ namespace test2 {
template struct Derived<int>; // expected-note {{in instantiation of template class}}
}
+
+// Redeclarations are okay in a function.
+namespace test3 {
+ namespace N {
+ int f(int);
+ typedef int type;
+ }
+
+ void g() {
+ using N::f;
+ using N::f;
+ using N::type;
+ using N::type;
+ }
+}
diff --git a/test/CXX/expr/expr.post/expr.ref/p3.cpp b/test/CXX/expr/expr.post/expr.ref/p3.cpp
new file mode 100644
index 0000000..98771d3
--- /dev/null
+++ b/test/CXX/expr/expr.post/expr.ref/p3.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+
+template<typename T> struct Node {
+ int lhs;
+ void splay( )
+ {
+ Node<T> n[1];
+ (void)n->lhs;
+ }
+};
+
+void f() {
+ Node<int> n;
+ return n.splay();
+}
diff --git a/test/CXX/temp/temp.decls/temp.friend/p4.cpp b/test/CXX/temp/temp.decls/temp.friend/p4.cpp
new file mode 100644
index 0000000..226ac0f
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.friend/p4.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename T>
+struct X1 {
+ friend void f6(int) { } // expected-error{{redefinition of}} \
+ // expected-note{{previous definition}}
+};
+
+X1<int> x1a;
+X1<float> x1b; // expected-note {{in instantiation of}}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
index 1b7310f..90d2949 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
@@ -16,7 +16,8 @@ void test_f1(int *ip, float fv) {
}
// TODO: this diagnostic can and should improve
-template<typename T> void f2(T*, T*); // expected-note 2 {{candidate template ignored: failed template argument deduction}}
+template<typename T> void f2(T*, T*); // expected-note {{candidate template ignored: failed template argument deduction}} \
+// expected-note{{candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'float')}}
struct ConvToIntPtr {
operator int*() const;
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
index 6edf079..1b240cc 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace test0 {
- template<class T> void apply(T x, void (*f)(T)) { f(x); } // expected-note 2 {{failed template argument deduction}}\
+ template<class T> void apply(T x, void (*f)(T)) { f(x); } // expected-note 2 {{candidate template ignored: deduced conflicting types for parameter 'T'}}\
// expected-note {{no overload of 'temp2' matching 'void (*)(int)'}}
template<class A> void temp(A);
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp
index 2a7f16d..bf5f962 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
template<int i> class A { };
-template<short s> void f(A<s>); // expected-note{{failed template argument deduction}}
+template<short s> void f(A<s>); // expected-note{{candidate template ignored: substitution failure}}
void k1() {
A<1> a;
@@ -15,14 +15,14 @@ void k2() {
g(b); // OK: cv-qualifiers are ignored on template parameter types
}
-template<short s> void h(int (&)[s]); // expected-note{{failed template argument deduction}}
+template<short s> void h(int (&)[s]); // expected-note{{candidate function template not viable: requires 1 argument, but 2 were provided}}
void k3() {
int array[5];
h(array);
h<5>(array);
}
-template<short s> void h(int (&)[s], A<s>); // expected-note{{failed template argument deduction}}
+template<short s> void h(int (&)[s], A<s>); // expected-note{{candidate template ignored: substitution failure}}
void k4() {
A<5> a;
int array[5];
diff --git a/test/CXX/temp/temp.names/p2.cpp b/test/CXX/temp/temp.names/p2.cpp
new file mode 100644
index 0000000..93e45dd
--- /dev/null
+++ b/test/CXX/temp/temp.names/p2.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Ensure that when enforcing access control an unqualified template name with
+// explicit template arguments, we don't lose the context of the name lookup
+// because of the required early lookup to determine if it names a template.
+namespace PR7163 {
+ template <typename R, typename P> void h(R (*func)(P)) {}
+ class C {
+ template <typename T> static void g(T*) {};
+ public:
+ void f() { h(g<int>); }
+ };
+}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p2.cpp b/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
index 8538d27..0da316c 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
@@ -39,5 +39,5 @@ namespace N {
}
using namespace N;
-template struct X1<int>; // expected-error{{must occur in}}
-template void f1(int); // expected-error{{must occur in}}
+template struct X1<int>; // expected-warning{{must occur in}}
+template void f1(int); // expected-warning{{must occur in}}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p5.cpp b/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
index 13fb049..7522d02 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
@@ -11,7 +11,7 @@ template class Z<int>; // expected-error{{explicit instantiation of non-template
// FIXME: This example from the standard is wrong; note posted to CWG reflector
// on 10/27/2009
using N::Y;
-template class Y<int>; // expected-error{{must occur in}}
+template class Y<int>; // expected-warning{{must occur in}}
template class N::Y<char*>;
template void N::Y<double>::mf();
diff --git a/test/CodeCompletion/call.c b/test/CodeCompletion/call.c
index 8210389..8581414 100644
--- a/test/CodeCompletion/call.c
+++ b/test/CodeCompletion/call.c
@@ -6,7 +6,7 @@ void test() {
f0(0, 0);
g0(0, 0);
f1(0, 0);
- // RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:6:6 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:6:6 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: f0(<#float x#>, float y)
// RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CC2 %s
// CHECK-CC2: f0(float x, <#float y#>)
diff --git a/test/CodeCompletion/call.cpp b/test/CodeCompletion/call.cpp
index 1df958e..46494e7 100644
--- a/test/CodeCompletion/call.cpp
+++ b/test/CodeCompletion/call.cpp
@@ -17,7 +17,7 @@ void f();
void test() {
f(Y(), 0, 0);
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: COMPLETION: Pattern : dynamic_cast<<#type-id#>>(<#expression#>)
// CHECK-CC1: f(N::Y y, <#int ZZ#>)
// CHECK-CC1-NEXT: f(int i, <#int j#>, int k)
diff --git a/test/CodeCompletion/ordinary-name.cpp b/test/CodeCompletion/ordinary-name.cpp
index 699b01d..20f661a 100644
--- a/test/CodeCompletion/ordinary-name.cpp
+++ b/test/CodeCompletion/ordinary-name.cpp
@@ -4,7 +4,7 @@ typedef struct t TYPEDEF;
void foo() {
int y = 17;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: bool
// CHECK-CC1-NEXT: COMPLETION: char
// CHECK-CC1-NEXT: COMPLETION: class
@@ -57,7 +57,7 @@ void foo() {
// CHECK-CC1-NEXT: COMPLETION: y : [#int#]y
// CHECK-CC1-NEXT: COMPLETION: z : [#void#]z(<#int#>)
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:1 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:4:1 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: COMPLETION: Pattern : asm(<#string-literal#>)
// CHECK-CC2-NEXT: COMPLETION: bool
// CHECK-CC2-NEXT: COMPLETION: char
@@ -93,7 +93,7 @@ void foo() {
// CHECK-CC2-NEXT: COMPLETION: wchar_t
// CHECK-CC2-NEXT: COMPLETION: X : X
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:1:19 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:1:19 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: COMPLETION: bool
// CHECK-CC3-NEXT: COMPLETION: char
// CHECK-CC3-NEXT: COMPLETION: class
@@ -129,7 +129,7 @@ void foo() {
// CHECK-CC3-NEXT: COMPLETION: wchar_t
// CHECK-CC3-NEXT: COMPLETION: X : X
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:6:11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: COMPLETION: bool
// CHECK-CC4-NEXT: COMPLETION: char
// CHECK-CC4-NEXT: COMPLETION: class
diff --git a/test/CodeCompletion/truncation.c b/test/CodeCompletion/truncation.c
index 134139d..1b446b7 100644
--- a/test/CodeCompletion/truncation.c
+++ b/test/CodeCompletion/truncation.c
@@ -2,6 +2,8 @@
struct
+/* foo */
+
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s.h:4:8 -o - %s | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: X
// CHECK-CC1-NEXT: Y
@@ -9,3 +11,8 @@ struct
// CHECK-CC2: X
// CHECK-CC2: Xa
// CHECK-CC2: Y
+
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:3 -o - %s | FileCheck -check-prefix=CC3 %s
+// CHECK-CC3: X
+// CHECK-CC3: Xa
+// CHECK-CC3: Y
diff --git a/test/CodeGen/blocks.c b/test/CodeGen/blocks.c
index e7625b1..a0f5dae 100644
--- a/test/CodeGen/blocks.c
+++ b/test/CodeGen/blocks.c
@@ -12,7 +12,7 @@ struct s0 {
int a[64];
};
-// RUN: grep 'internal void @__f2_block_invoke_(.struct.s0\* sret .*, .*, .* byval .*)' %t
+// RUN: grep 'internal void @__f2_block_invoke_0(.struct.s0\* sret .*, .*, .* byval .*)' %t
struct s0 f2(struct s0 a0) {
return ^(struct s0 a1){ return a1; }(a0);
}
diff --git a/test/CodeGen/builtins.c b/test/CodeGen/builtins.c
index a4424d7..8b61258 100644
--- a/test/CodeGen/builtins.c
+++ b/test/CodeGen/builtins.c
@@ -163,3 +163,35 @@ void bar() {
}
// CHECK: }
+
+
+// CHECK: define void @test_float_builtins
+void test_float_builtins(float F, double D, long double LD) {
+ volatile int res;
+ res = __builtin_isinf(F);
+ // CHECK: call float @fabsf(float
+ // CHECK: fcmp oeq float {{.*}}, 0x7FF0000000000000
+
+ res = __builtin_isinf(D);
+ // CHECK: call double @fabs(double
+ // CHECK: fcmp oeq double {{.*}}, 0x7FF0000000000000
+
+ res = __builtin_isinf(LD);
+ // CHECK: call x86_fp80 @fabsl(x86_fp80
+ // CHECK: fcmp oeq x86_fp80 {{.*}}, 0xK7FFF8000000000000000
+
+ res = __builtin_isfinite(F);
+ // CHECK: fcmp oeq float
+ // CHECK: call float @fabsf
+ // CHECK: fcmp une float {{.*}}, 0x7FF0000000000000
+ // CHECK: and i1
+
+ res = __builtin_isnormal(F);
+ // CHECK: fcmp oeq float
+ // CHECK: call float @fabsf
+ // CHECK: fcmp ult float {{.*}}, 0x7FF0000000000000
+ // CHECK: fcmp uge float {{.*}}, 0x3810000000000000
+ // CHECK: and i1
+ // CHECK: and i1
+}
+
diff --git a/test/CodeGen/complex.c b/test/CodeGen/complex.c
index ca60610..055383e 100644
--- a/test/CodeGen/complex.c
+++ b/test/CodeGen/complex.c
@@ -89,3 +89,7 @@ void t6() {
--ci1;
}
+// <rdar://problem/7958272>
+double t7(double _Complex c) {
+ return __builtin_fabs(__real__(c));
+}
diff --git a/test/CodeGen/microsoft-call-conv.c b/test/CodeGen/microsoft-call-conv.c
new file mode 100644
index 0000000..95f5fa3
--- /dev/null
+++ b/test/CodeGen/microsoft-call-conv.c
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s
+
+void __fastcall f1(void);
+void __stdcall f2(void);
+void __thiscall f3(void);
+void __fastcall f4(void) {
+// CHECK: define x86_fastcallcc void @f4()
+ f1();
+// CHECK: call x86_fastcallcc void @f1()
+}
+void __stdcall f5(void) {
+// CHECK: define x86_stdcallcc void @f5()
+ f2();
+// CHECK: call x86_stdcallcc void @f2()
+}
+void __thiscall f6(void) {
+// CHECK: define x86_thiscallcc void @f6()
+ f3();
+// CHECK: call x86_thiscallcc void @f3()
+}
+
+// PR5280
+void (__fastcall *pf1)(void) = f1;
+void (__stdcall *pf2)(void) = f2;
+void (__thiscall *pf3)(void) = f3;
+void (__fastcall *pf4)(void) = f4;
+void (__stdcall *pf5)(void) = f5;
+void (__thiscall *pf6)(void) = f6;
+
+int main(void) {
+ f4(); f5(); f6();
+ // CHECK: call x86_fastcallcc void @f4()
+ // CHECK: call x86_stdcallcc void @f5()
+ // CHECK: call x86_thiscallcc void @f6()
+ pf1(); pf2(); pf3(); pf4(); pf5(); pf6();
+ // CHECK: call x86_fastcallcc void %{{.*}}()
+ // CHECK: call x86_stdcallcc void %{{.*}}()
+ // CHECK: call x86_thiscallcc void %{{.*}}()
+ // CHECK: call x86_fastcallcc void %{{.*}}()
+ // CHECK: call x86_stdcallcc void %{{.*}}()
+ // CHECK: call x86_thiscallcc void %{{.*}}()
+ return 0;
+}
+
+// PR7117
+void __stdcall f7(foo) int foo; {}
+void f8(void) {
+ f7(0);
+ // CHECK: call x86_stdcallcc void (...)* bitcast
+}
diff --git a/test/CodeGen/stdcall-fastcall.c b/test/CodeGen/stdcall-fastcall.c
index bea6df3..6f3b003 100644
--- a/test/CodeGen/stdcall-fastcall.c
+++ b/test/CodeGen/stdcall-fastcall.c
@@ -2,32 +2,49 @@
void __attribute__((fastcall)) f1(void);
void __attribute__((stdcall)) f2(void);
-void __attribute__((fastcall)) f3(void) {
-// CHECK: define x86_fastcallcc void @f3()
+void __attribute__((thiscall)) f3(void);
+void __attribute__((fastcall)) f4(void) {
+// CHECK: define x86_fastcallcc void @f4()
f1();
// CHECK: call x86_fastcallcc void @f1()
}
-void __attribute__((stdcall)) f4(void) {
-// CHECK: define x86_stdcallcc void @f4()
+void __attribute__((stdcall)) f5(void) {
+// CHECK: define x86_stdcallcc void @f5()
f2();
// CHECK: call x86_stdcallcc void @f2()
}
+void __attribute__((thiscall)) f6(void) {
+// CHECK: define x86_thiscallcc void @f6()
+ f3();
+// CHECK: call x86_thiscallcc void @f3()
+}
// PR5280
void (__attribute__((fastcall)) *pf1)(void) = f1;
void (__attribute__((stdcall)) *pf2)(void) = f2;
-void (__attribute__((fastcall)) *pf3)(void) = f3;
-void (__attribute__((stdcall)) *pf4)(void) = f4;
+void (__attribute__((thiscall)) *pf3)(void) = f3;
+void (__attribute__((fastcall)) *pf4)(void) = f4;
+void (__attribute__((stdcall)) *pf5)(void) = f5;
+void (__attribute__((thiscall)) *pf6)(void) = f6;
int main(void) {
- f3(); f4();
- // CHECK: call x86_fastcallcc void @f3()
- // CHECK: call x86_stdcallcc void @f4()
- pf1(); pf2(); pf3(); pf4();
+ f4(); f5(); f6();
+ // CHECK: call x86_fastcallcc void @f4()
+ // CHECK: call x86_stdcallcc void @f5()
+ // CHECK: call x86_thiscallcc void @f6()
+ pf1(); pf2(); pf3(); pf4(); pf5(); pf6();
// CHECK: call x86_fastcallcc void %{{.*}}()
// CHECK: call x86_stdcallcc void %{{.*}}()
+ // CHECK: call x86_thiscallcc void %{{.*}}()
// CHECK: call x86_fastcallcc void %{{.*}}()
// CHECK: call x86_stdcallcc void %{{.*}}()
+ // CHECK: call x86_thiscallcc void %{{.*}}()
return 0;
}
+// PR7117
+void __attribute((stdcall)) f7(foo) int foo; {}
+void f8(void) {
+ f7(0);
+ // CHECK: call x86_stdcallcc void (...)* bitcast
+}
diff --git a/test/CodeGenCXX/PR5863-unreachable-block.cpp b/test/CodeGenCXX/PR5863-unreachable-block.cpp
new file mode 100644
index 0000000..7709615
--- /dev/null
+++ b/test/CodeGenCXX/PR5863-unreachable-block.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -emit-llvm-only %s
+
+// PR5863
+class E { };
+
+void P1() {
+ try {
+ int a=0, b=0;
+ if (a > b) // simply filling in 0 or 1 doesn't trigger the assertion
+ throw E(); // commenting out 'if' or 'throw' 'fixes' the assertion failure
+ try { } catch (...) { } // empty try/catch block needed for failure
+ } catch (...) { } // this try/catch block needed for failure
+}
diff --git a/test/CodeGenCXX/PR6747.cpp b/test/CodeGenCXX/PR6747.cpp
deleted file mode 100644
index 5a07ce6..0000000
--- a/test/CodeGenCXX/PR6747.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
-
-struct foo {
- virtual void bar();
-// CHECK: define available_externally void @_ZN3foo3bazEv
- virtual void baz() {}
-};
-void zed() {
- foo b;
- b.baz();
-}
diff --git a/test/CodeGenCXX/anonymous-namespaces.cpp b/test/CodeGenCXX/anonymous-namespaces.cpp
index 695f8f5..fb3470c 100644
--- a/test/CodeGenCXX/anonymous-namespaces.cpp
+++ b/test/CodeGenCXX/anonymous-namespaces.cpp
@@ -1,6 +1,5 @@
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
-
int f();
namespace {
@@ -20,6 +19,13 @@ namespace {
int D::d = f();
+ // Check for generation of a VTT with internal linkage
+ // CHECK: @_ZTSN12_GLOBAL__N_11X1EE = internal constant
+ struct X {
+ struct EBase { };
+ struct E : public virtual EBase { virtual ~E() {} };
+ };
+
// CHECK: define internal i32 @_ZN12_GLOBAL__N_13fooEv()
int foo() {
return 32;
@@ -36,3 +42,5 @@ namespace {
int concrete() {
return a + foo() + A::foo();
}
+
+void test_XE() { throw X::E(); }
diff --git a/test/CodeGenCXX/anonymous-union-member-initializer.cpp b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
index adb3950..a4da2c0 100644
--- a/test/CodeGenCXX/anonymous-union-member-initializer.cpp
+++ b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
@@ -34,3 +34,47 @@ namespace PR7021 {
// CHECK: ret void
}
}
+
+namespace test2 {
+ struct A {
+ struct {
+ union {
+ int b;
+ };
+ };
+
+ A();
+ };
+
+ A::A() : b(10) { }
+ // CHECK: define void @_ZN5test21AC2Ev(
+ // CHECK-NOT: }
+ // CHECK: store i32 10
+ // CHECK: }
+}
+
+namespace test3 {
+ struct A {
+ union {
+ mutable char fibers[100];
+ struct {
+ void (*callback)(void*);
+ void *callback_value;
+ };
+ };
+
+ A();
+ };
+
+ A::A() : callback(0), callback_value(0) {}
+ // CHECK: define void @ZN5test31AC2Ev(
+ // CHECK: [[THIS:%.*]] = load
+ // CHECK-NEXT: [[UNION:%.*]] = getelementptr inbounds {{.*}} [[THIS]], i32 0, i32 0
+ // CHECK-NEXT: [[STRUCT:%.*]] = getelementptr inbounds {{.*}} [[UNION]], i32 0, i32 0
+ // CHECK-NEXT: [[CALLBACK:%.*]] = getelementptr inbounds {{.*}} [[STRUCT]], i32 0, i32 0
+ // CHECK-NEXT: store void (i8*)* null, void (i8*)** [[CALLBACK]]
+ // CHECK-NEXT: [[UNION:%.*]] = getelementptr inbounds {{.*}} [[THIS]], i32 0, i32 0
+ // CHECK-NEXT: [[STRUCT:%.*]] = getelementptr inbounds {{.*}} [[UNION]], i32 0, i32 0
+ // CHECK-NEXT: [[CVALUE:%.*]] = getelementptr inbounds {{.*}} [[STRUCT]], i32 0, i32 0
+ // CHECK-NEXT: store i8* null, void i8** [[CVALUE]]
+}
diff --git a/test/CodeGenCXX/array-value-initialize.cpp b/test/CodeGenCXX/array-value-initialize.cpp
index 5fe6c20..8a3d5ff 100644
--- a/test/CodeGenCXX/array-value-initialize.cpp
+++ b/test/CodeGenCXX/array-value-initialize.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -emit-llvm -o - %s
// PR5463
extern "C" int printf(...);
@@ -21,8 +22,31 @@ struct Foo {
S sbar_[5];
};
-int main(void)
-{
+int test1(void) {
Foo a;
}
+// PR7063
+
+
+struct Unit
+{
+ Unit() {}
+ Unit(const Unit& v) {}
+};
+
+
+struct Stuff
+{
+ Unit leafPos[1];
+};
+
+
+int main()
+{
+
+ Stuff a;
+ Stuff b = a;
+
+ return 0;
+} \ No newline at end of file
diff --git a/test/CodeGenCXX/c99-variable-length-array.cpp b/test/CodeGenCXX/c99-variable-length-array.cpp
new file mode 100644
index 0000000..66c14ff
--- /dev/null
+++ b/test/CodeGenCXX/c99-variable-length-array.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+struct X {
+ X();
+ ~X();
+};
+
+struct Y {
+ Y();
+ ~Y();
+};
+
+// CHECK: define void @_Z1fiPPKc(
+void f(int argc, const char* argv[]) {
+ // CHECK: call void @_ZN1XC1Ev
+ X x;
+ // CHECK: call i8* @llvm.stacksave(
+ const char *argv2[argc];
+ // CHECK: call void @_ZN1YC1Ev
+ Y y;
+ for (int i = 0; i != argc; ++i)
+ argv2[i] = argv[i];
+
+ // CHECK: call void @_ZN1YD1Ev
+ // CHECK: call void @llvm.stackrestore
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: ret void
+}
diff --git a/test/CodeGenCXX/class-layout.cpp b/test/CodeGenCXX/class-layout.cpp
index 31091c5..9303bda 100644
--- a/test/CodeGenCXX/class-layout.cpp
+++ b/test/CodeGenCXX/class-layout.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
-// An extra byte shoudl be allocated for an empty class.
+// An extra byte should be allocated for an empty class.
// CHECK: %struct.A = type { i8 }
struct A { } a;
@@ -9,5 +9,5 @@ struct A { } a;
struct B { void *a; int b; } b;
// C should have a vtable pointer.
-// CHECK: %struct.C = type { i8**, i32 }
+// CHECK: %struct.C = type { i32 (...)**, i32 }
struct C { virtual void f(); int a; } *c;
diff --git a/test/CodeGenCXX/condition.cpp b/test/CodeGenCXX/condition.cpp
index e435408..f5b43d2 100644
--- a/test/CodeGenCXX/condition.cpp
+++ b/test/CodeGenCXX/condition.cpp
@@ -14,6 +14,7 @@ void h() {
struct X {
X();
+ X(const X&);
~X();
operator bool();
};
@@ -23,6 +24,8 @@ struct Y {
~Y();
};
+X getX();
+
void if_destruct(int z) {
// Verify that the condition variable is destroyed at the end of the
// "if" statement.
@@ -44,6 +47,14 @@ void if_destruct(int z) {
// CHECK: call void @_ZN1YD1Ev
// CHECK: br
// CHECK: call void @_ZN1XD1Ev
+
+ // CHECK: call void @_Z4getXv
+ // CHECK: call zeroext i1 @_ZN1XcvbEv
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: br
+ if (getX()) { }
+
+ // CHECK: ret
}
struct ConvertibleToInt {
@@ -52,6 +63,8 @@ struct ConvertibleToInt {
operator int();
};
+ConvertibleToInt getConvToInt();
+
void switch_destruct(int z) {
// CHECK: call void @_ZN16ConvertibleToIntC1Ev
switch (ConvertibleToInt conv = ConvertibleToInt()) {
@@ -59,52 +72,181 @@ void switch_destruct(int z) {
break;
default:
- // CHECK: {{sw.default:|:3}}
+ // CHECK: {{sw.default:|:5}}
// CHECK: store i32 19
z = 19;
break;
}
- // CHECK: {{sw.epilog:|:5}}
+ // CHECK: {{sw.epilog:|:6}}
// CHECK: call void @_ZN16ConvertibleToIntD1Ev
// CHECK: store i32 20
z = 20;
+
+ // CHECK: call void @_Z12getConvToIntv
+ // CHECK: call i32 @_ZN16ConvertibleToIntcviEv
+ // CHECK: call void @_ZN16ConvertibleToIntD1Ev
+ switch(getConvToInt()) {
+ case 0:
+ break;
+ }
+ // CHECK: store i32 27
+ z = 27;
+ // CHECK: ret
}
int foo();
void while_destruct(int z) {
// CHECK: define void @_Z14while_destructi
- // CHECK: {{while.cond:|:2}}
+ // CHECK: {{while.cond:|:3}}
while (X x = X()) {
// CHECK: call void @_ZN1XC1Ev
- // CHECK: {{while.body:|:4}}
+ // CHECK: {{while.body:|:5}}
// CHECK: store i32 21
z = 21;
- // CHECK: {{while.cleanup:|:5}}
+ // CHECK: {{while.cleanup:|:6}}
// CHECK: call void @_ZN1XD1Ev
}
- // CHECK: {{while.end|:7}}
+ // CHECK: {{while.end|:8}}
// CHECK: store i32 22
z = 22;
+
+ // CHECK: call void @_Z4getXv
+ // CHECK: call zeroext i1 @_ZN1XcvbEv
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: br
+ while(getX()) { }
+
+ // CHECK: store i32 25
+ z = 25;
+
+ // CHECK: ret
}
void for_destruct(int z) {
// CHECK: define void @_Z12for_destruct
// CHECK: call void @_ZN1YC1Ev
for(Y y = Y(); X x = X(); ++z)
- // CHECK: {{for.cond:|:2}}
+ // CHECK: {{for.cond:|:4}}
// CHECK: call void @_ZN1XC1Ev
- // CHECK: {{for.body:|:4}}
+ // CHECK: {{for.body:|:6}}
// CHECK: store i32 23
z = 23;
- // CHECK: {{for.inc:|:5}}
- // CHECK: br label %{{for.cond.cleanup|8}}
- // CHECK: {{for.cond.cleanup:|:8}}
+ // CHECK: {{for.inc:|:7}}
+ // CHECK: br label %{{for.cond.cleanup|10}}
+ // CHECK: {{for.cond.cleanup:|:10}}
// CHECK: call void @_ZN1XD1Ev
- // CHECK: {{for.end:|:10}}
+ // CHECK: {{for.end:|:12}}
// CHECK: call void @_ZN1YD1Ev
// CHECK: store i32 24
z = 24;
+
+ // CHECK: call void @_Z4getXv
+ // CHECK: call zeroext i1 @_ZN1XcvbEv
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: br
+ // CHECK: call void @_Z4getXv
+ // CHECK: load
+ // CHECK: add
+ // CHECK: call void @_ZN1XD1Ev
+ int i = 0;
+ for(; getX(); getX(), ++i) { }
+ z = 26;
+ // CHECK: store i32 26
+ // CHECK: ret
}
+
+void do_destruct(int z) {
+ // CHECK: define void @_Z11do_destruct
+ do {
+ // CHECK: store i32 77
+ z = 77;
+ // CHECK: call void @_Z4getXv
+ // CHECK: call zeroext i1 @_ZN1XcvbEv
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: br
+ } while (getX());
+ // CHECK: store i32 99
+ z = 99;
+ // CHECK: ret
+}
+
+int f(X);
+
+template<typename T>
+int instantiated(T x) {
+ int result;
+
+ // CHECK: call void @_ZN1XC1ERKS_
+ // CHECK: call i32 @_Z1f1X
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: br
+ // CHECK: store i32 2
+ // CHECK: br
+ // CHECK: store i32 3
+ if (f(x)) { result = 2; } else { result = 3; }
+
+ // CHECK: call void @_ZN1XC1ERKS_
+ // CHECK: call i32 @_Z1f1X
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: br
+ // CHECK: store i32 4
+ // CHECK: br
+ while (f(x)) { result = 4; }
+
+ // CHECK: call void @_ZN1XC1ERKS_
+ // CHECK: call i32 @_Z1f1X
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: br
+ // CHECK: store i32 6
+ // CHECK: br
+ // CHECK: call void @_ZN1XC1ERKS_
+ // CHECK: call i32 @_Z1f1X
+ // CHECK: store i32 5
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: br
+ for (; f(x); f(x), result = 5) {
+ result = 6;
+ }
+
+ // CHECK: call void @_ZN1XC1ERKS_
+ // CHECK: call i32 @_Z1f1X
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: switch i32
+ // CHECK: store i32 7
+ // CHECK: store i32 8
+ switch (f(x)) {
+ case 0:
+ result = 7;
+ break;
+
+ case 1:
+ result = 8;
+ }
+
+ // CHECK: store i32 9
+ // CHECK: br
+ // CHECK: call void @_ZN1XC1ERKS_
+ // CHECK: call i32 @_Z1f1X
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: br
+ do {
+ result = 9;
+ } while (f(x));
+
+ // CHECK: store i32 10
+ // CHECK: call void @_ZN1XC1ERKS_
+ // CHECK: call zeroext i1 @_ZN1XcvbEv
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: br
+ do {
+ result = 10;
+ } while (X(x));
+
+ // CHECK: ret i32
+ return result;
+}
+
+template int instantiated(X);
diff --git a/test/CodeGenCXX/cxx-apple-kext.cpp b/test/CodeGenCXX/cxx-apple-kext.cpp
index 8d67b53..4ba6906 100644
--- a/test/CodeGenCXX/cxx-apple-kext.cpp
+++ b/test/CodeGenCXX/cxx-apple-kext.cpp
@@ -3,9 +3,9 @@
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 %s -fapple-kext -flto -S -o - |\
// RUN: FileCheck --check-prefix=CHECK-KEXT %s
-// CHECK-NO-KEXT: @_ZTI3foo = {{.*}} @_ZTVN10__cxxabiv117
// CHECK-NO-KEXT-NOT: _GLOBAL__D_a
// CHECK-NO-KEXT: @is_hosted = global
+// CHECK-NO-KEXT: @_ZTI3foo = {{.*}} @_ZTVN10__cxxabiv117
// CHECK-NO-KEXT: call i32 @__cxa_atexit({{.*}} @_ZN3fooD1Ev
// CHECK-NO-KEXT: declare i32 @__cxa_atexit
diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp
index d40b174..1442e37 100644
--- a/test/CodeGenCXX/destructors.cpp
+++ b/test/CodeGenCXX/destructors.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -mconstructor-aliases | FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - -mconstructor-aliases -fexceptions | FileCheck %s
// CHECK: @_ZN5test01AD1Ev = alias {{.*}} @_ZN5test01AD2Ev
// CHECK: @_ZN5test11MD2Ev = alias {{.*}} @_ZN5test11AD2Ev
@@ -6,6 +6,10 @@
// CHECK: @_ZN5test11OD2Ev = alias {{.*}} @_ZN5test11AD2Ev
// CHECK: @_ZN5test11SD2Ev = alias bitcast {{.*}} @_ZN5test11AD2Ev
+// CHECK: @_ZN5test312_GLOBAL__N_11DD1Ev = alias internal {{.*}} @_ZN5test312_GLOBAL__N_11DD2Ev
+// CHECK: @_ZN5test312_GLOBAL__N_11DD2Ev = alias internal bitcast {{.*}} @_ZN5test312_GLOBAL__N_11CD2Ev
+// CHECK: @_ZN5test312_GLOBAL__N_11CD1Ev = alias internal {{.*}} @_ZN5test312_GLOBAL__N_11CD2Ev
+
struct A {
int a;
@@ -147,3 +151,62 @@ namespace test2 {
// CHECK: define void @_ZN5test21BD2Ev
// CHECK: call void @_ZN5test21AD2Ev
}
+
+// PR7142
+namespace test3 {
+ struct A { virtual ~A(); };
+ struct B { virtual ~B(); };
+ namespace { // internal linkage => deferred
+ struct C : A, B {}; // ~B() in D requires a this-adjustment thunk
+ struct D : C {}; // D::~D() is an alias to C::~C()
+ }
+
+ void test() {
+ new D; // Force emission of D's vtable
+ }
+
+ // Checked at top of file:
+ // @_ZN5test312_GLOBAL__N_11CD1Ev = alias internal {{.*}} @_ZN5test312_GLOBAL__N_11CD2Ev
+
+ // CHECK: define internal void @_ZN5test312_GLOBAL__N_11CD2Ev(
+ // CHECK: call void @_ZN5test31BD2Ev(
+ // CHECK: call void @_ZN5test31AD2Ev(
+ // CHECK: ret void
+
+ // CHECK: define internal void @_ZN5test312_GLOBAL__N_11DD0Ev(
+ // CHECK: call void @_ZN5test312_GLOBAL__N_11DD1Ev(
+ // CHECK: call void @_ZdlPv(
+ // CHECK: ret void
+
+ // Checked at top of file:
+ // @_ZN5test312_GLOBAL__N_11DD1Ev = alias internal {{.*}} @_ZN5test312_GLOBAL__N_11DD2Ev
+ // @_ZN5test312_GLOBAL__N_11DD2Ev = alias internal bitcast {{.*}} @_ZN5test312_GLOBAL__N_11CD2Ev
+
+ // CHECK: define internal void @_ZThn8_N5test312_GLOBAL__N_11DD1Ev(
+ // CHECK: getelementptr inbounds i8* {{.*}}, i64 -8
+ // CHECK: call void @_ZN5test312_GLOBAL__N_11DD1Ev(
+ // CHECK: ret void
+
+ // CHECK: define internal void @_ZThn8_N5test312_GLOBAL__N_11DD0Ev(
+ // CHECK: getelementptr inbounds i8* {{.*}}, i64 -8
+ // CHECK: call void @_ZN5test312_GLOBAL__N_11DD0Ev(
+ // CHECK: ret void
+
+ // CHECK: declare void @_ZN5test31BD2Ev(
+ // CHECK: declare void @_ZN5test31AD2Ev(
+
+ // CHECK: define internal void @_ZN5test312_GLOBAL__N_11CD0Ev(
+ // CHECK: call void @_ZN5test312_GLOBAL__N_11CD1Ev(
+ // CHECK: call void @_ZdlPv(
+ // CHECK: ret void
+
+ // CHECK: define internal void @_ZThn8_N5test312_GLOBAL__N_11CD1Ev(
+ // CHECK: getelementptr inbounds i8* {{.*}}, i64 -8
+ // CHECK: call void @_ZN5test312_GLOBAL__N_11CD1Ev(
+ // CHECK: ret void
+
+ // CHECK: define internal void @_ZThn8_N5test312_GLOBAL__N_11CD0Ev(
+ // CHECK: getelementptr inbounds i8* {{.*}}, i64 -8
+ // CHECK: call void @_ZN5test312_GLOBAL__N_11CD0Ev(
+ // CHECK: ret void
+}
diff --git a/test/CodeGenCXX/dynamic-cast.cpp b/test/CodeGenCXX/dynamic-cast.cpp
index aeb2a64..9838e25 100644
--- a/test/CodeGenCXX/dynamic-cast.cpp
+++ b/test/CodeGenCXX/dynamic-cast.cpp
@@ -1,8 +1,17 @@
-// RUN: %clang_cc1 %s -emit-llvm-only
-
+// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - | FileCheck %s
struct A { virtual void f(); };
struct B : A { };
+// CHECK: {{define.*@_Z1fP1A}}
+B fail;
const B& f(A *a) {
- return dynamic_cast<const B&>(*a);
+ try {
+ // CHECK: call i8* @__dynamic_cast
+ // CHECK: br i1
+ // CHECK: invoke void @__cxa_bad_cast() noreturn
+ dynamic_cast<const B&>(*a);
+ } catch (...) {
+ // CHECK: call i8* @llvm.eh.exception
+ }
+ return fail;
}
diff --git a/test/CodeGenCXX/dyncast.cpp b/test/CodeGenCXX/dyncast.cpp
index 127cdd8..906d44b 100644
--- a/test/CodeGenCXX/dyncast.cpp
+++ b/test/CodeGenCXX/dyncast.cpp
@@ -20,8 +20,6 @@ extern "C" int printf(const char *str...);
void test1() {
test1_B* bp = (test1_B*)&test1_d;
test1_A* ap = &test1_d;
- // This throws
- // test1_D& dr = dynamic_cast<D&>(*bp);
test1_D* dp = dynamic_cast<test1_D*>(bp);
S(dp == 0, 1);
ap = dynamic_cast<test1_A*>(bp);
diff --git a/test/CodeGenCXX/implicit-copy-constructor.cpp b/test/CodeGenCXX/implicit-copy-constructor.cpp
new file mode 100644
index 0000000..a343dd1
--- /dev/null
+++ b/test/CodeGenCXX/implicit-copy-constructor.cpp
@@ -0,0 +1,72 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+
+struct A {
+ A();
+ A(const A&);
+ A(A&);
+ ~A();
+};
+
+struct B {
+ B();
+ B(B&);
+};
+
+struct C {
+ C() {}
+ C(C& other, A a = A());
+ int i, j;
+};
+
+struct POD {
+ int array[3][4];
+};
+
+struct D : A, B, virtual C {
+ D();
+ int scalar;
+ int scalar_array[2][3];
+ B class_member;
+ C class_member_array[2][3];
+ POD pod_array[2][3];
+
+ union {
+ int x;
+ float f[3];
+ };
+};
+
+void f(D d) {
+ D d2(d);
+}
+
+// CHECK: define linkonce_odr void @_ZN1DC1ERS_
+// CHECK: call void @_ZN1AC1Ev
+// CHECK: call void @_ZN1CC2ERS_1A
+// CHECK: call void @_ZN1AD1Ev
+// CHECK: call void @_ZN1AC2ERS_
+// CHECK: call void @_ZN1BC2ERS_
+// CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 24}}
+// CHECK: call void @_ZN1BC1ERS_
+// CHECK: br
+// CHECK: {{icmp ult.*, 2}}
+// CHECK: {{icmp ult.*, 3}}
+// CHECK: call void @_ZN1AC1Ev
+// CHECK: call void @_ZN1CC1ERS_1A
+// CHECK: call void @_ZN1AD1Ev
+// CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 288}}
+// CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 12}}
+// CHECK: ret void
+
+
+template<class T> struct X0 { void f0(T * ) { } };
+template <class > struct X1 { X1( X1& , int = 0 ) { } };
+struct X2 { X1<int> result; };
+void test_X2()
+{
+ typedef X2 impl;
+ typedef X0<impl> pimpl;
+ impl* i;
+ pimpl pdata;
+ pdata.f0( new impl(*i));
+}
diff --git a/test/CodeGenCXX/key-function-vtable.cpp b/test/CodeGenCXX/key-function-vtable.cpp
index 251a14e..1cfeb0c 100644
--- a/test/CodeGenCXX/key-function-vtable.cpp
+++ b/test/CodeGenCXX/key-function-vtable.cpp
@@ -32,11 +32,20 @@ namespace {
}
testg *testgvar = new testg;
+struct X0 { virtual ~X0(); };
+struct X1 : X0 {
+ virtual void f();
+};
+
+inline void X1::f() { }
+
+void use_X1(X1 *x1) { x1->f(); }
+
// FIXME: The checks are extremely difficult to get right when the globals
// aren't alphabetized
+// CHECK: @_ZTV2X1 = weak_odr constant
// CHECK: @_ZTV5testa = constant [3 x i8*] [i8* null
// CHECK: @_ZTV5testc = weak_odr constant [3 x i8*] [i8* null
// CHECK: @_ZTVN12_GLOBAL__N_15testgE = internal constant [3 x i8*] [i8* null
// CHECK: @_ZTV5teste = weak_odr constant [3 x i8*] [i8* null
// CHECK: @_ZTV5testb = weak_odr constant [3 x i8*] [i8* null
-
diff --git a/test/CodeGenCXX/mangle-subst-std.cpp b/test/CodeGenCXX/mangle-subst-std.cpp
index 062610b..4c15eaa 100644
--- a/test/CodeGenCXX/mangle-subst-std.cpp
+++ b/test/CodeGenCXX/mangle-subst-std.cpp
@@ -1,5 +1,16 @@
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// Check mangling of Vtables, VTTs, and construction vtables that
+// involve standard substitutions.
+
+// CHECK: @_ZTVSd = weak_odr constant
+// CHECK: @_ZTCSd0_Si = internal constant
+// CHECK: @_ZTCSd16_So = internal constant
+// CHECK: @_ZTTSd = weak_odr constant
+// CHECK: @_ZTVSo = weak_odr constant
+// CHECK: @_ZTTSo = weak_odr constant
+// CHECK: @_ZTVSi = weak_odr constant
+// CHECK: @_ZTTSi = weak_odr constant
namespace std {
struct A { A(); };
@@ -32,9 +43,30 @@ namespace std {
void f(std::string) { }
namespace std {
- template<typename, typename> struct basic_istream { };
- template<typename, typename> struct basic_ostream { };
- template<typename, typename> struct basic_iostream { };
+ template<typename, typename> struct basic_ios {
+ basic_ios(int);
+ virtual ~basic_ios();
+ };
+ template<typename charT, typename traits = char_traits<charT> >
+ struct basic_istream : virtual public basic_ios<charT, traits> {
+ basic_istream(int x) : basic_ios<charT, traits>(x), stored(x) { }
+
+ int stored;
+ };
+ template<typename charT, typename traits = char_traits<charT> >
+ struct basic_ostream : virtual public basic_ios<charT, traits> {
+ basic_ostream(int x) : basic_ios<charT, traits>(x), stored(x) { }
+
+ float stored;
+ };
+
+ template<typename charT, typename traits = char_traits<charT> >
+ struct basic_iostream : public basic_istream<charT, traits>,
+ public basic_ostream<charT, traits> {
+ basic_iostream(int x) : basic_istream<charT, traits>(x),
+ basic_ostream<charT, traits>(x),
+ basic_ios<charT, traits>(x) { }
+ };
}
// CHECK: _Z1fSi
@@ -61,3 +93,9 @@ namespace std
template<typename, typename, typename> struct basic_string { };
typedef basic_string<char, std::char_traits<char>, std::allocator<char> > not_string;
void f(not_string) { }
+
+// Manglings for instantiations caused by this function are at the
+// top of the test.
+void create_streams() {
+ std::basic_iostream<char> bio(17);
+}
diff --git a/test/CodeGenCXX/nrvo.cpp b/test/CodeGenCXX/nrvo.cpp
new file mode 100644
index 0000000..9ee5536
--- /dev/null
+++ b/test/CodeGenCXX/nrvo.cpp
@@ -0,0 +1,84 @@
+// RUN: %clang_cc1 -emit-llvm -O1 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -fexceptions -o - %s | FileCheck --check-prefix=CHECK-EH %s
+
+// Test code generation for the named return value optimization.
+class X {
+public:
+ X();
+ X(const X&);
+ ~X();
+};
+
+// CHECK: define void @_Z5test0v
+// CHECK-EH: define void @_Z5test0v
+X test0() {
+ X x;
+ // CHECK-NOT: call void @_ZN1XD1Ev
+ // CHECK: ret void
+ // CHECK-EH: br label
+ // CHECK-EH: call void @_ZN1XD1Ev
+ // CHECK-EH: br label
+ // CHECK-EH: invoke void @_ZN1XD1Ev
+ // CHECK-EH: ret void
+ return x;
+}
+
+// CHECK: define void @_Z5test1b(
+X test1(bool B) {
+ // CHECK: call void @_ZN1XC1Ev
+ X x;
+ // CHECK-NOT: call void @_ZN1XD1Ev
+ // CHECK: ret void
+ if (B)
+ return (x);
+ return x;
+ // CHECK-EH: invoke void @_ZN1XD1Ev
+}
+
+// CHECK: define void @_Z5test2b
+// CHECK-EH: define void @_Z5test2b
+X test2(bool B) {
+ // No NRVO
+ // CHECK: call void @_ZN1XC1Ev
+ X x;
+ // CHECK: call void @_ZN1XC1Ev
+ X y;
+ // CHECK: call void @_ZN1XC1ERKS_
+ // CHECK-EH: invoke void @_ZN1XC1ERKS_
+ if (B)
+ return y;
+ // CHECK: call void @_ZN1XC1ERKS_
+ // CHECK-EH: invoke void @_ZN1XC1ERKS_
+ return x;
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: call void @_ZN1XD1Ev
+ // CHECK: ret void
+ // CHECK-EH: invoke void @_ZN1XD1Ev
+ // CHECK-EH: invoke void @_ZN1XD1Ev
+}
+
+X test3(bool B) {
+ // FIXME: We don't manage to apply NRVO here, although we could.
+ {
+ X y;
+ return y;
+ }
+ X x;
+ return x;
+}
+
+extern "C" void exit(int) throw();
+
+// CHECK: define void @_Z5test4b
+X test4(bool B) {
+ {
+ // CHECK: tail call void @_ZN1XC1Ev
+ X x;
+ // CHECK: br i1
+ if (B)
+ return x;
+ }
+ // CHECK: tail call void @_ZN1XD1Ev
+ // CHECK: tail call void @exit(i32 1)
+ exit(1);
+}
diff --git a/test/CodeGenCXX/pointers-to-data-members.cpp b/test/CodeGenCXX/pointers-to-data-members.cpp
index d96eb03..affe1f7 100644
--- a/test/CodeGenCXX/pointers-to-data-members.cpp
+++ b/test/CodeGenCXX/pointers-to-data-members.cpp
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 | FileCheck %s
-
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 -O3 | FileCheck --check-prefix=CHECK-O3 %s
struct A { int a; int b; };
struct B { int b; };
struct C : B, A { };
@@ -35,6 +35,21 @@ namespace ZeroInit {
int A::*pa;
} s;
} ss;
+
+ struct A {
+ int A::*a;
+ int b;
+ };
+
+ struct B {
+ A a[10];
+ char c;
+ int B::*b;
+ };
+
+ struct C : A, B { int j; };
+ // CHECK: @_ZN8ZeroInit1cE = global %"struct.ZeroInit::C" { [16 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00", [176 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF", i32 0, [4 x i8] zeroinitializer }
+ C c;
}
// PR5674
@@ -85,3 +100,54 @@ namespace Comparisons {
if (0 == a) { }
}
}
+
+namespace ValueInit {
+
+struct A {
+ int A::*a;
+
+ char c;
+
+ A();
+};
+
+// CHECK: define void @_ZN9ValueInit1AC2Ev
+// CHECK: store i64 -1, i64*
+// CHECK: ret void
+A::A() : a() {}
+
+}
+
+namespace PR7139 {
+
+struct pair {
+ int first;
+ int second;
+};
+
+typedef int pair::*ptr_to_member_type;
+
+struct ptr_to_member_struct {
+ ptr_to_member_type data;
+ int i;
+};
+
+struct A {
+ ptr_to_member_struct a;
+
+ A() : a() {}
+};
+
+// CHECK-O3: define zeroext i1 @_ZN6PR71395checkEv() nounwind readnone
+bool check() {
+ // CHECK-O3: ret i1 true
+ return A().a.data == 0;
+}
+
+// CHECK-O3: define zeroext i1 @_ZN6PR71396check2Ev() nounwind readnone
+bool check2() {
+ // CHECK-O3: ret i1 true
+ return ptr_to_member_type() == 0;
+}
+
+}
diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp
index 5a5947d..6fc6102 100644
--- a/test/CodeGenCXX/references.cpp
+++ b/test/CodeGenCXX/references.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -verify -emit-llvm -o - %s | FileCheck %s
void t1() {
extern int& a;
int b = a;
@@ -155,3 +155,73 @@ void f0(s1 a) { s1 b = a; }
// CHECK: load
// CHECK: ret
const int &f2() { return 0; }
+
+// Don't constant fold const reference parameters with default arguments to
+// their default arguments.
+namespace N1 {
+ const int foo = 1;
+ // CHECK: @_ZN2N14test
+ int test(const int& arg = foo) {
+ // Ensure this array is on the stack where we can set values instead of
+ // being a global constant.
+ // CHECK: %args_array = alloca
+ const int* const args_array[] = { &arg };
+ }
+}
+
+// Bind to subobjects while extending the life of the complete object.
+namespace N2 {
+ class X {
+ public:
+ X(const X&);
+ X &operator=(const X&);
+ ~X();
+ };
+
+ struct P {
+ X first;
+ };
+
+ P getP();
+
+ // CHECK: define void @_ZN2N21fEi
+ // CHECK: call void @_ZN2N24getPEv
+ // CHECK: getelementptr inbounds
+ // CHECK: store i32 17
+ // CHECK: call void @_ZN2N21PD1Ev
+ void f(int i) {
+ const X& xr = getP().first;
+ i = 17;
+ }
+
+ struct SpaceWaster {
+ int i, j;
+ };
+
+ struct ReallyHasX {
+ X x;
+ };
+
+ struct HasX : ReallyHasX { };
+
+ struct HasXContainer {
+ HasX has;
+ };
+
+ struct Y : SpaceWaster, HasXContainer { };
+ struct Z : SpaceWaster, Y { };
+
+ Z getZ();
+
+ // CHECK: define void @_ZN2N21gEi
+ // CHECK: call void @_ZN2N24getZEv
+ // CHECK: {{getelementptr inbounds.*i32 0, i32 0}}
+ // CHECK: {{getelementptr inbounds.*i32 0, i32 0}}
+ // CHECK: store i32 19
+ // CHECK: call void @_ZN2N21ZD1Ev
+ // CHECK: ret void
+ void g(int i) {
+ const X &xr = getZ().has.x;
+ i = 19;
+ }
+}
diff --git a/test/CodeGenCXX/rtti-linkage.cpp b/test/CodeGenCXX/rtti-linkage.cpp
index b9eb5b4..9d85a2c 100644
--- a/test/CodeGenCXX/rtti-linkage.cpp
+++ b/test/CodeGenCXX/rtti-linkage.cpp
@@ -1,47 +1,53 @@
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | sort | FileCheck %s
+
+// FIXME: Fails on Win32, dunno why.
+// XFAIL: win32
+
#include <typeinfo>
-// CHECK: _ZTS1B = constant
-// CHECK: _ZTS1A = weak_odr constant
+
+
+// CHECK: _ZTIN12_GLOBAL__N_11DE to
+
+
+
// CHECK: _ZTI1A = weak_odr constant
// CHECK: _ZTI1B = constant
-// CHECK: _ZTSP1C = internal constant
-// CHECK: _ZTS1C = internal constant
// CHECK: _ZTI1C = internal constant
-// CHECK: _ZTIP1C = internal constant
-// CHECK: _ZTSPP1C = internal constant
-// CHECK: _ZTIPP1C = internal constant
-// CHECK: _ZTSM1Ci = internal constant
-// CHECK: _ZTIM1Ci = internal constant
-// CHECK: _ZTSPM1Ci = internal constant
-// CHECK: _ZTIPM1Ci = internal constant
-// CHECK: _ZTSM1CS_ = internal constant
-// CHECK: _ZTIM1CS_ = internal constant
-// CHECK: _ZTSM1CPS_ = internal constant
-// CHECK: _ZTIM1CPS_ = internal constant
-// CHECK: _ZTSM1A1C = internal constant
+// CHECK: _ZTIFN12_GLOBAL__N_11DEvE = internal constant
+// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal constant
+// CHECK: _ZTIFvvE = weak_odr
// CHECK: _ZTIM1A1C = internal constant
-// CHECK: _ZTSM1AP1C = internal constant
// CHECK: _ZTIM1AP1C = internal constant
-
-// CHECK: _ZTS1F = weak_odr constant
-
-// CHECK: _ZTSN12_GLOBAL__N_11DE = internal constant
+// CHECK: _ZTIM1CPS_ = internal constant
+// CHECK: _ZTIM1CS_ = internal constant
+// CHECK: _ZTIM1Ci = internal constant
// CHECK: _ZTIN12_GLOBAL__N_11DE = internal constant
-// CHECK: _ZTSPN12_GLOBAL__N_11DE = internal constant
+// CHECK: _ZTIN12_GLOBAL__N_11EE = internal constant
+// CHECK: _ZTIP1C = internal constant
+// CHECK: _ZTIPFvvE = weak_odr constant
+// CHECK: _ZTIPM1Ci = internal constant
// CHECK: _ZTIPN12_GLOBAL__N_11DE = internal constant
+// CHECK: _ZTIPP1C = internal constant
+// CHECK: _ZTS1A = weak_odr constant
+// CHECK: _ZTS1B = constant
+// CHECK: _ZTS1C = internal constant
+// CHECK: _ZTS1F = weak_odr constant
// CHECK: _ZTSFN12_GLOBAL__N_11DEvE = internal constant
-// CHECK: _ZTIFN12_GLOBAL__N_11DEvE = internal constant
// CHECK: _ZTSFvN12_GLOBAL__N_11DEE = internal constant
-// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal constant
-
-// CHECK: _ZTSPFvvE = weak_odr constant
// CHECK: _ZTSFvvE = weak_odr constant
-// CHECK: _ZTIFvvE = weak_odr
-// CHECK: _ZTIPFvvE = weak_odr constant
-
+// CHECK: _ZTSM1A1C = internal constant
+// CHECK: _ZTSM1AP1C = internal constant
+// CHECK: _ZTSM1CPS_ = internal constant
+// CHECK: _ZTSM1CS_ = internal constant
+// CHECK: _ZTSM1Ci = internal constant
+// CHECK: _ZTSN12_GLOBAL__N_11DE = internal constant
// CHECK: _ZTSN12_GLOBAL__N_11EE = internal constant
-// CHECK: _ZTIN12_GLOBAL__N_11EE = internal constant
+// CHECK: _ZTSP1C = internal constant
+// CHECK: _ZTSPFvvE = weak_odr constant
+// CHECK: _ZTSPM1Ci = internal constant
+// CHECK: _ZTSPN12_GLOBAL__N_11DE = internal constant
+// CHECK: _ZTSPP1C = internal constant
// A has no key function, so its RTTI data should be weak_odr.
struct A { };
@@ -99,6 +105,5 @@ const std::type_info &t2() {
(void)typeid(E);
- // CHECK: _ZTIN12_GLOBAL__N_11DE to
return typeid(getD());
}
diff --git a/test/CodeGenCXX/static-init-3.cpp b/test/CodeGenCXX/static-init-3.cpp
new file mode 100644
index 0000000..5bf76a6
--- /dev/null
+++ b/test/CodeGenCXX/static-init-3.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin10.0.0 -o - %s | FileCheck %s
+
+// PR7050
+template<class T> struct X0 : public T { };
+
+template <class T>
+struct X1
+{
+ static T & instance;
+ // include this to provoke instantiation at pre-execution time
+ static void use(T const &) {}
+ static T & get() {
+ static X0<T> t;
+ use(instance);
+ return static_cast<T &>(t);
+ }
+};
+
+// CHECK: @_ZN2X1I2X2I1BEE8instanceE = weak global %struct.X0* null, align 8
+// CHECJ: @_ZN2X1I2X2I1AEE8instanceE = weak global %struct.X0* null, align 8
+template<class T> T & X1<T>::instance = X1<T>::get();
+
+class A { };
+class B : public A { };
+
+template<typename T> struct X2 {};
+X2< B > bg = X1< X2< B > >::get();
+X2< A > ag = X1< X2< A > >::get();
diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp
index 750da02..9ad87df 100644
--- a/test/CodeGenCXX/static-init.cpp
+++ b/test/CodeGenCXX/static-init.cpp
@@ -2,8 +2,9 @@
// CHECK: @_ZZ1hvE1i = internal global i32 0, align 4
-// CHECK: @_ZZ2h2vE1i = weak global i32 0
-// CHECK: @_ZGVZ2h2vE1i = weak global i64 0
+// CHECK: @_ZZN5test16getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 4
+// CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0
+// CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0
struct A {
A();
@@ -11,7 +12,9 @@ struct A {
};
void f() {
- // CHECK: call void @_ZN1AC1Ev(
+ // CHECK: call i32 @__cxa_guard_acquire
+ // CHECK: call void @_ZN1AC1Ev
+ // CHECK: call void @__cxa_guard_release
// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @_ZZ1fvE1a, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*))
static A a;
}
@@ -45,3 +48,13 @@ namespace test0 {
static A r;
}
}
+
+namespace test1 {
+ // CHECK: define internal i32 @_ZN5test16getvarEi(
+ static inline int getvar(int index) {
+ static const int var[] = { 1, 0, 2, 4 };
+ return var[index];
+ }
+
+ void test() { (void) getvar(2); }
+}
diff --git a/test/CodeGenCXX/static-local-in-local-class.cpp b/test/CodeGenCXX/static-local-in-local-class.cpp
index d9e044c..ebf560a 100644
--- a/test/CodeGenCXX/static-local-in-local-class.cpp
+++ b/test/CodeGenCXX/static-local-in-local-class.cpp
@@ -19,3 +19,15 @@ void X::f() {
}
(void)i;
}
+
+// pr7101
+void foo() {
+ static int n = 0;
+ struct Helper {
+ static void Execute() {
+ n++;
+ }
+ };
+ Helper::Execute();
+}
+
diff --git a/test/CodeGenCXX/template-linkage.cpp b/test/CodeGenCXX/template-linkage.cpp
index ccd61a7..63a5c09 100644
--- a/test/CodeGenCXX/template-linkage.cpp
+++ b/test/CodeGenCXX/template-linkage.cpp
@@ -22,3 +22,23 @@ template void f<int>(int);
template <typename T> inline void g(T) { }
template void g<int>(int);
+template<typename T>
+struct X0 {
+ virtual ~X0() { }
+};
+
+template<typename T>
+struct X1 : X0<T> {
+ virtual void blarg();
+};
+
+template<typename T> void X1<T>::blarg() { }
+
+extern template struct X0<char>;
+extern template struct X1<char>;
+
+// CHECK: define linkonce_odr void @_ZN2X1IcED1Ev(
+void test_X1() {
+ X1<char> i1c;
+}
+
diff --git a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp
new file mode 100644
index 0000000..9347cc9
--- /dev/null
+++ b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -emit-llvm -o - -fexceptions -triple x86_64-apple-darwin10 %s | FileCheck %s
+
+struct X {
+ X();
+ ~X();
+};
+
+struct Y { };
+
+// CHECK: define void @_Z1fv
+void f() {
+ // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZ1fvE1x)
+ // CHECK: invoke void @_ZN1XC1Ev
+ // CHECK: call void @__cxa_guard_release(i64* @_ZGVZ1fvE1x)
+ // CHECK: call i32 @__cxa_atexit
+ // CHECK: br
+ static X x;
+ // CHECK: call i8* @llvm.eh.exception()
+ // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector
+ // CHECK: call void @__cxa_guard_abort(i64* @_ZGVZ1fvE1x)
+ // CHECK: call void @_Unwind_Resume_or_Rethrow
+ // CHECK: unreachable
+
+ // CHECK: call i8* @__cxa_allocate_exception
+ throw Y();
+}
diff --git a/test/CodeGenCXX/thunks.cpp b/test/CodeGenCXX/thunks.cpp
index b91ba32..79ca709 100644
--- a/test/CodeGenCXX/thunks.cpp
+++ b/test/CodeGenCXX/thunks.cpp
@@ -86,9 +86,6 @@ void C::f() { }
}
-// This is from Test5:
-// CHECK: define linkonce_odr void @_ZTv0_n24_N5Test51B1fEv
-
// Check that the thunk gets internal linkage.
namespace {
@@ -106,7 +103,6 @@ struct C : A, B {
virtual void f();
};
-// CHECK: define internal void @_ZThn8_N12_GLOBAL__N_11C1fEv(
void C::f() { }
}
@@ -134,4 +130,112 @@ void f(B b) {
}
}
+namespace Test6 {
+ struct X {
+ X();
+ X(const X&);
+ X &operator=(const X&);
+ ~X();
+ };
+
+ struct P {
+ P();
+ P(const P&);
+ ~P();
+ X first;
+ X second;
+ };
+
+ P getP();
+
+ struct Base1 {
+ int i;
+
+ virtual X f() { return X(); }
+ };
+
+ struct Base2 {
+ float real;
+
+ virtual X f() { return X(); }
+ };
+
+ struct Thunks : Base1, Base2 {
+ long l;
+
+ virtual X f();
+ };
+
+ // CHECK: define void @_ZThn16_N5Test66Thunks1fEv
+ // CHECK-NOT: memcpy
+ // CHECK: {{call void @_ZN5Test66Thunks1fEv.*sret}}
+ // CHECK: ret void
+ X Thunks::f() { return X(); }
+}
+
+namespace Test7 {
+ // PR7188
+ struct X {
+ X();
+ X(const X&);
+ X &operator=(const X&);
+ ~X();
+ };
+
+ struct Small { short s; };
+ struct Large {
+ char array[1024];
+ };
+
+ class A {
+ protected:
+ virtual void foo() = 0;
+ };
+
+ class B : public A {
+ protected:
+ virtual void bar() = 0;
+ };
+
+ class C : public A {
+ protected:
+ virtual void baz(X, X&, _Complex float, Small, Small&, Large) = 0;
+ };
+
+ class D : public B,
+ public C {
+
+ void foo() {}
+ void bar() {}
+ void baz(X, X&, _Complex float, Small, Small&, Large);
+ };
+
+ void D::baz(X, X&, _Complex float, Small, Small&, Large) { }
+
+ // CHECK: define void @_ZThn8_N5Test71D3bazENS_1XERS1_CfNS_5SmallERS4_NS_5LargeE(
+ // CHECK-NOT: memcpy
+ // CHECK: ret void
+ void testD() { D d; }
+}
+
+namespace Test8 {
+ struct NonPOD { ~NonPOD(); int x, y, z; };
+ struct A { virtual void foo(); };
+ struct B { virtual void bar(NonPOD); };
+ struct C : A, B { virtual void bar(NonPOD); static void helper(NonPOD); };
+
+ // CHECK: define void @_ZN5Test81C6helperENS_6NonPODE([[NONPODTYPE:%.*]]*
+ void C::helper(NonPOD var) {}
+
+ // CHECK: define void @_ZThn8_N5Test81C3barENS_6NonPODE(
+ // CHECK-NOT: load [[NONPODTYPE]]*
+ // CHECK-NOT: memcpy
+ // CHECK: ret void
+ void C::bar(NonPOD var) {}
+}
+
+/**** The following has to go at the end of the file ****/
+// This is from Test5:
+// CHECK: define linkonce_odr void @_ZTv0_n24_N5Test51B1fEv
+// CHECK: define internal void @_ZThn8_N12_GLOBAL__N_11C1fEv(
diff --git a/test/CodeGenCXX/virtual-base-destructor-call.cpp b/test/CodeGenCXX/virtual-base-destructor-call.cpp
index 7de9dd2..22c49a0 100644
--- a/test/CodeGenCXX/virtual-base-destructor-call.cpp
+++ b/test/CodeGenCXX/virtual-base-destructor-call.cpp
@@ -49,3 +49,4 @@ int main() {
// CHECK: define linkonce_odr void @_ZN13basic_istreamIcED2Ev
// CHECK-NOT: call
// CHECK: }
+
diff --git a/test/CodeGenCXX/virtual-functions-incomplete-types.cpp b/test/CodeGenCXX/virtual-functions-incomplete-types.cpp
index 50e0435..991c2bc 100644
--- a/test/CodeGenCXX/virtual-functions-incomplete-types.cpp
+++ b/test/CodeGenCXX/virtual-functions-incomplete-types.cpp
@@ -9,6 +9,7 @@ struct B {
void B::f() { }
+// CHECK: define i64 @_ZN1D1gEv(%struct.B* %this)
// CHECK: declare void @_ZN1B1gEv()
struct C;
@@ -24,7 +25,6 @@ struct C {
int a;
};
-// CHECK: define i64 @_ZN1D1gEv(%struct.B* %this)
C D::g() {
return C();
}
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp
index f2f5179..60b46fe 100644
--- a/test/CodeGenCXX/vtable-layout.cpp
+++ b/test/CodeGenCXX/vtable-layout.cpp
@@ -1,4 +1,46 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts 2>&1 | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts > %t 2>&1
+// RUN: FileCheck --check-prefix=CHECK-1 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-2 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-3 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-4 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-5 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-6 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-7 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-8 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-9 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-10 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-11 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-12 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-13 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-14 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-15 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-16 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-17 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-18 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-19 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-20 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-21 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-22 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-23 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-24 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-25 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-26 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-27 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-28 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-29 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-30 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-31 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-32 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-33 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-34 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-35 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-36 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-37 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-38 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-39 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-40 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-41 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-42 %s < %t
// For now, just verify this doesn't crash.
namespace test0 {
@@ -11,11 +53,11 @@ namespace test0 {
}
namespace Test1 {
-// CHECK: Vtable for 'Test1::A' (3 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test1::A RTTI
-// CHECK-NEXT: -- (Test1::A, 0) vtable address --
-// CHECK-NEXT: 2 | void Test1::A::f()
+// CHECK-1: Vtable for 'Test1::A' (3 entries).
+// CHECK-1-NEXT: 0 | offset_to_top (0)
+// CHECK-1-NEXT: 1 | Test1::A RTTI
+// CHECK-1-NEXT: -- (Test1::A, 0) vtable address --
+// CHECK-1-NEXT: 2 | void Test1::A::f()
struct A {
virtual void f();
};
@@ -26,17 +68,17 @@ void A::f() { }
namespace Test2 {
// This is a smoke test of the vtable dumper.
-// CHECK: Vtable for 'Test2::A' (9 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test2::A RTTI
-// CHECK-NEXT: -- (Test2::A, 0) vtable address --
-// CHECK-NEXT: 2 | void Test2::A::f()
-// CHECK-NEXT: 3 | void Test2::A::f() const
-// CHECK-NEXT: 4 | Test2::A *Test2::A::g(int)
-// CHECK-NEXT: 5 | Test2::A::~A() [complete]
-// CHECK-NEXT: 6 | Test2::A::~A() [deleting]
-// CHECK-NEXT: 7 | void Test2::A::h()
-// CHECK-NEXT: 8 | Test2::A &Test2::A::operator=(Test2::A const &)
+// CHECK-2: Vtable for 'Test2::A' (9 entries).
+// CHECK-2-NEXT: 0 | offset_to_top (0)
+// CHECK-2-NEXT: 1 | Test2::A RTTI
+// CHECK-2-NEXT: -- (Test2::A, 0) vtable address --
+// CHECK-2-NEXT: 2 | void Test2::A::f()
+// CHECK-2-NEXT: 3 | void Test2::A::f() const
+// CHECK-2-NEXT: 4 | Test2::A *Test2::A::g(int)
+// CHECK-2-NEXT: 5 | Test2::A::~A() [complete]
+// CHECK-2-NEXT: 6 | Test2::A::~A() [deleting]
+// CHECK-2-NEXT: 7 | void Test2::A::h()
+// CHECK-2-NEXT: 8 | Test2::A &Test2::A::operator=(Test2::A const &)
struct A {
virtual void f();
virtual void f() const;
@@ -50,14 +92,14 @@ void A::f() { }
// Another simple vtable dumper test.
-// CHECK: Vtable for 'Test2::B' (6 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test2::B RTTI
-// CHECK-NEXT: -- (Test2::B, 0) vtable address --
-// CHECK-NEXT: 2 | void Test2::B::f()
-// CHECK-NEXT: 3 | void Test2::B::g() [pure]
-// CHECK-NEXT: 4 | Test2::B::~B() [complete] [pure]
-// CHECK-NEXT: 5 | Test2::B::~B() [deleting] [pure]
+// CHECK-3: Vtable for 'Test2::B' (6 entries).
+// CHECK-3-NEXT: 0 | offset_to_top (0)
+// CHECK-3-NEXT: 1 | Test2::B RTTI
+// CHECK-3-NEXT: -- (Test2::B, 0) vtable address --
+// CHECK-3-NEXT: 2 | void Test2::B::f()
+// CHECK-3-NEXT: 3 | void Test2::B::g() [pure]
+// CHECK-3-NEXT: 4 | Test2::B::~B() [complete] [pure]
+// CHECK-3-NEXT: 5 | Test2::B::~B() [deleting] [pure]
struct B {
virtual void f();
virtual void g() = 0;
@@ -73,52 +115,52 @@ namespace Test3 {
// then the function should not have an entry in the derived class (unless the return
// value requires adjusting).
-// CHECK: Vtable for 'Test3::A' (3 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test3::A RTTI
-// CHECK-NEXT: -- (Test3::A, 0) vtable address --
-// CHECK-NEXT: 2 | void Test3::A::f()
+// CHECK-4: Vtable for 'Test3::A' (3 entries).
+// CHECK-4-NEXT: 0 | offset_to_top (0)
+// CHECK-4-NEXT: 1 | Test3::A RTTI
+// CHECK-4-NEXT: -- (Test3::A, 0) vtable address --
+// CHECK-4-NEXT: 2 | void Test3::A::f()
struct A {
virtual void f();
};
void A::f() { }
-// CHECK: Vtable for 'Test3::B' (4 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test3::B RTTI
-// CHECK-NEXT: -- (Test3::A, 0) vtable address --
-// CHECK-NEXT: -- (Test3::B, 0) vtable address --
-// CHECK-NEXT: 2 | void Test3::B::f()
-// CHECK-NEXT: 3 | void Test3::B::g()
+// CHECK-5: Vtable for 'Test3::B' (4 entries).
+// CHECK-5-NEXT: 0 | offset_to_top (0)
+// CHECK-5-NEXT: 1 | Test3::B RTTI
+// CHECK-5-NEXT: -- (Test3::A, 0) vtable address --
+// CHECK-5-NEXT: -- (Test3::B, 0) vtable address --
+// CHECK-5-NEXT: 2 | void Test3::B::f()
+// CHECK-5-NEXT: 3 | void Test3::B::g()
struct B : A {
virtual void f();
virtual void g();
};
void B::f() { }
-// CHECK: Vtable for 'Test3::C' (5 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test3::C RTTI
-// CHECK-NEXT: -- (Test3::A, 0) vtable address --
-// CHECK-NEXT: -- (Test3::C, 0) vtable address --
-// CHECK-NEXT: 2 | void Test3::A::f()
-// CHECK-NEXT: 3 | void Test3::C::g()
-// CHECK-NEXT: 4 | void Test3::C::h()
+// CHECK-6: Vtable for 'Test3::C' (5 entries).
+// CHECK-6-NEXT: 0 | offset_to_top (0)
+// CHECK-6-NEXT: 1 | Test3::C RTTI
+// CHECK-6-NEXT: -- (Test3::A, 0) vtable address --
+// CHECK-6-NEXT: -- (Test3::C, 0) vtable address --
+// CHECK-6-NEXT: 2 | void Test3::A::f()
+// CHECK-6-NEXT: 3 | void Test3::C::g()
+// CHECK-6-NEXT: 4 | void Test3::C::h()
struct C : A {
virtual void g();
virtual void h();
};
void C::g() { }
-// CHECK: Vtable for 'Test3::D' (5 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test3::D RTTI
-// CHECK-NEXT: -- (Test3::A, 0) vtable address --
-// CHECK-NEXT: -- (Test3::B, 0) vtable address --
-// CHECK-NEXT: -- (Test3::D, 0) vtable address --
-// CHECK-NEXT: 2 | void Test3::D::f()
-// CHECK-NEXT: 3 | void Test3::D::g()
-// CHECK-NEXT: 4 | void Test3::D::h()
+// CHECK-7: Vtable for 'Test3::D' (5 entries).
+// CHECK-7-NEXT: 0 | offset_to_top (0)
+// CHECK-7-NEXT: 1 | Test3::D RTTI
+// CHECK-7-NEXT: -- (Test3::A, 0) vtable address --
+// CHECK-7-NEXT: -- (Test3::B, 0) vtable address --
+// CHECK-7-NEXT: -- (Test3::D, 0) vtable address --
+// CHECK-7-NEXT: 2 | void Test3::D::f()
+// CHECK-7-NEXT: 3 | void Test3::D::g()
+// CHECK-7-NEXT: 4 | void Test3::D::h()
struct D : B {
virtual void f();
virtual void g();
@@ -140,14 +182,14 @@ struct A {
virtual R2 *f();
};
-// CHECK: Vtable for 'Test4::B' (4 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test4::B RTTI
-// CHECK-NEXT: -- (Test4::A, 0) vtable address --
-// CHECK-NEXT: -- (Test4::B, 0) vtable address --
-// CHECK-NEXT: 2 | Test4::R3 *Test4::B::f()
-// CHECK-NEXT: [return adjustment: 4 non-virtual]
-// CHECK-NEXT: 3 | Test4::R3 *Test4::B::f()
+// CHECK-8: Vtable for 'Test4::B' (4 entries).
+// CHECK-8-NEXT: 0 | offset_to_top (0)
+// CHECK-8-NEXT: 1 | Test4::B RTTI
+// CHECK-8-NEXT: -- (Test4::A, 0) vtable address --
+// CHECK-8-NEXT: -- (Test4::B, 0) vtable address --
+// CHECK-8-NEXT: 2 | Test4::R3 *Test4::B::f()
+// CHECK-8-NEXT: [return adjustment: 4 non-virtual]
+// CHECK-8-NEXT: 3 | Test4::R3 *Test4::B::f()
struct B : A {
virtual R3 *f();
@@ -162,14 +204,14 @@ struct C {
virtual V1 *f();
};
-// CHECK: Vtable for 'Test4::D' (4 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test4::D RTTI
-// CHECK-NEXT: -- (Test4::C, 0) vtable address --
-// CHECK-NEXT: -- (Test4::D, 0) vtable address --
-// CHECK-NEXT: 2 | Test4::V2 *Test4::D::f()
-// CHECK-NEXT: [return adjustment: 0 non-virtual, -24 vbase offset offset]
-// CHECK-NEXT: 3 | Test4::V2 *Test4::D::f()
+// CHECK-9: Vtable for 'Test4::D' (4 entries).
+// CHECK-9-NEXT: 0 | offset_to_top (0)
+// CHECK-9-NEXT: 1 | Test4::D RTTI
+// CHECK-9-NEXT: -- (Test4::C, 0) vtable address --
+// CHECK-9-NEXT: -- (Test4::D, 0) vtable address --
+// CHECK-9-NEXT: 2 | Test4::V2 *Test4::D::f()
+// CHECK-9-NEXT: [return adjustment: 0 non-virtual, -24 vbase offset offset]
+// CHECK-9-NEXT: 3 | Test4::V2 *Test4::D::f()
struct D : C {
virtual V2 *f();
};
@@ -178,14 +220,14 @@ V2 *D::f() { return 0; };
// Virtual result adjustments with an additional non-virtual adjustment.
struct V3 : virtual R3 { int r3; };
-// CHECK: Vtable for 'Test4::E' (4 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test4::E RTTI
-// CHECK-NEXT: -- (Test4::A, 0) vtable address --
-// CHECK-NEXT: -- (Test4::E, 0) vtable address --
-// CHECK-NEXT: 2 | Test4::V3 *Test4::E::f()
-// CHECK-NEXT: [return adjustment: 4 non-virtual, -24 vbase offset offset]
-// CHECK-NEXT: 3 | Test4::V3 *Test4::E::f()
+// CHECK-10: Vtable for 'Test4::E' (4 entries).
+// CHECK-10-NEXT: 0 | offset_to_top (0)
+// CHECK-10-NEXT: 1 | Test4::E RTTI
+// CHECK-10-NEXT: -- (Test4::A, 0) vtable address --
+// CHECK-10-NEXT: -- (Test4::E, 0) vtable address --
+// CHECK-10-NEXT: 2 | Test4::V3 *Test4::E::f()
+// CHECK-10-NEXT: [return adjustment: 4 non-virtual, -24 vbase offset offset]
+// CHECK-10-NEXT: 3 | Test4::V3 *Test4::E::f()
struct E : A {
virtual V3 *f();
@@ -194,14 +236,14 @@ V3 *E::f() { return 0;}
// Test that a pure virtual member doesn't get a thunk.
-// CHECK: Vtable for 'Test4::F' (5 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test4::F RTTI
-// CHECK-NEXT: -- (Test4::A, 0) vtable address --
-// CHECK-NEXT: -- (Test4::F, 0) vtable address --
-// CHECK-NEXT: 2 | Test4::R3 *Test4::F::f() [pure]
-// CHECK-NEXT: 3 | void Test4::F::g()
-// CHECK-NEXT: 4 | Test4::R3 *Test4::F::f() [pure]
+// CHECK-11: Vtable for 'Test4::F' (5 entries).
+// CHECK-11-NEXT: 0 | offset_to_top (0)
+// CHECK-11-NEXT: 1 | Test4::F RTTI
+// CHECK-11-NEXT: -- (Test4::A, 0) vtable address --
+// CHECK-11-NEXT: -- (Test4::F, 0) vtable address --
+// CHECK-11-NEXT: 2 | Test4::R3 *Test4::F::f() [pure]
+// CHECK-11-NEXT: 3 | void Test4::F::g()
+// CHECK-11-NEXT: 4 | Test4::R3 *Test4::F::f() [pure]
struct F : A {
virtual void g();
virtual R3 *f() = 0;
@@ -229,21 +271,21 @@ struct B2 : A {
int b2;
};
-// CHECK: Vtable for 'Test5::C' (9 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test5::C RTTI
-// CHECK-NEXT: -- (Test5::A, 0) vtable address --
-// CHECK-NEXT: -- (Test5::B1, 0) vtable address --
-// CHECK-NEXT: -- (Test5::C, 0) vtable address --
-// CHECK-NEXT: 2 | void Test5::B1::f()
-// CHECK-NEXT: 3 | void Test5::A::g()
-// CHECK-NEXT: 4 | void Test5::C::h()
-// CHECK-NEXT: 5 | offset_to_top (-16)
-// CHECK-NEXT: 6 | Test5::C RTTI
-// CHECK-NEXT: -- (Test5::A, 16) vtable address --
-// CHECK-NEXT: -- (Test5::B2, 16) vtable address --
-// CHECK-NEXT: 7 | void Test5::A::f()
-// CHECK-NEXT: 8 | void Test5::B2::g()
+// CHECK-12: Vtable for 'Test5::C' (9 entries).
+// CHECK-12-NEXT: 0 | offset_to_top (0)
+// CHECK-12-NEXT: 1 | Test5::C RTTI
+// CHECK-12-NEXT: -- (Test5::A, 0) vtable address --
+// CHECK-12-NEXT: -- (Test5::B1, 0) vtable address --
+// CHECK-12-NEXT: -- (Test5::C, 0) vtable address --
+// CHECK-12-NEXT: 2 | void Test5::B1::f()
+// CHECK-12-NEXT: 3 | void Test5::A::g()
+// CHECK-12-NEXT: 4 | void Test5::C::h()
+// CHECK-12-NEXT: 5 | offset_to_top (-16)
+// CHECK-12-NEXT: 6 | Test5::C RTTI
+// CHECK-12-NEXT: -- (Test5::A, 16) vtable address --
+// CHECK-12-NEXT: -- (Test5::B2, 16) vtable address --
+// CHECK-12-NEXT: 7 | void Test5::A::f()
+// CHECK-12-NEXT: 8 | void Test5::B2::g()
struct C : B1, B2 {
virtual void h();
};
@@ -263,17 +305,17 @@ struct A2 {
int a;
};
-// CHECK: Vtable for 'Test6::C' (6 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test6::C RTTI
-// CHECK-NEXT: -- (Test6::A1, 0) vtable address --
-// CHECK-NEXT: -- (Test6::C, 0) vtable address --
-// CHECK-NEXT: 2 | void Test6::C::f()
-// CHECK-NEXT: 3 | offset_to_top (-16)
-// CHECK-NEXT: 4 | Test6::C RTTI
-// CHECK-NEXT: -- (Test6::A2, 16) vtable address --
-// CHECK-NEXT: 5 | void Test6::C::f()
-// CHECK-NEXT: [this adjustment: -16 non-virtual]
+// CHECK-13: Vtable for 'Test6::C' (6 entries).
+// CHECK-13-NEXT: 0 | offset_to_top (0)
+// CHECK-13-NEXT: 1 | Test6::C RTTI
+// CHECK-13-NEXT: -- (Test6::A1, 0) vtable address --
+// CHECK-13-NEXT: -- (Test6::C, 0) vtable address --
+// CHECK-13-NEXT: 2 | void Test6::C::f()
+// CHECK-13-NEXT: 3 | offset_to_top (-16)
+// CHECK-13-NEXT: 4 | Test6::C RTTI
+// CHECK-13-NEXT: -- (Test6::A2, 16) vtable address --
+// CHECK-13-NEXT: 5 | void Test6::C::f()
+// CHECK-13-NEXT: [this adjustment: -16 non-virtual]
struct C : A1, A2 {
virtual void f();
};
@@ -296,25 +338,25 @@ struct B2 : A { };
struct C { virtual void c(); };
-// CHECK: Vtable for 'Test7::D' (10 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test7::D RTTI
-// CHECK-NEXT: -- (Test7::C, 0) vtable address --
-// CHECK-NEXT: -- (Test7::D, 0) vtable address --
-// CHECK-NEXT: 2 | void Test7::C::c()
-// CHECK-NEXT: 3 | void Test7::D::f()
-// CHECK-NEXT: 4 | offset_to_top (-8)
-// CHECK-NEXT: 5 | Test7::D RTTI
-// CHECK-NEXT: -- (Test7::A, 8) vtable address --
-// CHECK-NEXT: -- (Test7::B1, 8) vtable address --
-// CHECK-NEXT: 6 | void Test7::D::f()
-// CHECK-NEXT: [this adjustment: -8 non-virtual]
-// CHECK-NEXT: 7 | offset_to_top (-24)
-// CHECK-NEXT: 8 | Test7::D RTTI
-// CHECK-NEXT: -- (Test7::A, 24) vtable address --
-// CHECK-NEXT: -- (Test7::B2, 24) vtable address --
-// CHECK-NEXT: 9 | void Test7::D::f()
-// CHECK-NEXT: [this adjustment: -24 non-virtual]
+// CHECK-14: Vtable for 'Test7::D' (10 entries).
+// CHECK-14-NEXT: 0 | offset_to_top (0)
+// CHECK-14-NEXT: 1 | Test7::D RTTI
+// CHECK-14-NEXT: -- (Test7::C, 0) vtable address --
+// CHECK-14-NEXT: -- (Test7::D, 0) vtable address --
+// CHECK-14-NEXT: 2 | void Test7::C::c()
+// CHECK-14-NEXT: 3 | void Test7::D::f()
+// CHECK-14-NEXT: 4 | offset_to_top (-8)
+// CHECK-14-NEXT: 5 | Test7::D RTTI
+// CHECK-14-NEXT: -- (Test7::A, 8) vtable address --
+// CHECK-14-NEXT: -- (Test7::B1, 8) vtable address --
+// CHECK-14-NEXT: 6 | void Test7::D::f()
+// CHECK-14-NEXT: [this adjustment: -8 non-virtual]
+// CHECK-14-NEXT: 7 | offset_to_top (-24)
+// CHECK-14-NEXT: 8 | Test7::D RTTI
+// CHECK-14-NEXT: -- (Test7::A, 24) vtable address --
+// CHECK-14-NEXT: -- (Test7::B2, 24) vtable address --
+// CHECK-14-NEXT: 9 | void Test7::D::f()
+// CHECK-14-NEXT: [this adjustment: -24 non-virtual]
struct D : C, B1, B2 {
virtual void f();
};
@@ -329,11 +371,11 @@ namespace Test8 {
struct A { };
-// CHECK: Vtable for 'Test8::B' (3 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test8::B RTTI
-// CHECK-NEXT: -- (Test8::B, 0) vtable address --
-// CHECK-NEXT: 2 | void Test8::B::f()
+// CHECK-15: Vtable for 'Test8::B' (3 entries).
+// CHECK-15-NEXT: 0 | offset_to_top (0)
+// CHECK-15-NEXT: 1 | Test8::B RTTI
+// CHECK-15-NEXT: -- (Test8::B, 0) vtable address --
+// CHECK-15-NEXT: 2 | void Test8::B::f()
struct B : A {
virtual void f();
};
@@ -348,13 +390,13 @@ namespace Test9 {
struct A1 { int a1; };
struct A2 { int a2; };
-// CHECK: Vtable for 'Test9::B' (5 entries).
-// CHECK-NEXT: 0 | vbase_offset (16)
-// CHECK-NEXT: 1 | vbase_offset (12)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test9::B RTTI
-// CHECK-NEXT: -- (Test9::B, 0) vtable address --
-// CHECK-NEXT: 4 | void Test9::B::f()
+// CHECK-16: Vtable for 'Test9::B' (5 entries).
+// CHECK-16-NEXT: 0 | vbase_offset (16)
+// CHECK-16-NEXT: 1 | vbase_offset (12)
+// CHECK-16-NEXT: 2 | offset_to_top (0)
+// CHECK-16-NEXT: 3 | Test9::B RTTI
+// CHECK-16-NEXT: -- (Test9::B, 0) vtable address --
+// CHECK-16-NEXT: 4 | void Test9::B::f()
struct B : virtual A1, virtual A2 {
int b;
@@ -373,18 +415,18 @@ namespace Test10 {
struct A1 { virtual void a1(); };
struct A2 { virtual void a2(); };
-// CHECK: Vtable for 'Test10::C' (7 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test10::C RTTI
-// CHECK-NEXT: -- (Test10::A1, 0) vtable address --
-// CHECK-NEXT: -- (Test10::B, 0) vtable address --
-// CHECK-NEXT: -- (Test10::C, 0) vtable address --
-// CHECK-NEXT: 2 | void Test10::A1::a1()
-// CHECK-NEXT: 3 | void Test10::C::f()
-// CHECK-NEXT: 4 | offset_to_top (-8)
-// CHECK-NEXT: 5 | Test10::C RTTI
-// CHECK-NEXT: -- (Test10::A2, 8) vtable address --
-// CHECK-NEXT: 6 | void Test10::A2::a2()
+// CHECK-17: Vtable for 'Test10::C' (7 entries).
+// CHECK-17-NEXT: 0 | offset_to_top (0)
+// CHECK-17-NEXT: 1 | Test10::C RTTI
+// CHECK-17-NEXT: -- (Test10::A1, 0) vtable address --
+// CHECK-17-NEXT: -- (Test10::B, 0) vtable address --
+// CHECK-17-NEXT: -- (Test10::C, 0) vtable address --
+// CHECK-17-NEXT: 2 | void Test10::A1::a1()
+// CHECK-17-NEXT: 3 | void Test10::C::f()
+// CHECK-17-NEXT: 4 | offset_to_top (-8)
+// CHECK-17-NEXT: 5 | Test10::C RTTI
+// CHECK-17-NEXT: -- (Test10::A2, 8) vtable address --
+// CHECK-17-NEXT: 6 | void Test10::A2::a2()
struct B : A1, A2 {
int b;
};
@@ -406,16 +448,16 @@ struct B : A1, virtual A2 {
int b;
};
-// CHECK: Vtable for 'Test11::C' (8 entries).
-// CHECK-NEXT: 0 | vbase_offset (24)
-// CHECK-NEXT: 1 | vbase_offset (8)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test11::C RTTI
-// CHECK-NEXT: -- (Test11::C, 0) vtable address --
-// CHECK-NEXT: 4 | void Test11::C::f()
-// CHECK-NEXT: 5 | vbase_offset (16)
-// CHECK-NEXT: 6 | offset_to_top (-8)
-// CHECK-NEXT: 7 | Test11::C RTTI
+// CHECK-18: Vtable for 'Test11::C' (8 entries).
+// CHECK-18-NEXT: 0 | vbase_offset (24)
+// CHECK-18-NEXT: 1 | vbase_offset (8)
+// CHECK-18-NEXT: 2 | offset_to_top (0)
+// CHECK-18-NEXT: 3 | Test11::C RTTI
+// CHECK-18-NEXT: -- (Test11::C, 0) vtable address --
+// CHECK-18-NEXT: 4 | void Test11::C::f()
+// CHECK-18-NEXT: 5 | vbase_offset (16)
+// CHECK-18-NEXT: 6 | offset_to_top (-8)
+// CHECK-18-NEXT: 7 | Test11::C RTTI
struct C : virtual B {
virtual void f();
};
@@ -427,32 +469,32 @@ namespace Test12 {
// Test that the right vcall offsets are generated in the right order.
-// CHECK: Vtable for 'Test12::B' (19 entries).
-// CHECK-NEXT: 0 | vbase_offset (8)
-// CHECK-NEXT: 1 | offset_to_top (0)
-// CHECK-NEXT: 2 | Test12::B RTTI
-// CHECK-NEXT: -- (Test12::B, 0) vtable address --
-// CHECK-NEXT: 3 | void Test12::B::f()
-// CHECK-NEXT: 4 | void Test12::B::a()
-// CHECK-NEXT: 5 | vcall_offset (32)
-// CHECK-NEXT: 6 | vcall_offset (16)
-// CHECK-NEXT: 7 | vcall_offset (-8)
-// CHECK-NEXT: 8 | vcall_offset (0)
-// CHECK-NEXT: 9 | offset_to_top (-8)
-// CHECK-NEXT: 10 | Test12::B RTTI
-// CHECK-NEXT: -- (Test12::A, 8) vtable address --
-// CHECK-NEXT: -- (Test12::A1, 8) vtable address --
-// CHECK-NEXT: 11 | void Test12::A1::a1()
-// CHECK-NEXT: 12 | void Test12::B::a()
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset]
-// CHECK-NEXT: 13 | offset_to_top (-24)
-// CHECK-NEXT: 14 | Test12::B RTTI
-// CHECK-NEXT: -- (Test12::A2, 24) vtable address --
-// CHECK-NEXT: 15 | void Test12::A2::a2()
-// CHECK-NEXT: 16 | offset_to_top (-40)
-// CHECK-NEXT: 17 | Test12::B RTTI
-// CHECK-NEXT: -- (Test12::A3, 40) vtable address --
-// CHECK-NEXT: 18 | void Test12::A3::a3()
+// CHECK-19: Vtable for 'Test12::B' (19 entries).
+// CHECK-19-NEXT: 0 | vbase_offset (8)
+// CHECK-19-NEXT: 1 | offset_to_top (0)
+// CHECK-19-NEXT: 2 | Test12::B RTTI
+// CHECK-19-NEXT: -- (Test12::B, 0) vtable address --
+// CHECK-19-NEXT: 3 | void Test12::B::f()
+// CHECK-19-NEXT: 4 | void Test12::B::a()
+// CHECK-19-NEXT: 5 | vcall_offset (32)
+// CHECK-19-NEXT: 6 | vcall_offset (16)
+// CHECK-19-NEXT: 7 | vcall_offset (-8)
+// CHECK-19-NEXT: 8 | vcall_offset (0)
+// CHECK-19-NEXT: 9 | offset_to_top (-8)
+// CHECK-19-NEXT: 10 | Test12::B RTTI
+// CHECK-19-NEXT: -- (Test12::A, 8) vtable address --
+// CHECK-19-NEXT: -- (Test12::A1, 8) vtable address --
+// CHECK-19-NEXT: 11 | void Test12::A1::a1()
+// CHECK-19-NEXT: 12 | void Test12::B::a()
+// CHECK-19-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset]
+// CHECK-19-NEXT: 13 | offset_to_top (-24)
+// CHECK-19-NEXT: 14 | Test12::B RTTI
+// CHECK-19-NEXT: -- (Test12::A2, 24) vtable address --
+// CHECK-19-NEXT: 15 | void Test12::A2::a2()
+// CHECK-19-NEXT: 16 | offset_to_top (-40)
+// CHECK-19-NEXT: 17 | Test12::B RTTI
+// CHECK-19-NEXT: -- (Test12::A3, 40) vtable address --
+// CHECK-19-NEXT: 18 | void Test12::A3::a3()
struct A1 {
virtual void a1();
int a;
@@ -493,16 +535,16 @@ struct B : virtual A {
virtual void f();
};
-// CHECK: Vtable for 'Test13::C' (6 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vbase_offset (0)
-// CHECK-NEXT: 2 | vcall_offset (0)
-// CHECK-NEXT: 3 | offset_to_top (0)
-// CHECK-NEXT: 4 | Test13::C RTTI
-// CHECK-NEXT: -- (Test13::A, 0) vtable address --
-// CHECK-NEXT: -- (Test13::B, 0) vtable address --
-// CHECK-NEXT: -- (Test13::C, 0) vtable address --
-// CHECK-NEXT: 5 | void Test13::C::f()
+// CHECK-20: Vtable for 'Test13::C' (6 entries).
+// CHECK-20-NEXT: 0 | vbase_offset (0)
+// CHECK-20-NEXT: 1 | vbase_offset (0)
+// CHECK-20-NEXT: 2 | vcall_offset (0)
+// CHECK-20-NEXT: 3 | offset_to_top (0)
+// CHECK-20-NEXT: 4 | Test13::C RTTI
+// CHECK-20-NEXT: -- (Test13::A, 0) vtable address --
+// CHECK-20-NEXT: -- (Test13::B, 0) vtable address --
+// CHECK-20-NEXT: -- (Test13::C, 0) vtable address --
+// CHECK-20-NEXT: 5 | void Test13::C::f()
struct C : virtual B, virtual A {
virtual void f();
};
@@ -522,16 +564,16 @@ struct B : A { };
struct C : virtual B { };
-// CHECK: Vtable for 'Test14::D' (5 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vcall_offset (0)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test14::D RTTI
-// CHECK-NEXT: -- (Test14::A, 0) vtable address --
-// CHECK-NEXT: -- (Test14::B, 0) vtable address --
-// CHECK-NEXT: -- (Test14::C, 0) vtable address --
-// CHECK-NEXT: -- (Test14::D, 0) vtable address --
-// CHECK-NEXT: 4 | void Test14::D::f()
+// CHECK-21: Vtable for 'Test14::D' (5 entries).
+// CHECK-21-NEXT: 0 | vbase_offset (0)
+// CHECK-21-NEXT: 1 | vcall_offset (0)
+// CHECK-21-NEXT: 2 | offset_to_top (0)
+// CHECK-21-NEXT: 3 | Test14::D RTTI
+// CHECK-21-NEXT: -- (Test14::A, 0) vtable address --
+// CHECK-21-NEXT: -- (Test14::B, 0) vtable address --
+// CHECK-21-NEXT: -- (Test14::C, 0) vtable address --
+// CHECK-21-NEXT: -- (Test14::D, 0) vtable address --
+// CHECK-21-NEXT: 4 | void Test14::D::f()
struct D : C, virtual B {
virtual void f();
};
@@ -547,22 +589,22 @@ struct B { virtual void b(); };
struct C : virtual B { };
-// CHECK: Vtable for 'Test15::D' (11 entries).
-// CHECK-NEXT: 0 | vbase_offset (8)
-// CHECK-NEXT: 1 | vbase_offset (8)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test15::D RTTI
-// CHECK-NEXT: -- (Test15::A, 0) vtable address --
-// CHECK-NEXT: -- (Test15::D, 0) vtable address --
-// CHECK-NEXT: 4 | void Test15::A::a()
-// CHECK-NEXT: 5 | void Test15::D::f()
-// CHECK-NEXT: 6 | vbase_offset (0)
-// CHECK-NEXT: 7 | vcall_offset (0)
-// CHECK-NEXT: 8 | offset_to_top (-8)
-// CHECK-NEXT: 9 | Test15::D RTTI
-// CHECK-NEXT: -- (Test15::B, 8) vtable address --
-// CHECK-NEXT: -- (Test15::C, 8) vtable address --
-// CHECK-NEXT: 10 | void Test15::B::b()
+// CHECK-22: Vtable for 'Test15::D' (11 entries).
+// CHECK-22-NEXT: 0 | vbase_offset (8)
+// CHECK-22-NEXT: 1 | vbase_offset (8)
+// CHECK-22-NEXT: 2 | offset_to_top (0)
+// CHECK-22-NEXT: 3 | Test15::D RTTI
+// CHECK-22-NEXT: -- (Test15::A, 0) vtable address --
+// CHECK-22-NEXT: -- (Test15::D, 0) vtable address --
+// CHECK-22-NEXT: 4 | void Test15::A::a()
+// CHECK-22-NEXT: 5 | void Test15::D::f()
+// CHECK-22-NEXT: 6 | vbase_offset (0)
+// CHECK-22-NEXT: 7 | vcall_offset (0)
+// CHECK-22-NEXT: 8 | offset_to_top (-8)
+// CHECK-22-NEXT: 9 | Test15::D RTTI
+// CHECK-22-NEXT: -- (Test15::B, 8) vtable address --
+// CHECK-22-NEXT: -- (Test15::C, 8) vtable address --
+// CHECK-22-NEXT: 10 | void Test15::B::b()
struct D : A, virtual B, virtual C {
virtual void f();
};
@@ -579,30 +621,30 @@ struct B { virtual ~B(); };
struct C : A, B { virtual ~C(); };
-// CHECK: Vtable for 'Test16::D' (15 entries).
-// CHECK-NEXT: 0 | vbase_offset (8)
-// CHECK-NEXT: 1 | offset_to_top (0)
-// CHECK-NEXT: 2 | Test16::D RTTI
-// CHECK-NEXT: -- (Test16::D, 0) vtable address --
-// CHECK-NEXT: 3 | void Test16::D::f()
-// CHECK-NEXT: 4 | Test16::D::~D() [complete]
-// CHECK-NEXT: 5 | Test16::D::~D() [deleting]
-// CHECK-NEXT: 6 | vcall_offset (-8)
-// CHECK-NEXT: 7 | offset_to_top (-8)
-// CHECK-NEXT: 8 | Test16::D RTTI
-// CHECK-NEXT: -- (Test16::A, 8) vtable address --
-// CHECK-NEXT: -- (Test16::C, 8) vtable address --
-// CHECK-NEXT: 9 | Test16::D::~D() [complete]
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
-// CHECK-NEXT: 10 | Test16::D::~D() [deleting]
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
-// CHECK-NEXT: 11 | offset_to_top (-16)
-// CHECK-NEXT: 12 | Test16::D RTTI
-// CHECK-NEXT: -- (Test16::B, 16) vtable address --
-// CHECK-NEXT: 13 | Test16::D::~D() [complete]
-// CHECK-NEXT: [this adjustment: -8 non-virtual, -24 vcall offset offset]
-// CHECK-NEXT: 14 | Test16::D::~D() [deleting]
-// CHECK-NEXT: [this adjustment: -8 non-virtual, -24 vcall offset offset]
+// CHECK-23: Vtable for 'Test16::D' (15 entries).
+// CHECK-23-NEXT: 0 | vbase_offset (8)
+// CHECK-23-NEXT: 1 | offset_to_top (0)
+// CHECK-23-NEXT: 2 | Test16::D RTTI
+// CHECK-23-NEXT: -- (Test16::D, 0) vtable address --
+// CHECK-23-NEXT: 3 | void Test16::D::f()
+// CHECK-23-NEXT: 4 | Test16::D::~D() [complete]
+// CHECK-23-NEXT: 5 | Test16::D::~D() [deleting]
+// CHECK-23-NEXT: 6 | vcall_offset (-8)
+// CHECK-23-NEXT: 7 | offset_to_top (-8)
+// CHECK-23-NEXT: 8 | Test16::D RTTI
+// CHECK-23-NEXT: -- (Test16::A, 8) vtable address --
+// CHECK-23-NEXT: -- (Test16::C, 8) vtable address --
+// CHECK-23-NEXT: 9 | Test16::D::~D() [complete]
+// CHECK-23-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-23-NEXT: 10 | Test16::D::~D() [deleting]
+// CHECK-23-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-23-NEXT: 11 | offset_to_top (-16)
+// CHECK-23-NEXT: 12 | Test16::D RTTI
+// CHECK-23-NEXT: -- (Test16::B, 16) vtable address --
+// CHECK-23-NEXT: 13 | Test16::D::~D() [complete]
+// CHECK-23-NEXT: [this adjustment: -8 non-virtual, -24 vcall offset offset]
+// CHECK-23-NEXT: 14 | Test16::D::~D() [deleting]
+// CHECK-23-NEXT: [this adjustment: -8 non-virtual, -24 vcall offset offset]
struct D : virtual C {
virtual void f();
};
@@ -618,26 +660,26 @@ struct B : virtual A { virtual void f(); };
struct C : virtual A { virtual void f(); };
struct D : virtual B, virtual C { virtual void f(); };
-// CHECK: Vtable for 'Test17::E' (13 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vbase_offset (8)
-// CHECK-NEXT: 2 | vbase_offset (0)
-// CHECK-NEXT: 3 | vbase_offset (0)
-// CHECK-NEXT: 4 | vcall_offset (0)
-// CHECK-NEXT: 5 | offset_to_top (0)
-// CHECK-NEXT: 6 | Test17::E RTTI
-// CHECK-NEXT: -- (Test17::A, 0) vtable address --
-// CHECK-NEXT: -- (Test17::B, 0) vtable address --
-// CHECK-NEXT: -- (Test17::D, 0) vtable address --
-// CHECK-NEXT: -- (Test17::E, 0) vtable address --
-// CHECK-NEXT: 7 | void Test17::E::f()
-// CHECK-NEXT: 8 | vbase_offset (-8)
-// CHECK-NEXT: 9 | vcall_offset (-8)
-// CHECK-NEXT: 10 | offset_to_top (-8)
-// CHECK-NEXT: 11 | Test17::E RTTI
-// CHECK-NEXT: -- (Test17::C, 8) vtable address --
-// CHECK-NEXT: 12 | void Test17::E::f()
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-24: Vtable for 'Test17::E' (13 entries).
+// CHECK-24-NEXT: 0 | vbase_offset (0)
+// CHECK-24-NEXT: 1 | vbase_offset (8)
+// CHECK-24-NEXT: 2 | vbase_offset (0)
+// CHECK-24-NEXT: 3 | vbase_offset (0)
+// CHECK-24-NEXT: 4 | vcall_offset (0)
+// CHECK-24-NEXT: 5 | offset_to_top (0)
+// CHECK-24-NEXT: 6 | Test17::E RTTI
+// CHECK-24-NEXT: -- (Test17::A, 0) vtable address --
+// CHECK-24-NEXT: -- (Test17::B, 0) vtable address --
+// CHECK-24-NEXT: -- (Test17::D, 0) vtable address --
+// CHECK-24-NEXT: -- (Test17::E, 0) vtable address --
+// CHECK-24-NEXT: 7 | void Test17::E::f()
+// CHECK-24-NEXT: 8 | vbase_offset (-8)
+// CHECK-24-NEXT: 9 | vcall_offset (-8)
+// CHECK-24-NEXT: 10 | offset_to_top (-8)
+// CHECK-24-NEXT: 11 | Test17::E RTTI
+// CHECK-24-NEXT: -- (Test17::C, 8) vtable address --
+// CHECK-24-NEXT: 12 | void Test17::E::f()
+// CHECK-24-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
class E : virtual D {
virtual void f();
};
@@ -662,97 +704,97 @@ struct C : A, B {
virtual void g();
};
-// CHECK: Vtable for 'Test18::D' (24 entries).
-// CHECK-NEXT: 0 | vbase_offset (8)
-// CHECK-NEXT: 1 | vbase_offset (0)
-// CHECK-NEXT: 2 | vbase_offset (0)
-// CHECK-NEXT: 3 | vcall_offset (8)
-// CHECK-NEXT: 4 | vcall_offset (0)
-// CHECK-NEXT: 5 | offset_to_top (0)
-// CHECK-NEXT: 6 | Test18::D RTTI
-// CHECK-NEXT: -- (Test18::A, 0) vtable address --
-// CHECK-NEXT: -- (Test18::B, 0) vtable address --
-// CHECK-NEXT: -- (Test18::D, 0) vtable address --
-// CHECK-NEXT: 7 | void Test18::D::f()
-// CHECK-NEXT: 8 | void Test18::C::g()
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset]
-// CHECK-NEXT: 9 | void Test18::D::h()
-// CHECK-NEXT: 10 | vcall_offset (0)
-// CHECK-NEXT: 11 | vcall_offset (-8)
-// CHECK-NEXT: 12 | vbase_offset (-8)
-// CHECK-NEXT: 13 | offset_to_top (-8)
-// CHECK-NEXT: 14 | Test18::D RTTI
-// CHECK-NEXT: -- (Test18::A, 8) vtable address --
-// CHECK-NEXT: -- (Test18::C, 8) vtable address --
-// CHECK-NEXT: 15 | void Test18::D::f()
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset]
-// CHECK-NEXT: 16 | void Test18::C::g()
-// CHECK-NEXT: 17 | vbase_offset (-16)
-// CHECK-NEXT: 18 | vcall_offset (-8)
-// CHECK-NEXT: 19 | vcall_offset (-16)
-// CHECK-NEXT: 20 | offset_to_top (-16)
-// CHECK-NEXT: 21 | Test18::D RTTI
-// CHECK-NEXT: -- (Test18::B, 16) vtable address --
-// CHECK-NEXT: 22 | void Test18::D::f()
-// CHECK-NEXT: [this adjustment: -8 non-virtual, -32 vcall offset offset]
-// CHECK-NEXT: 23 | [unused] void Test18::C::g()
-
-// CHECK: Construction vtable for ('Test18::B', 0) in 'Test18::D' (7 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vcall_offset (0)
-// CHECK-NEXT: 2 | vcall_offset (0)
-// CHECK-NEXT: 3 | offset_to_top (0)
-// CHECK-NEXT: 4 | Test18::B RTTI
-// CHECK-NEXT: -- (Test18::A, 0) vtable address --
-// CHECK-NEXT: -- (Test18::B, 0) vtable address --
-// CHECK-NEXT: 5 | void Test18::B::f()
-// CHECK-NEXT: 6 | void Test18::A::g()
-
-// CHECK: Construction vtable for ('Test18::C', 8) in 'Test18::D' (20 entries).
-// CHECK-NEXT: 0 | vcall_offset (0)
-// CHECK-NEXT: 1 | vcall_offset (0)
-// CHECK-NEXT: 2 | vbase_offset (-8)
-// CHECK-NEXT: 3 | offset_to_top (0)
-// CHECK-NEXT: 4 | Test18::C RTTI
-// CHECK-NEXT: -- (Test18::A, 8) vtable address --
-// CHECK-NEXT: -- (Test18::C, 8) vtable address --
-// CHECK-NEXT: 5 | void Test18::A::f()
-// CHECK-NEXT: 6 | void Test18::C::g()
-// CHECK-NEXT: 7 | vbase_offset (-16)
-// CHECK-NEXT: 8 | vcall_offset (-8)
-// CHECK-NEXT: 9 | vcall_offset (0)
-// CHECK-NEXT: 10 | offset_to_top (-8)
-// CHECK-NEXT: 11 | Test18::C RTTI
-// CHECK-NEXT: -- (Test18::B, 16) vtable address --
-// CHECK-NEXT: 12 | void Test18::B::f()
-// CHECK-NEXT: 13 | [unused] void Test18::C::g()
-// CHECK-NEXT: 14 | vcall_offset (8)
-// CHECK-NEXT: 15 | vcall_offset (16)
-// CHECK-NEXT: 16 | offset_to_top (8)
-// CHECK-NEXT: 17 | Test18::C RTTI
-// CHECK-NEXT: -- (Test18::A, 0) vtable address --
-// CHECK-NEXT: 18 | void Test18::B::f()
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
-// CHECK-NEXT: 19 | void Test18::C::g()
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset]
-
-// CHECK: Construction vtable for ('Test18::B', 16) in 'Test18::D' (13 entries).
-// CHECK-NEXT: 0 | vbase_offset (-16)
-// CHECK-NEXT: 1 | vcall_offset (-16)
-// CHECK-NEXT: 2 | vcall_offset (0)
-// CHECK-NEXT: 3 | offset_to_top (0)
-// CHECK-NEXT: 4 | Test18::B RTTI
-// CHECK-NEXT: -- (Test18::B, 16) vtable address --
-// CHECK-NEXT: 5 | void Test18::B::f()
-// CHECK-NEXT: 6 | [unused] void Test18::A::g()
-// CHECK-NEXT: 7 | vcall_offset (0)
-// CHECK-NEXT: 8 | vcall_offset (16)
-// CHECK-NEXT: 9 | offset_to_top (16)
-// CHECK-NEXT: 10 | Test18::B RTTI
-// CHECK-NEXT: -- (Test18::A, 0) vtable address --
-// CHECK-NEXT: 11 | void Test18::B::f()
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
-// CHECK-NEXT: 12 | void Test18::A::g()
+// CHECK-25: Vtable for 'Test18::D' (24 entries).
+// CHECK-25-NEXT: 0 | vbase_offset (8)
+// CHECK-25-NEXT: 1 | vbase_offset (0)
+// CHECK-25-NEXT: 2 | vbase_offset (0)
+// CHECK-25-NEXT: 3 | vcall_offset (8)
+// CHECK-25-NEXT: 4 | vcall_offset (0)
+// CHECK-25-NEXT: 5 | offset_to_top (0)
+// CHECK-25-NEXT: 6 | Test18::D RTTI
+// CHECK-25-NEXT: -- (Test18::A, 0) vtable address --
+// CHECK-25-NEXT: -- (Test18::B, 0) vtable address --
+// CHECK-25-NEXT: -- (Test18::D, 0) vtable address --
+// CHECK-25-NEXT: 7 | void Test18::D::f()
+// CHECK-25-NEXT: 8 | void Test18::C::g()
+// CHECK-25-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset]
+// CHECK-25-NEXT: 9 | void Test18::D::h()
+// CHECK-25-NEXT: 10 | vcall_offset (0)
+// CHECK-25-NEXT: 11 | vcall_offset (-8)
+// CHECK-25-NEXT: 12 | vbase_offset (-8)
+// CHECK-25-NEXT: 13 | offset_to_top (-8)
+// CHECK-25-NEXT: 14 | Test18::D RTTI
+// CHECK-25-NEXT: -- (Test18::A, 8) vtable address --
+// CHECK-25-NEXT: -- (Test18::C, 8) vtable address --
+// CHECK-25-NEXT: 15 | void Test18::D::f()
+// CHECK-25-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset]
+// CHECK-25-NEXT: 16 | void Test18::C::g()
+// CHECK-25-NEXT: 17 | vbase_offset (-16)
+// CHECK-25-NEXT: 18 | vcall_offset (-8)
+// CHECK-25-NEXT: 19 | vcall_offset (-16)
+// CHECK-25-NEXT: 20 | offset_to_top (-16)
+// CHECK-25-NEXT: 21 | Test18::D RTTI
+// CHECK-25-NEXT: -- (Test18::B, 16) vtable address --
+// CHECK-25-NEXT: 22 | void Test18::D::f()
+// CHECK-25-NEXT: [this adjustment: -8 non-virtual, -32 vcall offset offset]
+// CHECK-25-NEXT: 23 | [unused] void Test18::C::g()
+
+// CHECK-25: Construction vtable for ('Test18::B', 0) in 'Test18::D' (7 entries).
+// CHECK-25-NEXT: 0 | vbase_offset (0)
+// CHECK-25-NEXT: 1 | vcall_offset (0)
+// CHECK-25-NEXT: 2 | vcall_offset (0)
+// CHECK-25-NEXT: 3 | offset_to_top (0)
+// CHECK-25-NEXT: 4 | Test18::B RTTI
+// CHECK-25-NEXT: -- (Test18::A, 0) vtable address --
+// CHECK-25-NEXT: -- (Test18::B, 0) vtable address --
+// CHECK-25-NEXT: 5 | void Test18::B::f()
+// CHECK-25-NEXT: 6 | void Test18::A::g()
+
+// CHECK-25: Construction vtable for ('Test18::C', 8) in 'Test18::D' (20 entries).
+// CHECK-25-NEXT: 0 | vcall_offset (0)
+// CHECK-25-NEXT: 1 | vcall_offset (0)
+// CHECK-25-NEXT: 2 | vbase_offset (-8)
+// CHECK-25-NEXT: 3 | offset_to_top (0)
+// CHECK-25-NEXT: 4 | Test18::C RTTI
+// CHECK-25-NEXT: -- (Test18::A, 8) vtable address --
+// CHECK-25-NEXT: -- (Test18::C, 8) vtable address --
+// CHECK-25-NEXT: 5 | void Test18::A::f()
+// CHECK-25-NEXT: 6 | void Test18::C::g()
+// CHECK-25-NEXT: 7 | vbase_offset (-16)
+// CHECK-25-NEXT: 8 | vcall_offset (-8)
+// CHECK-25-NEXT: 9 | vcall_offset (0)
+// CHECK-25-NEXT: 10 | offset_to_top (-8)
+// CHECK-25-NEXT: 11 | Test18::C RTTI
+// CHECK-25-NEXT: -- (Test18::B, 16) vtable address --
+// CHECK-25-NEXT: 12 | void Test18::B::f()
+// CHECK-25-NEXT: 13 | [unused] void Test18::C::g()
+// CHECK-25-NEXT: 14 | vcall_offset (8)
+// CHECK-25-NEXT: 15 | vcall_offset (16)
+// CHECK-25-NEXT: 16 | offset_to_top (8)
+// CHECK-25-NEXT: 17 | Test18::C RTTI
+// CHECK-25-NEXT: -- (Test18::A, 0) vtable address --
+// CHECK-25-NEXT: 18 | void Test18::B::f()
+// CHECK-25-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-25-NEXT: 19 | void Test18::C::g()
+// CHECK-25-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset]
+
+// CHECK-25: Construction vtable for ('Test18::B', 16) in 'Test18::D' (13 entries).
+// CHECK-25-NEXT: 0 | vbase_offset (-16)
+// CHECK-25-NEXT: 1 | vcall_offset (-16)
+// CHECK-25-NEXT: 2 | vcall_offset (0)
+// CHECK-25-NEXT: 3 | offset_to_top (0)
+// CHECK-25-NEXT: 4 | Test18::B RTTI
+// CHECK-25-NEXT: -- (Test18::B, 16) vtable address --
+// CHECK-25-NEXT: 5 | void Test18::B::f()
+// CHECK-25-NEXT: 6 | [unused] void Test18::A::g()
+// CHECK-25-NEXT: 7 | vcall_offset (0)
+// CHECK-25-NEXT: 8 | vcall_offset (16)
+// CHECK-25-NEXT: 9 | offset_to_top (16)
+// CHECK-25-NEXT: 10 | Test18::B RTTI
+// CHECK-25-NEXT: -- (Test18::A, 0) vtable address --
+// CHECK-25-NEXT: 11 | void Test18::B::f()
+// CHECK-25-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-25-NEXT: 12 | void Test18::A::g()
struct D : virtual B, virtual C, virtual A
{
virtual void f();
@@ -782,27 +824,27 @@ struct C {
virtual void c();
};
-// CHECK: Vtable for 'Test19::D' (13 entries).
-// CHECK-NEXT: 0 | vbase_offset (24)
-// CHECK-NEXT: 1 | offset_to_top (0)
-// CHECK-NEXT: 2 | Test19::D RTTI
-// CHECK-NEXT: -- (Test19::C, 0) vtable address --
-// CHECK-NEXT: -- (Test19::D, 0) vtable address --
-// CHECK-NEXT: 3 | void Test19::C::c()
-// CHECK-NEXT: 4 | void Test19::D::f()
-// CHECK-NEXT: 5 | offset_to_top (-8)
-// CHECK-NEXT: 6 | Test19::D RTTI
-// CHECK-NEXT: -- (Test19::A, 8) vtable address --
-// CHECK-NEXT: -- (Test19::B, 8) vtable address --
-// CHECK-NEXT: 7 | void Test19::D::f()
-// CHECK-NEXT: [this adjustment: -8 non-virtual]
-// CHECK-NEXT: 8 | void Test19::B::g()
-// CHECK-NEXT: 9 | vcall_offset (-24)
-// CHECK-NEXT: 10 | offset_to_top (-24)
-// CHECK-NEXT: 11 | Test19::D RTTI
-// CHECK-NEXT: -- (Test19::A, 24) vtable address --
-// CHECK-NEXT: 12 | void Test19::D::f()
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-26: Vtable for 'Test19::D' (13 entries).
+// CHECK-26-NEXT: 0 | vbase_offset (24)
+// CHECK-26-NEXT: 1 | offset_to_top (0)
+// CHECK-26-NEXT: 2 | Test19::D RTTI
+// CHECK-26-NEXT: -- (Test19::C, 0) vtable address --
+// CHECK-26-NEXT: -- (Test19::D, 0) vtable address --
+// CHECK-26-NEXT: 3 | void Test19::C::c()
+// CHECK-26-NEXT: 4 | void Test19::D::f()
+// CHECK-26-NEXT: 5 | offset_to_top (-8)
+// CHECK-26-NEXT: 6 | Test19::D RTTI
+// CHECK-26-NEXT: -- (Test19::A, 8) vtable address --
+// CHECK-26-NEXT: -- (Test19::B, 8) vtable address --
+// CHECK-26-NEXT: 7 | void Test19::D::f()
+// CHECK-26-NEXT: [this adjustment: -8 non-virtual]
+// CHECK-26-NEXT: 8 | void Test19::B::g()
+// CHECK-26-NEXT: 9 | vcall_offset (-24)
+// CHECK-26-NEXT: 10 | offset_to_top (-24)
+// CHECK-26-NEXT: 11 | Test19::D RTTI
+// CHECK-26-NEXT: -- (Test19::A, 24) vtable address --
+// CHECK-26-NEXT: 12 | void Test19::D::f()
+// CHECK-26-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
struct D : C, B, virtual A {
virtual void f();
};
@@ -821,20 +863,20 @@ struct A {
struct B : A { };
-// CHECK: Vtable for 'Test20::C' (9 entries).
-// CHECK-NEXT: 0 | offset_to_top (0)
-// CHECK-NEXT: 1 | Test20::C RTTI
-// CHECK-NEXT: -- (Test20::A, 0) vtable address --
-// CHECK-NEXT: -- (Test20::C, 0) vtable address --
-// CHECK-NEXT: 2 | void Test20::C::f() [pure]
-// CHECK-NEXT: 3 | void Test20::A::g()
-// CHECK-NEXT: 4 | void Test20::C::h()
-// CHECK-NEXT: 5 | offset_to_top (-8)
-// CHECK-NEXT: 6 | Test20::C RTTI
-// CHECK-NEXT: -- (Test20::A, 8) vtable address --
-// CHECK-NEXT: -- (Test20::B, 8) vtable address --
-// CHECK-NEXT: 7 | void Test20::C::f() [pure]
-// CHECK-NEXT: 8 | void Test20::A::g()
+// CHECK-27: Vtable for 'Test20::C' (9 entries).
+// CHECK-27-NEXT: 0 | offset_to_top (0)
+// CHECK-27-NEXT: 1 | Test20::C RTTI
+// CHECK-27-NEXT: -- (Test20::A, 0) vtable address --
+// CHECK-27-NEXT: -- (Test20::C, 0) vtable address --
+// CHECK-27-NEXT: 2 | void Test20::C::f() [pure]
+// CHECK-27-NEXT: 3 | void Test20::A::g()
+// CHECK-27-NEXT: 4 | void Test20::C::h()
+// CHECK-27-NEXT: 5 | offset_to_top (-8)
+// CHECK-27-NEXT: 6 | Test20::C RTTI
+// CHECK-27-NEXT: -- (Test20::A, 8) vtable address --
+// CHECK-27-NEXT: -- (Test20::B, 8) vtable address --
+// CHECK-27-NEXT: 7 | void Test20::C::f() [pure]
+// CHECK-27-NEXT: 8 | void Test20::A::g()
struct C : A, B {
virtual void f() = 0;
virtual void h();
@@ -856,36 +898,36 @@ class D : virtual C { };
class E : virtual C { };
-// CHECK: Vtable for 'Test21::F' (16 entries).
-// CHECK-NEXT: 0 | vbase_offset (8)
-// CHECK-NEXT: 1 | vbase_offset (0)
-// CHECK-NEXT: 2 | vbase_offset (0)
-// CHECK-NEXT: 3 | vbase_offset (0)
-// CHECK-NEXT: 4 | vbase_offset (0)
-// CHECK-NEXT: 5 | vcall_offset (0)
-// CHECK-NEXT: 6 | offset_to_top (0)
-// CHECK-NEXT: 7 | Test21::F RTTI
-// CHECK-NEXT: -- (Test21::A, 0) vtable address --
-// CHECK-NEXT: -- (Test21::B, 0) vtable address --
-// CHECK-NEXT: -- (Test21::C, 0) vtable address --
-// CHECK-NEXT: -- (Test21::D, 0) vtable address --
-// CHECK-NEXT: -- (Test21::F, 0) vtable address --
-// CHECK-NEXT: 8 | void Test21::F::f()
-// CHECK-NEXT: 9 | vbase_offset (-8)
-// CHECK-NEXT: 10 | vbase_offset (-8)
-// CHECK-NEXT: 11 | vbase_offset (-8)
-// CHECK-NEXT: 12 | vcall_offset (-8)
-// CHECK-NEXT: 13 | offset_to_top (-8)
-// CHECK-NEXT: 14 | Test21::F RTTI
-// CHECK-NEXT: -- (Test21::E, 8) vtable address --
-// CHECK-NEXT: 15 | [unused] void Test21::F::f()
+// CHECK-28: Vtable for 'Test21::F' (16 entries).
+// CHECK-28-NEXT: 0 | vbase_offset (8)
+// CHECK-28-NEXT: 1 | vbase_offset (0)
+// CHECK-28-NEXT: 2 | vbase_offset (0)
+// CHECK-28-NEXT: 3 | vbase_offset (0)
+// CHECK-28-NEXT: 4 | vbase_offset (0)
+// CHECK-28-NEXT: 5 | vcall_offset (0)
+// CHECK-28-NEXT: 6 | offset_to_top (0)
+// CHECK-28-NEXT: 7 | Test21::F RTTI
+// CHECK-28-NEXT: -- (Test21::A, 0) vtable address --
+// CHECK-28-NEXT: -- (Test21::B, 0) vtable address --
+// CHECK-28-NEXT: -- (Test21::C, 0) vtable address --
+// CHECK-28-NEXT: -- (Test21::D, 0) vtable address --
+// CHECK-28-NEXT: -- (Test21::F, 0) vtable address --
+// CHECK-28-NEXT: 8 | void Test21::F::f()
+// CHECK-28-NEXT: 9 | vbase_offset (-8)
+// CHECK-28-NEXT: 10 | vbase_offset (-8)
+// CHECK-28-NEXT: 11 | vbase_offset (-8)
+// CHECK-28-NEXT: 12 | vcall_offset (-8)
+// CHECK-28-NEXT: 13 | offset_to_top (-8)
+// CHECK-28-NEXT: 14 | Test21::F RTTI
+// CHECK-28-NEXT: -- (Test21::E, 8) vtable address --
+// CHECK-28-NEXT: 15 | [unused] void Test21::F::f()
//
-// CHECK: Virtual base offset offsets for 'Test21::F' (5 entries).
-// CHECK-NEXT: Test21::A | -32
-// CHECK-NEXT: Test21::B | -40
-// CHECK-NEXT: Test21::C | -48
-// CHECK-NEXT: Test21::D | -56
-// CHECK-NEXT: Test21::E | -64
+// CHECK-28: Virtual base offset offsets for 'Test21::F' (5 entries).
+// CHECK-28-NEXT: Test21::A | -32
+// CHECK-28-NEXT: Test21::B | -40
+// CHECK-28-NEXT: Test21::C | -48
+// CHECK-28-NEXT: Test21::D | -56
+// CHECK-28-NEXT: Test21::E | -64
class F : virtual D, virtual E {
virtual void f();
};
@@ -904,22 +946,22 @@ struct V2 : virtual V1 {
int v2;
};
-// CHECK: Vtable for 'Test22::C' (8 entries).
-// CHECK-NEXT: 0 | vbase_offset (16)
-// CHECK-NEXT: 1 | vbase_offset (12)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test22::C RTTI
-// CHECK-NEXT: -- (Test22::C, 0) vtable address --
-// CHECK-NEXT: 4 | void Test22::C::f()
-// CHECK-NEXT: 5 | vbase_offset (-4)
-// CHECK-NEXT: 6 | offset_to_top (-16)
-// CHECK-NEXT: 7 | Test22::C RTTI
-// CHECK-NEXT: -- (Test22::V2, 16) vtable address --
+// CHECK-29: Vtable for 'Test22::C' (8 entries).
+// CHECK-29-NEXT: 0 | vbase_offset (16)
+// CHECK-29-NEXT: 1 | vbase_offset (12)
+// CHECK-29-NEXT: 2 | offset_to_top (0)
+// CHECK-29-NEXT: 3 | Test22::C RTTI
+// CHECK-29-NEXT: -- (Test22::C, 0) vtable address --
+// CHECK-29-NEXT: 4 | void Test22::C::f()
+// CHECK-29-NEXT: 5 | vbase_offset (-4)
+// CHECK-29-NEXT: 6 | offset_to_top (-16)
+// CHECK-29-NEXT: 7 | Test22::C RTTI
+// CHECK-29-NEXT: -- (Test22::V2, 16) vtable address --
-// CHECK: Construction vtable for ('Test22::V2', 16) in 'Test22::C' (3 entries).
-// CHECK-NEXT: 0 | vbase_offset (-4)
-// CHECK-NEXT: 1 | offset_to_top (0)
-// CHECK-NEXT: 2 | Test22::V2 RTTI
+// CHECK-29: Construction vtable for ('Test22::V2', 16) in 'Test22::C' (3 entries).
+// CHECK-29-NEXT: 0 | vbase_offset (-4)
+// CHECK-29-NEXT: 1 | offset_to_top (0)
+// CHECK-29-NEXT: 2 | Test22::V2 RTTI
struct C : virtual V1, virtual V2 {
int c;
@@ -943,34 +985,34 @@ struct C : A, virtual B {
int c;
};
-// CHECK: Vtable for 'Test23::D' (7 entries).
-// CHECK-NEXT: 0 | vbase_offset (20)
-// CHECK-NEXT: 1 | vbase_offset (24)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test23::D RTTI
-// CHECK-NEXT: -- (Test23::C, 0) vtable address --
-// CHECK-NEXT: -- (Test23::D, 0) vtable address --
-// CHECK-NEXT: 4 | vbase_offset (-4)
-// CHECK-NEXT: 5 | offset_to_top (-24)
-// CHECK-NEXT: 6 | Test23::D RTTI
-// CHECK-NEXT: -- (Test23::B, 24) vtable address --
-
-// CHECK: Construction vtable for ('Test23::C', 0) in 'Test23::D' (7 entries).
-// CHECK-NEXT: 0 | vbase_offset (20)
-// CHECK-NEXT: 1 | vbase_offset (24)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test23::C RTTI
-// CHECK-NEXT: -- (Test23::C, 0) vtable address --
-// CHECK-NEXT: 4 | vbase_offset (-4)
-// CHECK-NEXT: 5 | offset_to_top (-24)
-// CHECK-NEXT: 6 | Test23::C RTTI
-// CHECK-NEXT: -- (Test23::B, 24) vtable address --
-
-// CHECK: Construction vtable for ('Test23::B', 24) in 'Test23::D' (3 entries).
-// CHECK-NEXT: 0 | vbase_offset (-4)
-// CHECK-NEXT: 1 | offset_to_top (0)
-// CHECK-NEXT: 2 | Test23::B RTTI
-// CHECK-NEXT: -- (Test23::B, 24) vtable address --
+// CHECK-30: Vtable for 'Test23::D' (7 entries).
+// CHECK-30-NEXT: 0 | vbase_offset (20)
+// CHECK-30-NEXT: 1 | vbase_offset (24)
+// CHECK-30-NEXT: 2 | offset_to_top (0)
+// CHECK-30-NEXT: 3 | Test23::D RTTI
+// CHECK-30-NEXT: -- (Test23::C, 0) vtable address --
+// CHECK-30-NEXT: -- (Test23::D, 0) vtable address --
+// CHECK-30-NEXT: 4 | vbase_offset (-4)
+// CHECK-30-NEXT: 5 | offset_to_top (-24)
+// CHECK-30-NEXT: 6 | Test23::D RTTI
+// CHECK-30-NEXT: -- (Test23::B, 24) vtable address --
+
+// CHECK-30: Construction vtable for ('Test23::C', 0) in 'Test23::D' (7 entries).
+// CHECK-30-NEXT: 0 | vbase_offset (20)
+// CHECK-30-NEXT: 1 | vbase_offset (24)
+// CHECK-30-NEXT: 2 | offset_to_top (0)
+// CHECK-30-NEXT: 3 | Test23::C RTTI
+// CHECK-30-NEXT: -- (Test23::C, 0) vtable address --
+// CHECK-30-NEXT: 4 | vbase_offset (-4)
+// CHECK-30-NEXT: 5 | offset_to_top (-24)
+// CHECK-30-NEXT: 6 | Test23::C RTTI
+// CHECK-30-NEXT: -- (Test23::B, 24) vtable address --
+
+// CHECK-30: Construction vtable for ('Test23::B', 24) in 'Test23::D' (3 entries).
+// CHECK-30-NEXT: 0 | vbase_offset (-4)
+// CHECK-30-NEXT: 1 | offset_to_top (0)
+// CHECK-30-NEXT: 2 | Test23::B RTTI
+// CHECK-30-NEXT: -- (Test23::B, 24) vtable address --
struct D : virtual A, virtual B, C {
int d;
@@ -978,7 +1020,7 @@ struct D : virtual A, virtual B, C {
void f();
};
void D::f() { }
-
+ D d;
}
namespace Test24 {
@@ -992,43 +1034,43 @@ struct A {
struct B : virtual A { };
struct C : virtual A { };
-// CHECK: Vtable for 'Test24::D' (10 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vcall_offset (0)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test24::D RTTI
-// CHECK-NEXT: -- (Test24::A, 0) vtable address --
-// CHECK-NEXT: -- (Test24::B, 0) vtable address --
-// CHECK-NEXT: -- (Test24::D, 0) vtable address --
-// CHECK-NEXT: 4 | void Test24::D::f()
-// CHECK-NEXT: 5 | vbase_offset (-8)
-// CHECK-NEXT: 6 | vcall_offset (-8)
-// CHECK-NEXT: 7 | offset_to_top (-8)
-// CHECK-NEXT: 8 | Test24::D RTTI
-// CHECK-NEXT: -- (Test24::C, 8) vtable address --
-// CHECK-NEXT: 9 | [unused] void Test24::D::f()
-
-// CHECK: Construction vtable for ('Test24::B', 0) in 'Test24::D' (5 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vcall_offset (0)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test24::B RTTI
-// CHECK-NEXT: -- (Test24::A, 0) vtable address --
-// CHECK-NEXT: -- (Test24::B, 0) vtable address --
-// CHECK-NEXT: 4 | void Test24::A::f()
-
-// CHECK: Construction vtable for ('Test24::C', 8) in 'Test24::D' (9 entries).
-// CHECK-NEXT: 0 | vbase_offset (-8)
-// CHECK-NEXT: 1 | vcall_offset (-8)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test24::C RTTI
-// CHECK-NEXT: -- (Test24::C, 8) vtable address --
-// CHECK-NEXT: 4 | [unused] void Test24::A::f()
-// CHECK-NEXT: 5 | vcall_offset (0)
-// CHECK-NEXT: 6 | offset_to_top (8)
-// CHECK-NEXT: 7 | Test24::C RTTI
-// CHECK-NEXT: -- (Test24::A, 0) vtable address --
-// CHECK-NEXT: 8 | void Test24::A::f()
+// CHECK-31: Vtable for 'Test24::D' (10 entries).
+// CHECK-31-NEXT: 0 | vbase_offset (0)
+// CHECK-31-NEXT: 1 | vcall_offset (0)
+// CHECK-31-NEXT: 2 | offset_to_top (0)
+// CHECK-31-NEXT: 3 | Test24::D RTTI
+// CHECK-31-NEXT: -- (Test24::A, 0) vtable address --
+// CHECK-31-NEXT: -- (Test24::B, 0) vtable address --
+// CHECK-31-NEXT: -- (Test24::D, 0) vtable address --
+// CHECK-31-NEXT: 4 | void Test24::D::f()
+// CHECK-31-NEXT: 5 | vbase_offset (-8)
+// CHECK-31-NEXT: 6 | vcall_offset (-8)
+// CHECK-31-NEXT: 7 | offset_to_top (-8)
+// CHECK-31-NEXT: 8 | Test24::D RTTI
+// CHECK-31-NEXT: -- (Test24::C, 8) vtable address --
+// CHECK-31-NEXT: 9 | [unused] void Test24::D::f()
+
+// CHECK-31: Construction vtable for ('Test24::B', 0) in 'Test24::D' (5 entries).
+// CHECK-31-NEXT: 0 | vbase_offset (0)
+// CHECK-31-NEXT: 1 | vcall_offset (0)
+// CHECK-31-NEXT: 2 | offset_to_top (0)
+// CHECK-31-NEXT: 3 | Test24::B RTTI
+// CHECK-31-NEXT: -- (Test24::A, 0) vtable address --
+// CHECK-31-NEXT: -- (Test24::B, 0) vtable address --
+// CHECK-31-NEXT: 4 | void Test24::A::f()
+
+// CHECK-31: Construction vtable for ('Test24::C', 8) in 'Test24::D' (9 entries).
+// CHECK-31-NEXT: 0 | vbase_offset (-8)
+// CHECK-31-NEXT: 1 | vcall_offset (-8)
+// CHECK-31-NEXT: 2 | offset_to_top (0)
+// CHECK-31-NEXT: 3 | Test24::C RTTI
+// CHECK-31-NEXT: -- (Test24::C, 8) vtable address --
+// CHECK-31-NEXT: 4 | [unused] void Test24::A::f()
+// CHECK-31-NEXT: 5 | vcall_offset (0)
+// CHECK-31-NEXT: 6 | offset_to_top (8)
+// CHECK-31-NEXT: 7 | Test24::C RTTI
+// CHECK-31-NEXT: -- (Test24::A, 0) vtable address --
+// CHECK-31-NEXT: 8 | void Test24::A::f()
struct D : B, C {
virtual void f();
};
@@ -1047,44 +1089,44 @@ struct V {
struct A : virtual V { };
struct B : virtual V { };
-// CHECK: Vtable for 'Test25::C' (11 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vcall_offset (0)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test25::C RTTI
-// CHECK-NEXT: -- (Test25::A, 0) vtable address --
-// CHECK-NEXT: -- (Test25::C, 0) vtable address --
-// CHECK-NEXT: -- (Test25::V, 0) vtable address --
-// CHECK-NEXT: 4 | void Test25::V::f()
-// CHECK-NEXT: 5 | void Test25::C::g()
-// CHECK-NEXT: 6 | vbase_offset (-8)
-// CHECK-NEXT: 7 | vcall_offset (-8)
-// CHECK-NEXT: 8 | offset_to_top (-8)
-// CHECK-NEXT: 9 | Test25::C RTTI
-// CHECK-NEXT: -- (Test25::B, 8) vtable address --
-// CHECK-NEXT: 10 | [unused] void Test25::V::f()
-
-// CHECK: Construction vtable for ('Test25::A', 0) in 'Test25::C' (5 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vcall_offset (0)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test25::A RTTI
-// CHECK-NEXT: -- (Test25::A, 0) vtable address --
-// CHECK-NEXT: -- (Test25::V, 0) vtable address --
-// CHECK-NEXT: 4 | void Test25::V::f()
-
-// CHECK: Construction vtable for ('Test25::B', 8) in 'Test25::C' (9 entries).
-// CHECK-NEXT: 0 | vbase_offset (-8)
-// CHECK-NEXT: 1 | vcall_offset (-8)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test25::B RTTI
-// CHECK-NEXT: -- (Test25::B, 8) vtable address --
-// CHECK-NEXT: 4 | [unused] void Test25::V::f()
-// CHECK-NEXT: 5 | vcall_offset (0)
-// CHECK-NEXT: 6 | offset_to_top (8)
-// CHECK-NEXT: 7 | Test25::B RTTI
-// CHECK-NEXT: -- (Test25::V, 0) vtable address --
-// CHECK-NEXT: 8 | void Test25::V::f()
+// CHECK-32: Vtable for 'Test25::C' (11 entries).
+// CHECK-32-NEXT: 0 | vbase_offset (0)
+// CHECK-32-NEXT: 1 | vcall_offset (0)
+// CHECK-32-NEXT: 2 | offset_to_top (0)
+// CHECK-32-NEXT: 3 | Test25::C RTTI
+// CHECK-32-NEXT: -- (Test25::A, 0) vtable address --
+// CHECK-32-NEXT: -- (Test25::C, 0) vtable address --
+// CHECK-32-NEXT: -- (Test25::V, 0) vtable address --
+// CHECK-32-NEXT: 4 | void Test25::V::f()
+// CHECK-32-NEXT: 5 | void Test25::C::g()
+// CHECK-32-NEXT: 6 | vbase_offset (-8)
+// CHECK-32-NEXT: 7 | vcall_offset (-8)
+// CHECK-32-NEXT: 8 | offset_to_top (-8)
+// CHECK-32-NEXT: 9 | Test25::C RTTI
+// CHECK-32-NEXT: -- (Test25::B, 8) vtable address --
+// CHECK-32-NEXT: 10 | [unused] void Test25::V::f()
+
+// CHECK-32: Construction vtable for ('Test25::A', 0) in 'Test25::C' (5 entries).
+// CHECK-32-NEXT: 0 | vbase_offset (0)
+// CHECK-32-NEXT: 1 | vcall_offset (0)
+// CHECK-32-NEXT: 2 | offset_to_top (0)
+// CHECK-32-NEXT: 3 | Test25::A RTTI
+// CHECK-32-NEXT: -- (Test25::A, 0) vtable address --
+// CHECK-32-NEXT: -- (Test25::V, 0) vtable address --
+// CHECK-32-NEXT: 4 | void Test25::V::f()
+
+// CHECK-32: Construction vtable for ('Test25::B', 8) in 'Test25::C' (9 entries).
+// CHECK-32-NEXT: 0 | vbase_offset (-8)
+// CHECK-32-NEXT: 1 | vcall_offset (-8)
+// CHECK-32-NEXT: 2 | offset_to_top (0)
+// CHECK-32-NEXT: 3 | Test25::B RTTI
+// CHECK-32-NEXT: -- (Test25::B, 8) vtable address --
+// CHECK-32-NEXT: 4 | [unused] void Test25::V::f()
+// CHECK-32-NEXT: 5 | vcall_offset (0)
+// CHECK-32-NEXT: 6 | offset_to_top (8)
+// CHECK-32-NEXT: 7 | Test25::B RTTI
+// CHECK-32-NEXT: -- (Test25::V, 0) vtable address --
+// CHECK-32-NEXT: 8 | void Test25::V::f()
struct C : A, virtual V, B {
virtual void g();
};
@@ -1109,37 +1151,37 @@ struct C : virtual A {
virtual void b();
};
-// CHECK: Vtable for 'Test26::D' (15 entries).
-// CHECK-NEXT: 0 | vbase_offset (8)
-// CHECK-NEXT: 1 | vbase_offset (8)
-// CHECK-NEXT: 2 | vbase_offset (0)
-// CHECK-NEXT: 3 | vcall_offset (0)
-// CHECK-NEXT: 4 | offset_to_top (0)
-// CHECK-NEXT: 5 | Test26::D RTTI
-// CHECK-NEXT: -- (Test26::B, 0) vtable address --
-// CHECK-NEXT: -- (Test26::D, 0) vtable address --
-// CHECK-NEXT: 6 | void Test26::B::c()
-// CHECK-NEXT: 7 | void Test26::D::d()
-// CHECK-NEXT: 8 | vcall_offset (0)
-// CHECK-NEXT: 9 | vbase_offset (0)
-// CHECK-NEXT: 10 | vcall_offset (0)
-// CHECK-NEXT: 11 | offset_to_top (-8)
-// CHECK-NEXT: 12 | Test26::D RTTI
-// CHECK-NEXT: -- (Test26::A, 8) vtable address --
-// CHECK-NEXT: -- (Test26::C, 8) vtable address --
-// CHECK-NEXT: 13 | void Test26::A::a()
-// CHECK-NEXT: 14 | void Test26::C::b()
-
-// CHECK: Construction vtable for ('Test26::C', 8) in 'Test26::D' (7 entries).
-// CHECK-NEXT: 0 | vcall_offset (0)
-// CHECK-NEXT: 1 | vbase_offset (0)
-// CHECK-NEXT: 2 | vcall_offset (0)
-// CHECK-NEXT: 3 | offset_to_top (0)
-// CHECK-NEXT: 4 | Test26::C RTTI
-// CHECK-NEXT: -- (Test26::A, 8) vtable address --
-// CHECK-NEXT: -- (Test26::C, 8) vtable address --
-// CHECK-NEXT: 5 | void Test26::A::a()
-// CHECK-NEXT: 6 | void Test26::C::b()
+// CHECK-33: Vtable for 'Test26::D' (15 entries).
+// CHECK-33-NEXT: 0 | vbase_offset (8)
+// CHECK-33-NEXT: 1 | vbase_offset (8)
+// CHECK-33-NEXT: 2 | vbase_offset (0)
+// CHECK-33-NEXT: 3 | vcall_offset (0)
+// CHECK-33-NEXT: 4 | offset_to_top (0)
+// CHECK-33-NEXT: 5 | Test26::D RTTI
+// CHECK-33-NEXT: -- (Test26::B, 0) vtable address --
+// CHECK-33-NEXT: -- (Test26::D, 0) vtable address --
+// CHECK-33-NEXT: 6 | void Test26::B::c()
+// CHECK-33-NEXT: 7 | void Test26::D::d()
+// CHECK-33-NEXT: 8 | vcall_offset (0)
+// CHECK-33-NEXT: 9 | vbase_offset (0)
+// CHECK-33-NEXT: 10 | vcall_offset (0)
+// CHECK-33-NEXT: 11 | offset_to_top (-8)
+// CHECK-33-NEXT: 12 | Test26::D RTTI
+// CHECK-33-NEXT: -- (Test26::A, 8) vtable address --
+// CHECK-33-NEXT: -- (Test26::C, 8) vtable address --
+// CHECK-33-NEXT: 13 | void Test26::A::a()
+// CHECK-33-NEXT: 14 | void Test26::C::b()
+
+// CHECK-33: Construction vtable for ('Test26::C', 8) in 'Test26::D' (7 entries).
+// CHECK-33-NEXT: 0 | vcall_offset (0)
+// CHECK-33-NEXT: 1 | vbase_offset (0)
+// CHECK-33-NEXT: 2 | vcall_offset (0)
+// CHECK-33-NEXT: 3 | offset_to_top (0)
+// CHECK-33-NEXT: 4 | Test26::C RTTI
+// CHECK-33-NEXT: -- (Test26::A, 8) vtable address --
+// CHECK-33-NEXT: -- (Test26::C, 8) vtable address --
+// CHECK-33-NEXT: 5 | void Test26::A::a()
+// CHECK-33-NEXT: 6 | void Test26::C::b()
class D : virtual B, virtual C {
virtual void d();
};
@@ -1168,39 +1210,39 @@ struct D : A, virtual B, C {
virtual void d();
};
-// CHECK: Vtable for 'Test27::E' (13 entries).
-// CHECK-NEXT: 0 | vbase_offset (16)
-// CHECK-NEXT: 1 | offset_to_top (0)
-// CHECK-NEXT: 2 | Test27::E RTTI
-// CHECK-NEXT: -- (Test27::A, 0) vtable address --
-// CHECK-NEXT: -- (Test27::D, 0) vtable address --
-// CHECK-NEXT: -- (Test27::E, 0) vtable address --
-// CHECK-NEXT: 3 | void Test27::A::a()
-// CHECK-NEXT: 4 | void Test27::D::d()
-// CHECK-NEXT: 5 | void Test27::E::e()
-// CHECK-NEXT: 6 | offset_to_top (-8)
-// CHECK-NEXT: 7 | Test27::E RTTI
-// CHECK-NEXT: -- (Test27::C, 8) vtable address --
-// CHECK-NEXT: 8 | void Test27::C::c()
-// CHECK-NEXT: 9 | vcall_offset (0)
-// CHECK-NEXT: 10 | offset_to_top (-16)
-// CHECK-NEXT: 11 | Test27::E RTTI
-// CHECK-NEXT: -- (Test27::B, 16) vtable address --
-// CHECK-NEXT: 12 | void Test27::B::b()
-
-// CHECK: Construction vtable for ('Test27::D', 0) in 'Test27::E' (9 entries).
-// CHECK-NEXT: 0 | vbase_offset (16)
-// CHECK-NEXT: 1 | offset_to_top (0)
-// CHECK-NEXT: 2 | Test27::D RTTI
-// CHECK-NEXT: -- (Test27::A, 0) vtable address --
-// CHECK-NEXT: -- (Test27::D, 0) vtable address --
-// CHECK-NEXT: 3 | void Test27::A::a()
-// CHECK-NEXT: 4 | void Test27::D::d()
-// CHECK-NEXT: 5 | vcall_offset (0)
-// CHECK-NEXT: 6 | offset_to_top (-16)
-// CHECK-NEXT: 7 | Test27::D RTTI
-// CHECK-NEXT: -- (Test27::B, 16) vtable address --
-// CHECK-NEXT: 8 | void Test27::B::b()
+// CHECK-34: Vtable for 'Test27::E' (13 entries).
+// CHECK-34-NEXT: 0 | vbase_offset (16)
+// CHECK-34-NEXT: 1 | offset_to_top (0)
+// CHECK-34-NEXT: 2 | Test27::E RTTI
+// CHECK-34-NEXT: -- (Test27::A, 0) vtable address --
+// CHECK-34-NEXT: -- (Test27::D, 0) vtable address --
+// CHECK-34-NEXT: -- (Test27::E, 0) vtable address --
+// CHECK-34-NEXT: 3 | void Test27::A::a()
+// CHECK-34-NEXT: 4 | void Test27::D::d()
+// CHECK-34-NEXT: 5 | void Test27::E::e()
+// CHECK-34-NEXT: 6 | offset_to_top (-8)
+// CHECK-34-NEXT: 7 | Test27::E RTTI
+// CHECK-34-NEXT: -- (Test27::C, 8) vtable address --
+// CHECK-34-NEXT: 8 | void Test27::C::c()
+// CHECK-34-NEXT: 9 | vcall_offset (0)
+// CHECK-34-NEXT: 10 | offset_to_top (-16)
+// CHECK-34-NEXT: 11 | Test27::E RTTI
+// CHECK-34-NEXT: -- (Test27::B, 16) vtable address --
+// CHECK-34-NEXT: 12 | void Test27::B::b()
+
+// CHECK-34: Construction vtable for ('Test27::D', 0) in 'Test27::E' (9 entries).
+// CHECK-34-NEXT: 0 | vbase_offset (16)
+// CHECK-34-NEXT: 1 | offset_to_top (0)
+// CHECK-34-NEXT: 2 | Test27::D RTTI
+// CHECK-34-NEXT: -- (Test27::A, 0) vtable address --
+// CHECK-34-NEXT: -- (Test27::D, 0) vtable address --
+// CHECK-34-NEXT: 3 | void Test27::A::a()
+// CHECK-34-NEXT: 4 | void Test27::D::d()
+// CHECK-34-NEXT: 5 | vcall_offset (0)
+// CHECK-34-NEXT: 6 | offset_to_top (-16)
+// CHECK-34-NEXT: 7 | Test27::D RTTI
+// CHECK-34-NEXT: -- (Test27::B, 16) vtable address --
+// CHECK-34-NEXT: 8 | void Test27::B::b()
struct E : D {
virtual void e();
};
@@ -1228,45 +1270,45 @@ struct C : A, B {
struct D : virtual C {
};
-// CHECK: Vtable for 'Test28::E' (14 entries).
-// CHECK-NEXT: 0 | vbase_offset (8)
-// CHECK-NEXT: 1 | offset_to_top (0)
-// CHECK-NEXT: 2 | Test28::E RTTI
-// CHECK-NEXT: -- (Test28::D, 0) vtable address --
-// CHECK-NEXT: -- (Test28::E, 0) vtable address --
-// CHECK-NEXT: 3 | void Test28::E::e()
-// CHECK-NEXT: 4 | vcall_offset (8)
-// CHECK-NEXT: 5 | vcall_offset (0)
-// CHECK-NEXT: 6 | vcall_offset (0)
-// CHECK-NEXT: 7 | offset_to_top (-8)
-// CHECK-NEXT: 8 | Test28::E RTTI
-// CHECK-NEXT: -- (Test28::A, 8) vtable address --
-// CHECK-NEXT: -- (Test28::C, 8) vtable address --
-// CHECK-NEXT: 9 | void Test28::A::a()
-// CHECK-NEXT: 10 | void Test28::C::c()
-// CHECK-NEXT: 11 | offset_to_top (-16)
-// CHECK-NEXT: 12 | Test28::E RTTI
-// CHECK-NEXT: -- (Test28::B, 16) vtable address --
-// CHECK-NEXT: 13 | void Test28::B::b()
-
-// CHECK: Construction vtable for ('Test28::D', 0) in 'Test28::E' (13 entries).
-// CHECK-NEXT: 0 | vbase_offset (8)
-// CHECK-NEXT: 1 | offset_to_top (0)
-// CHECK-NEXT: 2 | Test28::D RTTI
-// CHECK-NEXT: -- (Test28::D, 0) vtable address --
-// CHECK-NEXT: 3 | vcall_offset (8)
-// CHECK-NEXT: 4 | vcall_offset (0)
-// CHECK-NEXT: 5 | vcall_offset (0)
-// CHECK-NEXT: 6 | offset_to_top (-8)
-// CHECK-NEXT: 7 | Test28::D RTTI
-// CHECK-NEXT: -- (Test28::A, 8) vtable address --
-// CHECK-NEXT: -- (Test28::C, 8) vtable address --
-// CHECK-NEXT: 8 | void Test28::A::a()
-// CHECK-NEXT: 9 | void Test28::C::c()
-// CHECK-NEXT: 10 | offset_to_top (-16)
-// CHECK-NEXT: 11 | Test28::D RTTI
-// CHECK-NEXT: -- (Test28::B, 16) vtable address --
-// CHECK-NEXT: 12 | void Test28::B::b()
+// CHECK-35: Vtable for 'Test28::E' (14 entries).
+// CHECK-35-NEXT: 0 | vbase_offset (8)
+// CHECK-35-NEXT: 1 | offset_to_top (0)
+// CHECK-35-NEXT: 2 | Test28::E RTTI
+// CHECK-35-NEXT: -- (Test28::D, 0) vtable address --
+// CHECK-35-NEXT: -- (Test28::E, 0) vtable address --
+// CHECK-35-NEXT: 3 | void Test28::E::e()
+// CHECK-35-NEXT: 4 | vcall_offset (8)
+// CHECK-35-NEXT: 5 | vcall_offset (0)
+// CHECK-35-NEXT: 6 | vcall_offset (0)
+// CHECK-35-NEXT: 7 | offset_to_top (-8)
+// CHECK-35-NEXT: 8 | Test28::E RTTI
+// CHECK-35-NEXT: -- (Test28::A, 8) vtable address --
+// CHECK-35-NEXT: -- (Test28::C, 8) vtable address --
+// CHECK-35-NEXT: 9 | void Test28::A::a()
+// CHECK-35-NEXT: 10 | void Test28::C::c()
+// CHECK-35-NEXT: 11 | offset_to_top (-16)
+// CHECK-35-NEXT: 12 | Test28::E RTTI
+// CHECK-35-NEXT: -- (Test28::B, 16) vtable address --
+// CHECK-35-NEXT: 13 | void Test28::B::b()
+
+// CHECK-35: Construction vtable for ('Test28::D', 0) in 'Test28::E' (13 entries).
+// CHECK-35-NEXT: 0 | vbase_offset (8)
+// CHECK-35-NEXT: 1 | offset_to_top (0)
+// CHECK-35-NEXT: 2 | Test28::D RTTI
+// CHECK-35-NEXT: -- (Test28::D, 0) vtable address --
+// CHECK-35-NEXT: 3 | vcall_offset (8)
+// CHECK-35-NEXT: 4 | vcall_offset (0)
+// CHECK-35-NEXT: 5 | vcall_offset (0)
+// CHECK-35-NEXT: 6 | offset_to_top (-8)
+// CHECK-35-NEXT: 7 | Test28::D RTTI
+// CHECK-35-NEXT: -- (Test28::A, 8) vtable address --
+// CHECK-35-NEXT: -- (Test28::C, 8) vtable address --
+// CHECK-35-NEXT: 8 | void Test28::A::a()
+// CHECK-35-NEXT: 9 | void Test28::C::c()
+// CHECK-35-NEXT: 10 | offset_to_top (-16)
+// CHECK-35-NEXT: 11 | Test28::D RTTI
+// CHECK-35-NEXT: -- (Test28::B, 16) vtable address --
+// CHECK-35-NEXT: 12 | void Test28::B::b()
struct E : D {
virtual void e();
};
@@ -1286,17 +1328,17 @@ struct A {
virtual V1 *f();
};
-// CHECK: Vtable for 'Test29::B' (6 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vcall_offset (0)
-// CHECK-NEXT: 2 | offset_to_top (0)
-// CHECK-NEXT: 3 | Test29::B RTTI
-// CHECK-NEXT: -- (Test29::A, 0) vtable address --
-// CHECK-NEXT: -- (Test29::B, 0) vtable address --
-// CHECK-NEXT: 4 | Test29::V2 *Test29::B::f()
-// CHECK-NEXT: [return adjustment: 0 non-virtual, -24 vbase offset offset]
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
-// CHECK-NEXT: 5 | Test29::V2 *Test29::B::f()
+// CHECK-36: Vtable for 'Test29::B' (6 entries).
+// CHECK-36-NEXT: 0 | vbase_offset (0)
+// CHECK-36-NEXT: 1 | vcall_offset (0)
+// CHECK-36-NEXT: 2 | offset_to_top (0)
+// CHECK-36-NEXT: 3 | Test29::B RTTI
+// CHECK-36-NEXT: -- (Test29::A, 0) vtable address --
+// CHECK-36-NEXT: -- (Test29::B, 0) vtable address --
+// CHECK-36-NEXT: 4 | Test29::V2 *Test29::B::f()
+// CHECK-36-NEXT: [return adjustment: 0 non-virtual, -24 vbase offset offset]
+// CHECK-36-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-36-NEXT: 5 | Test29::V2 *Test29::B::f()
struct B : virtual A {
virtual V2 *f();
};
@@ -1342,22 +1384,22 @@ struct C : A, virtual B {
virtual void f();
};
-// CHECK: Vtable for 'Test31::D' (11 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vbase_offset (8)
-// CHECK-NEXT: 2 | vcall_offset (0)
-// CHECK-NEXT: 3 | offset_to_top (0)
-// CHECK-NEXT: 4 | Test31::D RTTI
-// CHECK-NEXT: -- (Test31::B, 0) vtable address --
-// CHECK-NEXT: -- (Test31::D, 0) vtable address --
-// CHECK-NEXT: 5 | void Test31::D::f()
-// CHECK-NEXT: 6 | vbase_offset (-8)
-// CHECK-NEXT: 7 | vcall_offset (-8)
-// CHECK-NEXT: 8 | offset_to_top (-8)
-// CHECK-NEXT: 9 | Test31::D RTTI
-// CHECK-NEXT: -- (Test31::C, 8) vtable address --
-// CHECK-NEXT: 10 | void Test31::D::f()
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-37: Vtable for 'Test31::D' (11 entries).
+// CHECK-37-NEXT: 0 | vbase_offset (0)
+// CHECK-37-NEXT: 1 | vbase_offset (8)
+// CHECK-37-NEXT: 2 | vcall_offset (0)
+// CHECK-37-NEXT: 3 | offset_to_top (0)
+// CHECK-37-NEXT: 4 | Test31::D RTTI
+// CHECK-37-NEXT: -- (Test31::B, 0) vtable address --
+// CHECK-37-NEXT: -- (Test31::D, 0) vtable address --
+// CHECK-37-NEXT: 5 | void Test31::D::f()
+// CHECK-37-NEXT: 6 | vbase_offset (-8)
+// CHECK-37-NEXT: 7 | vcall_offset (-8)
+// CHECK-37-NEXT: 8 | offset_to_top (-8)
+// CHECK-37-NEXT: 9 | Test31::D RTTI
+// CHECK-37-NEXT: -- (Test31::C, 8) vtable address --
+// CHECK-37-NEXT: 10 | void Test31::D::f()
+// CHECK-37-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
struct D : virtual C {
virtual void f();
};
@@ -1377,10 +1419,10 @@ struct B : virtual A { };
struct C : A, virtual B { };
struct D : virtual B { };
-// CHECK: Virtual base offset offsets for 'Test32::E' (3 entries).
-// CHECK-NEXT: Test32::A | -32
-// CHECK-NEXT: Test32::B | -24
-// CHECK-NEXT: Test32::D | -40
+// CHECK-38: Virtual base offset offsets for 'Test32::E' (3 entries).
+// CHECK-38-NEXT: Test32::A | -32
+// CHECK-38-NEXT: Test32::B | -24
+// CHECK-38-NEXT: Test32::D | -40
struct E : C, virtual D {
virtual void f();
};
@@ -1410,45 +1452,45 @@ struct E : A, D {
virtual void e();
};
-// CHECK: Vtable for 'Test33::F' (30 entries).
-// CHECK-NEXT: 0 | vbase_offset (24)
-// CHECK-NEXT: 1 | vbase_offset (16)
-// CHECK-NEXT: 2 | vbase_offset (16)
-// CHECK-NEXT: 3 | vbase_offset (8)
-// CHECK-NEXT: 4 | offset_to_top (0)
-// CHECK-NEXT: 5 | Test33::F RTTI
-// CHECK-NEXT: -- (Test33::A, 0) vtable address --
-// CHECK-NEXT: -- (Test33::F, 0) vtable address --
-// CHECK-NEXT: 6 | void Test33::A::a()
-// CHECK-NEXT: 7 | void Test33::F::f()
-// CHECK-NEXT: 8 | vcall_offset (0)
-// CHECK-NEXT: 9 | vcall_offset (0)
-// CHECK-NEXT: 10 | vbase_offset (16)
-// CHECK-NEXT: 11 | vbase_offset (8)
-// CHECK-NEXT: 12 | vbase_offset (8)
-// CHECK-NEXT: 13 | offset_to_top (-8)
-// CHECK-NEXT: 14 | Test33::F RTTI
-// CHECK-NEXT: -- (Test33::A, 8) vtable address --
-// CHECK-NEXT: -- (Test33::E, 8) vtable address --
-// CHECK-NEXT: 15 | void Test33::A::a()
-// CHECK-NEXT: 16 | void Test33::E::e()
-// CHECK-NEXT: 17 | vbase_offset (0)
-// CHECK-NEXT: 18 | vcall_offset (0)
-// CHECK-NEXT: 19 | vbase_offset (8)
-// CHECK-NEXT: 20 | vbase_offset (0)
-// CHECK-NEXT: 21 | vcall_offset (0)
-// CHECK-NEXT: 22 | offset_to_top (-16)
-// CHECK-NEXT: 23 | Test33::F RTTI
-// CHECK-NEXT: -- (Test33::A, 16) vtable address --
-// CHECK-NEXT: -- (Test33::C, 16) vtable address --
-// CHECK-NEXT: -- (Test33::D, 16) vtable address --
-// CHECK-NEXT: 24 | void Test33::A::a()
-// CHECK-NEXT: 25 | void Test33::C::c()
-// CHECK-NEXT: 26 | vcall_offset (0)
-// CHECK-NEXT: 27 | offset_to_top (-24)
-// CHECK-NEXT: 28 | Test33::F RTTI
-// CHECK-NEXT: -- (Test33::B, 24) vtable address --
-// CHECK-NEXT: 29 | void Test33::B::b()
+// CHECK-39: Vtable for 'Test33::F' (30 entries).
+// CHECK-39-NEXT: 0 | vbase_offset (24)
+// CHECK-39-NEXT: 1 | vbase_offset (16)
+// CHECK-39-NEXT: 2 | vbase_offset (16)
+// CHECK-39-NEXT: 3 | vbase_offset (8)
+// CHECK-39-NEXT: 4 | offset_to_top (0)
+// CHECK-39-NEXT: 5 | Test33::F RTTI
+// CHECK-39-NEXT: -- (Test33::A, 0) vtable address --
+// CHECK-39-NEXT: -- (Test33::F, 0) vtable address --
+// CHECK-39-NEXT: 6 | void Test33::A::a()
+// CHECK-39-NEXT: 7 | void Test33::F::f()
+// CHECK-39-NEXT: 8 | vcall_offset (0)
+// CHECK-39-NEXT: 9 | vcall_offset (0)
+// CHECK-39-NEXT: 10 | vbase_offset (16)
+// CHECK-39-NEXT: 11 | vbase_offset (8)
+// CHECK-39-NEXT: 12 | vbase_offset (8)
+// CHECK-39-NEXT: 13 | offset_to_top (-8)
+// CHECK-39-NEXT: 14 | Test33::F RTTI
+// CHECK-39-NEXT: -- (Test33::A, 8) vtable address --
+// CHECK-39-NEXT: -- (Test33::E, 8) vtable address --
+// CHECK-39-NEXT: 15 | void Test33::A::a()
+// CHECK-39-NEXT: 16 | void Test33::E::e()
+// CHECK-39-NEXT: 17 | vbase_offset (0)
+// CHECK-39-NEXT: 18 | vcall_offset (0)
+// CHECK-39-NEXT: 19 | vbase_offset (8)
+// CHECK-39-NEXT: 20 | vbase_offset (0)
+// CHECK-39-NEXT: 21 | vcall_offset (0)
+// CHECK-39-NEXT: 22 | offset_to_top (-16)
+// CHECK-39-NEXT: 23 | Test33::F RTTI
+// CHECK-39-NEXT: -- (Test33::A, 16) vtable address --
+// CHECK-39-NEXT: -- (Test33::C, 16) vtable address --
+// CHECK-39-NEXT: -- (Test33::D, 16) vtable address --
+// CHECK-39-NEXT: 24 | void Test33::A::a()
+// CHECK-39-NEXT: 25 | void Test33::C::c()
+// CHECK-39-NEXT: 26 | vcall_offset (0)
+// CHECK-39-NEXT: 27 | offset_to_top (-24)
+// CHECK-39-NEXT: 28 | Test33::F RTTI
+// CHECK-39-NEXT: -- (Test33::B, 24) vtable address --
+// CHECK-39-NEXT: 29 | void Test33::B::b()
struct F : virtual E, A {
virtual void f();
};
@@ -1475,36 +1517,36 @@ struct E : virtual D {
virtual void e();
};
-// CHECK: Construction vtable for ('Test34::E', 0) in 'Test34::F' (22 entries).
-// CHECK-NEXT: 0 | vbase_offset (0)
-// CHECK-NEXT: 1 | vbase_offset (8)
-// CHECK-NEXT: 2 | vcall_offset (0)
-// CHECK-NEXT: 3 | offset_to_top (0)
-// CHECK-NEXT: 4 | Test34::E RTTI
-// CHECK-NEXT: -- (Test34::A, 0) vtable address --
-// CHECK-NEXT: -- (Test34::E, 0) vtable address --
-// CHECK-NEXT: 5 | void Test34::A::a()
-// CHECK-NEXT: 6 | void Test34::E::e()
-// CHECK-NEXT: 7 | vcall_offset (8)
-// CHECK-NEXT: 8 | vcall_offset (0)
-// CHECK-NEXT: 9 | vbase_offset (-8)
-// CHECK-NEXT: 10 | offset_to_top (-8)
-// CHECK-NEXT: 11 | Test34::E RTTI
-// CHECK-NEXT: -- (Test34::A, 8) vtable address --
-// CHECK-NEXT: -- (Test34::D, 8) vtable address --
-// CHECK-NEXT: 12 | void Test34::A::a()
-// CHECK-NEXT: 13 | vbase_offset (-16)
-// CHECK-NEXT: 14 | vcall_offset (-16)
-// CHECK-NEXT: 15 | offset_to_top (-16)
-// CHECK-NEXT: 16 | Test34::E RTTI
-// CHECK-NEXT: -- (Test34::B, 16) vtable address --
-// CHECK-NEXT: -- (Test34::C, 16) vtable address --
-// CHECK-NEXT: 17 | [unused] void Test34::A::a()
-// CHECK-NEXT: 18 | void Test34::C::c()
-// CHECK-NEXT: 19 | offset_to_top (-24)
-// CHECK-NEXT: 20 | Test34::E RTTI
-// CHECK-NEXT: -- (Test34::A, 24) vtable address --
-// CHECK-NEXT: 21 | void Test34::A::a()
+// CHECK-40: Construction vtable for ('Test34::E', 0) in 'Test34::F' (22 entries).
+// CHECK-40-NEXT: 0 | vbase_offset (0)
+// CHECK-40-NEXT: 1 | vbase_offset (8)
+// CHECK-40-NEXT: 2 | vcall_offset (0)
+// CHECK-40-NEXT: 3 | offset_to_top (0)
+// CHECK-40-NEXT: 4 | Test34::E RTTI
+// CHECK-40-NEXT: -- (Test34::A, 0) vtable address --
+// CHECK-40-NEXT: -- (Test34::E, 0) vtable address --
+// CHECK-40-NEXT: 5 | void Test34::A::a()
+// CHECK-40-NEXT: 6 | void Test34::E::e()
+// CHECK-40-NEXT: 7 | vcall_offset (8)
+// CHECK-40-NEXT: 8 | vcall_offset (0)
+// CHECK-40-NEXT: 9 | vbase_offset (-8)
+// CHECK-40-NEXT: 10 | offset_to_top (-8)
+// CHECK-40-NEXT: 11 | Test34::E RTTI
+// CHECK-40-NEXT: -- (Test34::A, 8) vtable address --
+// CHECK-40-NEXT: -- (Test34::D, 8) vtable address --
+// CHECK-40-NEXT: 12 | void Test34::A::a()
+// CHECK-40-NEXT: 13 | vbase_offset (-16)
+// CHECK-40-NEXT: 14 | vcall_offset (-16)
+// CHECK-40-NEXT: 15 | offset_to_top (-16)
+// CHECK-40-NEXT: 16 | Test34::E RTTI
+// CHECK-40-NEXT: -- (Test34::B, 16) vtable address --
+// CHECK-40-NEXT: -- (Test34::C, 16) vtable address --
+// CHECK-40-NEXT: 17 | [unused] void Test34::A::a()
+// CHECK-40-NEXT: 18 | void Test34::C::c()
+// CHECK-40-NEXT: 19 | offset_to_top (-24)
+// CHECK-40-NEXT: 20 | Test34::E RTTI
+// CHECK-40-NEXT: -- (Test34::A, 24) vtable address --
+// CHECK-40-NEXT: 21 | void Test34::A::a()
struct F : E {
virtual void f();
};
@@ -1543,55 +1585,55 @@ struct E : D {
struct F : virtual D { };
struct G : virtual E { };
-// CHECK: Vtable for 'Test35::H' (32 entries).
-// CHECK-NEXT: 0 | vbase_offset (32)
-// CHECK-NEXT: 1 | vbase_offset (0)
-// CHECK-NEXT: 2 | vcall_offset (0)
-// CHECK-NEXT: 3 | vcall_offset (0)
-// CHECK-NEXT: 4 | vbase_offset (16)
-// CHECK-NEXT: 5 | vbase_offset (8)
-// CHECK-NEXT: 6 | offset_to_top (0)
-// CHECK-NEXT: 7 | Test35::H RTTI
-// CHECK-NEXT: -- (Test35::C, 0) vtable address --
-// CHECK-NEXT: -- (Test35::D, 0) vtable address --
-// CHECK-NEXT: -- (Test35::F, 0) vtable address --
-// CHECK-NEXT: -- (Test35::H, 0) vtable address --
-// CHECK-NEXT: 8 | void Test35::C::c()
-// CHECK-NEXT: 9 | void Test35::D::d()
-// CHECK-NEXT: 10 | void Test35::H::h()
-// CHECK-NEXT: 11 | vbase_offset (0)
-// CHECK-NEXT: 12 | vbase_offset (24)
-// CHECK-NEXT: 13 | vcall_offset (0)
-// CHECK-NEXT: 14 | vbase_offset (8)
-// CHECK-NEXT: 15 | offset_to_top (-8)
-// CHECK-NEXT: 16 | Test35::H RTTI
-// CHECK-NEXT: -- (Test35::B, 8) vtable address --
-// CHECK-NEXT: -- (Test35::G, 8) vtable address --
-// CHECK-NEXT: 17 | void Test35::B::b()
-// CHECK-NEXT: 18 | vcall_offset (0)
-// CHECK-NEXT: 19 | offset_to_top (-16)
-// CHECK-NEXT: 20 | Test35::H RTTI
-// CHECK-NEXT: -- (Test35::A, 16) vtable address --
-// CHECK-NEXT: 21 | void Test35::A::a()
-// CHECK-NEXT: 22 | vcall_offset (0)
-// CHECK-NEXT: 23 | vcall_offset (0)
-// CHECK-NEXT: 24 | vcall_offset (0)
-// CHECK-NEXT: 25 | vbase_offset (-16)
-// CHECK-NEXT: 26 | vbase_offset (-24)
-// CHECK-NEXT: 27 | offset_to_top (-32)
-// CHECK-NEXT: 28 | Test35::H RTTI
-// CHECK-NEXT: -- (Test35::C, 32) vtable address --
-// CHECK-NEXT: -- (Test35::D, 32) vtable address --
-// CHECK-NEXT: -- (Test35::E, 32) vtable address --
-// CHECK-NEXT: 29 | void Test35::C::c()
-// CHECK-NEXT: 30 | void Test35::D::d()
-// CHECK-NEXT: 31 | void Test35::E::e()
-
-// CHECK: Virtual base offset offsets for 'Test35::H' (4 entries).
-// CHECK-NEXT: Test35::A | -32
-// CHECK-NEXT: Test35::B | -24
-// CHECK-NEXT: Test35::D | -56
-// CHECK-NEXT: Test35::E | -64
+// CHECK-41: Vtable for 'Test35::H' (32 entries).
+// CHECK-41-NEXT: 0 | vbase_offset (32)
+// CHECK-41-NEXT: 1 | vbase_offset (0)
+// CHECK-41-NEXT: 2 | vcall_offset (0)
+// CHECK-41-NEXT: 3 | vcall_offset (0)
+// CHECK-41-NEXT: 4 | vbase_offset (16)
+// CHECK-41-NEXT: 5 | vbase_offset (8)
+// CHECK-41-NEXT: 6 | offset_to_top (0)
+// CHECK-41-NEXT: 7 | Test35::H RTTI
+// CHECK-41-NEXT: -- (Test35::C, 0) vtable address --
+// CHECK-41-NEXT: -- (Test35::D, 0) vtable address --
+// CHECK-41-NEXT: -- (Test35::F, 0) vtable address --
+// CHECK-41-NEXT: -- (Test35::H, 0) vtable address --
+// CHECK-41-NEXT: 8 | void Test35::C::c()
+// CHECK-41-NEXT: 9 | void Test35::D::d()
+// CHECK-41-NEXT: 10 | void Test35::H::h()
+// CHECK-41-NEXT: 11 | vbase_offset (0)
+// CHECK-41-NEXT: 12 | vbase_offset (24)
+// CHECK-41-NEXT: 13 | vcall_offset (0)
+// CHECK-41-NEXT: 14 | vbase_offset (8)
+// CHECK-41-NEXT: 15 | offset_to_top (-8)
+// CHECK-41-NEXT: 16 | Test35::H RTTI
+// CHECK-41-NEXT: -- (Test35::B, 8) vtable address --
+// CHECK-41-NEXT: -- (Test35::G, 8) vtable address --
+// CHECK-41-NEXT: 17 | void Test35::B::b()
+// CHECK-41-NEXT: 18 | vcall_offset (0)
+// CHECK-41-NEXT: 19 | offset_to_top (-16)
+// CHECK-41-NEXT: 20 | Test35::H RTTI
+// CHECK-41-NEXT: -- (Test35::A, 16) vtable address --
+// CHECK-41-NEXT: 21 | void Test35::A::a()
+// CHECK-41-NEXT: 22 | vcall_offset (0)
+// CHECK-41-NEXT: 23 | vcall_offset (0)
+// CHECK-41-NEXT: 24 | vcall_offset (0)
+// CHECK-41-NEXT: 25 | vbase_offset (-16)
+// CHECK-41-NEXT: 26 | vbase_offset (-24)
+// CHECK-41-NEXT: 27 | offset_to_top (-32)
+// CHECK-41-NEXT: 28 | Test35::H RTTI
+// CHECK-41-NEXT: -- (Test35::C, 32) vtable address --
+// CHECK-41-NEXT: -- (Test35::D, 32) vtable address --
+// CHECK-41-NEXT: -- (Test35::E, 32) vtable address --
+// CHECK-41-NEXT: 29 | void Test35::C::c()
+// CHECK-41-NEXT: 30 | void Test35::D::d()
+// CHECK-41-NEXT: 31 | void Test35::E::e()
+
+// CHECK-41: Virtual base offset offsets for 'Test35::H' (4 entries).
+// CHECK-41-NEXT: Test35::A | -32
+// CHECK-41-NEXT: Test35::B | -24
+// CHECK-41-NEXT: Test35::D | -56
+// CHECK-41-NEXT: Test35::E | -64
struct H : F, G {
virtual void h();
};
@@ -1613,24 +1655,24 @@ struct C : virtual A {
virtual void f();
};
-// CHECK: Vtable for 'Test36::D' (12 entries).
-// CHECK-NEXT: 0 | vbase_offset (8)
-// CHECK-NEXT: 1 | vbase_offset (8)
-// CHECK-NEXT: 2 | vcall_offset (0)
-// CHECK-NEXT: 3 | offset_to_top (0)
-// CHECK-NEXT: 4 | Test36::D RTTI
-// CHECK-NEXT: -- (Test36::C, 0) vtable address --
-// CHECK-NEXT: -- (Test36::D, 0) vtable address --
-// CHECK-NEXT: 5 | void Test36::C::f()
-// CHECK-NEXT: 6 | void Test36::D::g()
-// CHECK-NEXT: 7 | vbase_offset (0)
-// CHECK-NEXT: 8 | vcall_offset (-8)
-// CHECK-NEXT: 9 | offset_to_top (-8)
-// CHECK-NEXT: 10 | Test36::D RTTI
-// CHECK-NEXT: -- (Test36::A, 8) vtable address --
-// CHECK-NEXT: -- (Test36::B, 8) vtable address --
-// CHECK-NEXT: 11 | void Test36::C::f()
-// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-42: Vtable for 'Test36::D' (12 entries).
+// CHECK-42-NEXT: 0 | vbase_offset (8)
+// CHECK-42-NEXT: 1 | vbase_offset (8)
+// CHECK-42-NEXT: 2 | vcall_offset (0)
+// CHECK-42-NEXT: 3 | offset_to_top (0)
+// CHECK-42-NEXT: 4 | Test36::D RTTI
+// CHECK-42-NEXT: -- (Test36::C, 0) vtable address --
+// CHECK-42-NEXT: -- (Test36::D, 0) vtable address --
+// CHECK-42-NEXT: 5 | void Test36::C::f()
+// CHECK-42-NEXT: 6 | void Test36::D::g()
+// CHECK-42-NEXT: 7 | vbase_offset (0)
+// CHECK-42-NEXT: 8 | vcall_offset (-8)
+// CHECK-42-NEXT: 9 | offset_to_top (-8)
+// CHECK-42-NEXT: 10 | Test36::D RTTI
+// CHECK-42-NEXT: -- (Test36::A, 8) vtable address --
+// CHECK-42-NEXT: -- (Test36::B, 8) vtable address --
+// CHECK-42-NEXT: 11 | void Test36::C::f()
+// CHECK-42-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
struct D : virtual B, C {
virtual void g();
};
diff --git a/test/CodeGenCXX/vtable-linkage.cpp b/test/CodeGenCXX/vtable-linkage.cpp
index c75efe2..b3b6870 100644
--- a/test/CodeGenCXX/vtable-linkage.cpp
+++ b/test/CodeGenCXX/vtable-linkage.cpp
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o %t
+// RUN: FileCheck --check-prefix=CHECK-1 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-2 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-3 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-4 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-5 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-6 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-7 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-8 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-9 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-10 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-11 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-12 %s < %t
namespace {
struct A {
@@ -73,7 +85,7 @@ extern template struct F<int>;
void use_F(F<char> &fc) {
F<int> fi;
- (void)fi;
+ fi.foo();
F<long> fl;
(void)fl;
fc.foo();
@@ -81,71 +93,85 @@ void use_F(F<char> &fc) {
// B has a key function that is not defined in this translation unit so its vtable
// has external linkage.
-// CHECK: @_ZTV1B = external constant
+// CHECK-1: @_ZTV1B = external constant
// C has no key function, so its vtable should have weak_odr linkage.
-// CHECK: @_ZTV1C = weak_odr constant
-// CHECK: @_ZTS1C = weak_odr constant
-// CHECK: @_ZTI1C = weak_odr constant
+// CHECK-2: @_ZTV1C = weak_odr constant
+// CHECK-2: @_ZTS1C = weak_odr constant
+// CHECK-2: @_ZTI1C = weak_odr constant
// D has a key function that is defined in this translation unit so its vtable is
// defined in the translation unit.
-// CHECK: @_ZTV1D = constant
-// CHECK: @_ZTS1D = constant
-// CHECK: @_ZTI1D = constant
+// CHECK-3: @_ZTV1D = constant
+// CHECK-3: @_ZTS1D = constant
+// CHECK-3: @_ZTI1D = constant
// E<char> is an explicit specialization with a key function defined
// in this translation unit, so its vtable should have external
// linkage.
-// CHECK: @_ZTV1EIcE = constant
-// CHECK: @_ZTS1EIcE = constant
-// CHECK: @_ZTI1EIcE = constant
+// CHECK-4: @_ZTV1EIcE = constant
+// CHECK-4: @_ZTS1EIcE = constant
+// CHECK-4: @_ZTI1EIcE = constant
// E<short> is an explicit template instantiation with a key function
// defined in this translation unit, so its vtable should have
// weak_odr linkage.
-// CHECK: @_ZTV1EIsE = weak_odr constant
-// CHECK: @_ZTS1EIsE = weak_odr constant
-// CHECK: @_ZTI1EIsE = weak_odr constant
+// CHECK-5: @_ZTV1EIsE = weak_odr constant
+// CHECK-5: @_ZTS1EIsE = weak_odr constant
+// CHECK-5: @_ZTI1EIsE = weak_odr constant
// F<short> is an explicit template instantiation without a key
// function, so its vtable should have weak_odr linkage
-// CHECK: @_ZTV1FIsE = weak_odr constant
-// CHECK: @_ZTS1FIsE = weak_odr constant
-// CHECK: @_ZTI1FIsE = weak_odr constant
+// CHECK-6: @_ZTV1FIsE = weak_odr constant
+// CHECK-6: @_ZTS1FIsE = weak_odr constant
+// CHECK-6: @_ZTI1FIsE = weak_odr constant
// E<long> is an implicit template instantiation with a key function
// defined in this translation unit, so its vtable should have
// weak_odr linkage.
-// CHECK: @_ZTV1EIlE = weak_odr constant
-// CHECK: @_ZTS1EIlE = weak_odr constant
-// CHECK: @_ZTI1EIlE = weak_odr constant
+// CHECK-7: @_ZTV1EIlE = weak_odr constant
+// CHECK-7: @_ZTS1EIlE = weak_odr constant
+// CHECK-7: @_ZTI1EIlE = weak_odr constant
// F<long> is an implicit template instantiation with no key function,
// so its vtable should have weak_odr linkage.
-// CHECK: @_ZTV1FIlE = weak_odr constant
-// CHECK: @_ZTS1FIlE = weak_odr constant
-// CHECK: @_ZTI1FIlE = weak_odr constant
+// CHECK-8: @_ZTV1FIlE = weak_odr constant
+// CHECK-8: @_ZTS1FIlE = weak_odr constant
+// CHECK-8: @_ZTI1FIlE = weak_odr constant
// F<int> is an explicit template instantiation declaration without a
// key function, so its vtable should have external linkage.
-// CHECK: @_ZTV1FIiE = external constant
+// CHECK-9: @_ZTV1FIiE = external constant
// E<int> is an explicit template instantiation declaration. It has a
// key function that is not instantiated, so we should only reference
// its vtable, not define it.
-// CHECK: @_ZTV1EIiE = external constant
+// CHECK-10: @_ZTV1EIiE = external constant
// The anonymous struct for e has no linkage, so the vtable should have
// internal linkage.
-// CHECK: @"_ZTV3$_0" = internal constant
-// CHECK: @"_ZTS3$_0" = internal constant
-// CHECK: @"_ZTI3$_0" = internal constant
+// CHECK-11: @"_ZTV3$_0" = internal constant
+// CHECK-11: @"_ZTS3$_0" = internal constant
+// CHECK-11: @"_ZTI3$_0" = internal constant
// The A vtable should have internal linkage since it is inside an anonymous
// namespace.
-// CHECK: @_ZTVN12_GLOBAL__N_11AE = internal constant
-// CHECK: @_ZTSN12_GLOBAL__N_11AE = internal constant
-// CHECK: @_ZTIN12_GLOBAL__N_11AE = internal constant
-
-
+// CHECK-12: @_ZTVN12_GLOBAL__N_11AE = internal constant
+// CHECK-12: @_ZTSN12_GLOBAL__N_11AE = internal constant
+// CHECK-12: @_ZTIN12_GLOBAL__N_11AE = internal constant
+
+// RUN: FileCheck --check-prefix=CHECK-G %s < %t
+//
+// CHECK-G: @_ZTV1GIiE = weak_odr constant
+template <typename T>
+class G {
+public:
+ G() {}
+ virtual void f0();
+ virtual void f1();
+};
+template <>
+void G<int>::f1() {}
+template <typename T>
+void G<T>::f0() {}
+void G_f0() { new G<int>(); }
diff --git a/test/CodeGenCXX/x86_32-arguments.cpp b/test/CodeGenCXX/x86_32-arguments.cpp
index f8d6551..023b729 100644
--- a/test/CodeGenCXX/x86_32-arguments.cpp
+++ b/test/CodeGenCXX/x86_32-arguments.cpp
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
// Non-trivial dtors, should both be passed indirectly.
struct S {
~S();
- int s;
+ short s;
};
// CHECK: define void @_Z1fv(%struct.S* sret %
@@ -13,6 +13,7 @@ void f(S) { }
// Non-trivial dtors, should both be passed indirectly.
class C {
+public:
~C();
double c;
};
@@ -22,3 +23,94 @@ C g() { return C(); }
// CHECK: define void @_Z1f1C(%class.C*)
void f(C) { }
+
+
+
+
+// PR7058 - Missing byval on MI thunk definition.
+
+// CHECK: define void @_ZThn4_N18BasicAliasAnalysis13getModRefInfoE8CallSite
+// ...
+// CHECK: %struct.CallSite* byval %CS)
+struct CallSite {
+ unsigned Ptr;
+ CallSite(unsigned XX) : Ptr(XX) {}
+};
+
+struct AliasAnalysis {
+ virtual void xyz();
+ virtual void getModRefInfo(CallSite CS) = 0;
+};
+
+struct ModulePass {
+ virtual void xx();
+};
+
+struct BasicAliasAnalysis : public ModulePass, public AliasAnalysis {
+ void getModRefInfo(CallSite CS);
+};
+
+void BasicAliasAnalysis::getModRefInfo(CallSite CS) {
+}
+
+// Check various single element struct type conditions.
+//
+// PR7098.
+
+// CHECK: define i64 @_Z2f0v()
+struct s0_0 { int x; };
+struct s0_1 : s0_0 { int* y; };
+s0_1 f0() { return s0_1(); }
+
+// CHECK: define i32 @_Z2f1v()
+struct s1_0 { int x; };
+struct s1_1 : s1_0 { };
+s1_1 f1() { return s1_1(); }
+
+// CHECK: define double @_Z2f2v()
+struct s2_0 { double x; };
+struct s2_1 : s2_0 { };
+s2_1 f2() { return s2_1(); }
+
+// CHECK: define double @_Z2f3v()
+struct s3_0 { };
+struct s3_1 { double x; };
+struct s3_2 : s3_0, s3_1 { };
+s3_2 f3() { return s3_2(); }
+
+// CHECK: define i64 @_Z2f4v()
+struct s4_0 { float x; };
+struct s4_1 { float x; };
+struct s4_2 : s4_0, s4_1 { };
+s4_2 f4() { return s4_2(); }
+
+// CHECK: define i32 @_Z2f5v()
+struct s5 { s5(); int &x; };
+s5 f5() { return s5(); }
+
+// CHECK: define i32 @_Z4f6_0M2s6i(i32 %a)
+// CHECK: define i64 @_Z4f6_1M2s6FivE(%{{.*}} byval %a)
+// FIXME: It would be nice to avoid byval on the previous case.
+struct s6 {};
+typedef int s6::* s6_mdp;
+typedef int (s6::*s6_mfp)();
+s6_mdp f6_0(s6_mdp a) { return a; }
+s6_mfp f6_1(s6_mfp a) { return a; }
+
+// CHECK: define double @_Z2f7v()
+struct s7_0 { unsigned : 0; };
+struct s7_1 { double x; };
+struct s7 : s7_0, s7_1 { };
+s7 f7() { return s7(); }
+
+// CHECK: define void @_Z2f8v(%struct.s8* sret %agg.result)
+struct s8_0 { };
+struct s8_1 { double x; };
+struct s8 { s8_0 a; s8_1 b; };
+s8 f8() { return s8(); }
+
+// CHECK: define void @_Z2f9v(%struct.s9* sret %agg.result)
+struct s9_0 { unsigned : 0; };
+struct s9_1 { double x; };
+struct s9 { s9_0 a; s9_1 b; };
+s9 f9() { return s9(); }
diff --git a/test/CodeGenCXX/x86_64-arguments.cpp b/test/CodeGenCXX/x86_64-arguments.cpp
index 7ebbedc..4bc83b8 100644
--- a/test/CodeGenCXX/x86_64-arguments.cpp
+++ b/test/CodeGenCXX/x86_64-arguments.cpp
@@ -25,3 +25,11 @@ void f2(f2_s1 a0) { }
struct s3_0 {};
struct s3_1 { struct s3_0 a; long b; };
void f3(struct s3_1 x) {}
+
+// CHECK: define i64 @_Z4f4_0M2s4i(i64)
+// CHECK: define [[i64_i64_ty]] @_Z4f4_1M2s4FivE([[i64_i64_ty]])
+struct s4 {};
+typedef int s4::* s4_mdp;
+typedef int (s4::*s4_mfp)();
+s4_mdp f4_0(s4_mdp a) { return a; }
+s4_mfp f4_1(s4_mfp a) { return a; }
diff --git a/test/CodeGenObjC/atomic-aggregate-property.m b/test/CodeGenObjC/atomic-aggregate-property.m
index 2896d37..93eeca8 100644
--- a/test/CodeGenObjC/atomic-aggregate-property.m
+++ b/test/CodeGenObjC/atomic-aggregate-property.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s
// rdar: // 7849824
struct s {
diff --git a/test/CodeGenObjC/blocks-1.m b/test/CodeGenObjC/blocks-1.m
index 76bfd59..1ac9c30 100644
--- a/test/CodeGenObjC/blocks-1.m
+++ b/test/CodeGenObjC/blocks-1.m
@@ -8,6 +8,16 @@
// RUN: grep "_Block_object_assign" %t | count 4
// RUN: grep "objc_read_weak" %t | count 2
// RUN: grep "objc_assign_weak" %t | count 3
+// RUN: %clang_cc1 -x objective-c++ %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10
+// RUN: grep "_Block_object_dispose" %t | count 6
+// RUN: grep "__copy_helper_block_" %t | count 4
+// RUN: grep "__destroy_helper_block_" %t | count 4
+// RUN: grep "__Block_byref_id_object_copy_" %t | count 2
+// RUN: grep "__Block_byref_id_object_dispose_" %t | count 2
+// RUN: grep "i32 135)" %t | count 0
+// RUN: grep "_Block_object_assign" %t | count 4
+// RUN: grep "objc_read_weak" %t | count 2
+// RUN: grep "objc_assign_weak" %t | count 3
@interface NSDictionary @end
diff --git a/test/CodeGenObjC/blocks-2.m b/test/CodeGenObjC/blocks-2.m
index 15160cc..0062e84 100644
--- a/test/CodeGenObjC/blocks-2.m
+++ b/test/CodeGenObjC/blocks-2.m
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10
// RUN: grep "objc_assign_strongCast" %t | count 2
+// RUN: %clang_cc1 -x objective-c++ %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10
+// RUN: grep "objc_assign_strongCast" %t | count 2
// This should generate a strong cast.
diff --git a/test/CodeGenObjC/blocks-ivar-debug.m b/test/CodeGenObjC/blocks-ivar-debug.m
new file mode 100644
index 0000000..d0cf1f1
--- /dev/null
+++ b/test/CodeGenObjC/blocks-ivar-debug.m
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -g %s -fblocks -S -o %t
+// Radar 7959934
+
+@interface NSObject {
+ struct objc_object *isa;
+}
+@end
+@interface Foo : NSObject {
+ int _prop;
+}
+@end
+
+@implementation Foo
+- (int)doSomething {
+ int (^blk)(void) = ^{ return _prop; };
+ return blk();
+}
+
+@end
+
diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m
index 8ba319e..b96a8d9 100644
--- a/test/CodeGenObjC/blocks.m
+++ b/test/CodeGenObjC/blocks.m
@@ -19,7 +19,7 @@ void foo(T *P) {
-(void) im0;
@end
-// RUN: grep 'define internal i32 @"__-\[A im0\]_block_invoke_"' %t
+// RUN: grep 'define internal i32 @"__8-\[A im0\]_block_invoke_0"' %t
@implementation A
-(void) im0 {
(void) ^{ return 1; }();
@@ -31,5 +31,11 @@ void foo(T *P) {
-(void) im1 {
^(void) { [self im0]; }();
}
+-(void) im2 {
+ ^{ [super im0]; }();
+}
+-(void) im3 {
+ ^{ ^{[super im0];}(); }();
+}
@end
diff --git a/test/CodeGenObjC/default-property-synthesis.m b/test/CodeGenObjC/default-property-synthesis.m
new file mode 100644
index 0000000..b3eeb22
--- /dev/null
+++ b/test/CodeGenObjC/default-property-synthesis.m
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi2 -emit-llvm -o %t %s
+// rdar://7923851.
+
+// Superclass declares property. Subclass redeclares the same property.
+// Do not @synthesize-by-default in the subclass. P1
+// Superclass declares a property. Subclass declares a different property with the same name
+// (such as different type or attributes). Do not @synthesize-by-default in the subclass. P2
+// Superclass conforms to a protocol that declares a property. Subclass redeclares the
+// same property. Do not @synthesize-by-default in the subclass. P3
+// Superclass conforms to a protocol that declares a property. Subclass conforms to the
+// same protocol or a derived protocol. Do not @synthesize-by-default in the subclass. P4
+
+
+@protocol PROTO
+ @property int P3;
+ @property int P4;
+@end
+
+@protocol PROTO1 <PROTO>
+ @property int IMP1;
+@end
+
+@interface Super <PROTO>
+ @property int P1;
+ @property (copy) id P2;
+@end
+
+@interface Sub : Super <PROTO1>
+ @property int P1;
+ @property (nonatomic, retain) id P2; // expected-warning {{property 'P2' 'copy' attribute does not match the property inherited from 'Super'}} \
+ // expected-warning {{property 'P2' 'atomic' attribute does not match the property inherited from 'Super'}}
+ @property int P3;
+ @property int IMP2;
+@end
+
+@implementation Sub
+@end
+
diff --git a/test/CodeGenObjC/ivar-layout-64-bitfields.m b/test/CodeGenObjC/ivar-layout-64-bitfields.m
index 1b6a16b..9710e16 100644
--- a/test/CodeGenObjC/ivar-layout-64-bitfields.m
+++ b/test/CodeGenObjC/ivar-layout-64-bitfields.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
@interface I
{
struct {
diff --git a/test/CodeGenObjC/ivar-layout-64.m b/test/CodeGenObjC/ivar-layout-64.m
index 60ce1df..f227bfc 100644
--- a/test/CodeGenObjC/ivar-layout-64.m
+++ b/test/CodeGenObjC/ivar-layout-64.m
@@ -4,6 +4,12 @@
// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\11q\\10\\00"' %t
// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"!q\\00"' %t
// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\01\\14\\00"' %t
+// RUNX: llvm-gcc -ObjC++ -m64 -fobjc-gc -emit-llvm -S -o %t %s &&
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s
+// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"A\\00"' %t
+// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\11q\\10\\00"' %t
+// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"!q\\00"' %t
+// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\01\\14\\00"' %t
/*
diff --git a/test/CodeGenObjC/ivar-layout-no-optimize.m b/test/CodeGenObjC/ivar-layout-no-optimize.m
index e7fd130..7760f94 100644
--- a/test/CodeGenObjC/ivar-layout-no-optimize.m
+++ b/test/CodeGenObjC/ivar-layout-no-optimize.m
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
+// RUN: %clang_cc1 -x objective-c++ -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s
+// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
@interface NSObject {
id isa;
diff --git a/test/CodeGenObjC/objc-gc-aggr-assign.m b/test/CodeGenObjC/objc-gc-aggr-assign.m
new file mode 100644
index 0000000..9fd64d5
--- /dev/null
+++ b/test/CodeGenObjC/objc-gc-aggr-assign.m
@@ -0,0 +1,62 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix C %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix CP %s
+
+static int count;
+
+typedef struct S {
+ int ii;
+} SS;
+
+struct type_s {
+ SS may_recurse;
+ id id_val;
+};
+
+@interface NamedObject
+{
+ struct type_s type_s_ivar;
+}
+- (void) setSome : (struct type_s) arg;
+- (struct type_s) getSome;
+@property(assign) struct type_s aggre_prop;
+@end
+
+@implementation NamedObject
+- (void) setSome : (struct type_s) arg
+ {
+ type_s_ivar = arg;
+ }
+- (struct type_s) getSome
+ {
+ return type_s_ivar;
+ }
+@synthesize aggre_prop = type_s_ivar;
+@end
+
+struct type_s some = {{1234}, (id)0};
+
+struct type_s get(void)
+{
+ return some;
+}
+
+void f(const struct type_s *in, struct type_s *out) {
+ *out = *in;
+}
+
+#ifdef __cplusplus
+struct Derived : type_s { };
+
+void foo(Derived* src, Derived* dest) {
+ *dest = *src;
+}
+#endif
+
+// CHECK-C: call i8* @objc_memmove_collectable
+// CHECK-C: call i8* @objc_memmove_collectable
+// CHECK-C: call i8* @objc_memmove_collectable
+
+// CHECK-CP: call i8* @objc_memmove_collectable
+// CHECK-CP: call i8* @objc_memmove_collectable
+// CHECK-CP: call i8* @objc_memmove_collectable
+// CHECK-CP: call i8* @objc_memmove_collectable
diff --git a/test/CodeGenObjC/objc2-new-gc-api-strongcast.m b/test/CodeGenObjC/objc2-new-gc-api-strongcast.m
index 1ff2dd3..0413910 100644
--- a/test/CodeGenObjC/objc2-new-gc-api-strongcast.m
+++ b/test/CodeGenObjC/objc2-new-gc-api-strongcast.m
@@ -1,9 +1,11 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fobjc-gc -emit-llvm -o %t %s
// RUN: grep -F '@objc_assign_strongCast' %t | count 4
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fblocks -fobjc-gc -emit-llvm -o %t %s
+// RUN: grep -F '@objc_assign_strongCast' %t | count 4
@interface DSATextSearch @end
-DSATextSearch **_uniqueIdToIdentifierArray = ((void *)0);
+DSATextSearch **_uniqueIdToIdentifierArray = (0);
void foo (int _nextId)
{
_uniqueIdToIdentifierArray[_nextId] = 0; // objc_assign_strongCast
diff --git a/test/CodeGenObjC/objc2-no-write-barrier.m b/test/CodeGenObjC/objc2-no-write-barrier.m
index 544c329..a0ebc10 100644
--- a/test/CodeGenObjC/objc2-no-write-barrier.m
+++ b/test/CodeGenObjC/objc2-no-write-barrier.m
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep 'objc_assign' %t | count 0
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+// RUN: grep 'objc_assign' %t | count 0
typedef struct {
int ival;
diff --git a/test/CodeGenObjC/objc2-retain-codegen.m b/test/CodeGenObjC/objc2-retain-codegen.m
index 2c3317a..9f66206 100644
--- a/test/CodeGenObjC/objc2-retain-codegen.m
+++ b/test/CodeGenObjC/objc2-retain-codegen.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-gc-only -emit-llvm -o %t %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-unknown-unknown -fobjc-gc-only -emit-llvm -o %t %s
@interface I0 {
I0 *_f0;
diff --git a/test/CodeGenObjC/objc2-strong-cast-1.m b/test/CodeGenObjC/objc2-strong-cast-1.m
index 509f21a..b79f8a0 100644
--- a/test/CodeGenObjC/objc2-strong-cast-1.m
+++ b/test/CodeGenObjC/objc2-strong-cast-1.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-unknown-unknown -fobjc-gc -emit-llvm -o %t %s
@interface I {
__attribute__((objc_gc(strong))) int *i_IdocumentIDs;
diff --git a/test/CodeGenObjC/objc2-strong-cast.m b/test/CodeGenObjC/objc2-strong-cast.m
index 9ef463c..7291c4e 100644
--- a/test/CodeGenObjC/objc2-strong-cast.m
+++ b/test/CodeGenObjC/objc2-strong-cast.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -x objective-c++ -fobjc-gc -emit-llvm -o %t %s
@interface I {
__attribute__((objc_gc(strong))) signed long *_documentIDs;
diff --git a/test/CodeGenObjC/objc2-weak-assign.m b/test/CodeGenObjC/objc2-weak-assign.m
index 42fa773..74c0c00 100644
--- a/test/CodeGenObjC/objc2-weak-assign.m
+++ b/test/CodeGenObjC/objc2-weak-assign.m
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep -e "objc_assign_weak" %t | grep -e "call" | count 6
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+// RUN: grep -e "objc_assign_weak" %t | grep -e "call" | count 6
__weak id* x;
id* __weak y;
diff --git a/test/CodeGenObjC/objc2-weak-compare.m b/test/CodeGenObjC/objc2-weak-compare.m
index cb8ca5f..8cba1a9 100644
--- a/test/CodeGenObjC/objc2-weak-compare.m
+++ b/test/CodeGenObjC/objc2-weak-compare.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
@interface PBXTarget
{
@@ -10,6 +11,7 @@ PBXTarget * result;
- Meth;
@end
+extern void foo();
@implementation PBXTarget
- Meth {
if (_lastKnownTarget != result)
diff --git a/test/CodeGenObjC/objc2-weak-ivar-debug.m b/test/CodeGenObjC/objc2-weak-ivar-debug.m
index a6fb7fa2..8f7acd7 100644
--- a/test/CodeGenObjC/objc2-weak-ivar-debug.m
+++ b/test/CodeGenObjC/objc2-weak-ivar-debug.m
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s
+// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s
// rdar://7252252
@interface Loop {
diff --git a/test/CodeGenObjC/objc2-weak-ivar.m b/test/CodeGenObjC/objc2-weak-ivar.m
index cfe1e95..8c91a80 100644
--- a/test/CodeGenObjC/objc2-weak-ivar.m
+++ b/test/CodeGenObjC/objc2-weak-ivar.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
@class NSObject;
@interface Foo {
diff --git a/test/CodeGenObjC/objc2-write-barrier-2.m b/test/CodeGenObjC/objc2-write-barrier-2.m
index 9a76c6e..74cd7ea 100644
--- a/test/CodeGenObjC/objc2-write-barrier-2.m
+++ b/test/CodeGenObjC/objc2-write-barrier-2.m
@@ -2,6 +2,10 @@
// RUN: grep -F '@objc_assign_global' %t | count 7
// RUN: grep -F '@objc_assign_ivar' %t | count 5
// RUN: grep -F '@objc_assign_strongCast' %t | count 8
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
+// RUN: grep -F '@objc_assign_global' %t | count 7
+// RUN: grep -F '@objc_assign_ivar' %t | count 5
+// RUN: grep -F '@objc_assign_strongCast' %t | count 8
extern id **somefunc(void);
extern id *somefunc2(void);
diff --git a/test/CodeGenObjC/objc2-write-barrier-3.m b/test/CodeGenObjC/objc2-write-barrier-3.m
index 626083b..cb72cc0 100644
--- a/test/CodeGenObjC/objc2-write-barrier-3.m
+++ b/test/CodeGenObjC/objc2-write-barrier-3.m
@@ -1,6 +1,9 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s
// RUN: grep objc_assign_ivar %t | count 3
// RUN: grep objc_assign_strongCast %t | count 6
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s
+// RUN: grep objc_assign_ivar %t | count 3
+// RUN: grep objc_assign_strongCast %t | count 6
struct Slice {
void *__strong * items;
diff --git a/test/CodeGenObjC/objc2-write-barrier-4.m b/test/CodeGenObjC/objc2-write-barrier-4.m
index 11b4ab4..ab30649 100644
--- a/test/CodeGenObjC/objc2-write-barrier-4.m
+++ b/test/CodeGenObjC/objc2-write-barrier-4.m
@@ -1,6 +1,9 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep objc_assign_global %t | count 3
// RUN: grep objc_assign_strongCast %t | count 2
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
+// RUN: grep objc_assign_global %t | count 3
+// RUN: grep objc_assign_strongCast %t | count 2
@interface A
@end
diff --git a/test/CodeGenObjC/objc2-write-barrier-5.m b/test/CodeGenObjC/objc2-write-barrier-5.m
index babe26d..373df0c 100644
--- a/test/CodeGenObjC/objc2-write-barrier-5.m
+++ b/test/CodeGenObjC/objc2-write-barrier-5.m
@@ -1,6 +1,9 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep objc_assign_ivar %t | count 0
// RUN: grep objc_assign_strongCast %t | count 5
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
+// RUN: grep objc_assign_ivar %t | count 0
+// RUN: grep objc_assign_strongCast %t | count 5
@interface TestUnarchiver
{
diff --git a/test/CodeGenObjC/objc2-write-barrier.m b/test/CodeGenObjC/objc2-write-barrier.m
index 0934e0a..08b65de 100644
--- a/test/CodeGenObjC/objc2-write-barrier.m
+++ b/test/CodeGenObjC/objc2-write-barrier.m
@@ -1,6 +1,9 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep -F '@objc_assign_global' %t | count 21
// RUN: grep -F '@objc_assign_ivar' %t | count 11
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
+// RUN: grep -F '@objc_assign_global' %t | count 21
+// RUN: grep -F '@objc_assign_ivar' %t | count 11
typedef const struct __CFDictionary * CFDictionaryRef;
@@ -49,9 +52,9 @@ struct_with_ids_t GlobalStructArray[10];
// The test cases
-void *rhs = 0;
+void* rhs = 0;
-#define ASSIGNTEST(expr, global) expr = rhs
+#define ASSIGNTEST(expr, global) expr = (typeof(expr))rhs
int testGlobals() {
// Everything in this function generates assign_global intercepts
diff --git a/test/CodeGenObjC/property-complex.m b/test/CodeGenObjC/property-complex.m
index 59200eb..071d0b1 100644
--- a/test/CodeGenObjC/property-complex.m
+++ b/test/CodeGenObjC/property-complex.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -S -o - %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -S -o - %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
@interface I0 {
@public
diff --git a/test/CodeGenObjC/protocols.m b/test/CodeGenObjC/protocols.m
index 0f24a1c..6dadb11 100644
--- a/test/CodeGenObjC/protocols.m
+++ b/test/CodeGenObjC/protocols.m
@@ -1,8 +1,9 @@
-// RUN: %clang_cc1 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm-only %s
void p(const char*, ...);
@interface Root
++(int) maxValue;
-(int) conformsTo: (id) x;
@end
@@ -48,3 +49,9 @@ int main() {
return 0;
}
+
+// rdar://problem/7992749
+typedef Root<P1> P1Object;
+int test10() {
+ return [P1Object maxValue];
+}
diff --git a/test/CodeGenObjCXX/encode.mm b/test/CodeGenObjCXX/encode.mm
new file mode 100644
index 0000000..83fb31e
--- /dev/null
+++ b/test/CodeGenObjCXX/encode.mm
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+// CHECK: v17@0:8{vector<float, float, float>=}16
+// CHECK: {vector<float, float, float>=}
+// CHECK: v24@0:816
+
+template <typename T1, typename T2, typename T3> struct vector {
+ vector();
+ vector(T1,T2,T3);
+};
+
+typedef vector< float, float, float > vector3f;
+
+@interface SceneNode
+{
+ vector3f position;
+}
+
+@property (assign, nonatomic) vector3f position;
+
+@end
+
+@interface MyOpenGLView
+{
+@public
+ vector3f position;
+}
+@property vector3f position;
+@end
+
+@implementation MyOpenGLView
+
+@synthesize position;
+
+-(void)awakeFromNib {
+ SceneNode *sn;
+ vector3f VF3(1.0, 1.0, 1.0);
+ [sn setPosition:VF3];
+}
+@end
+
+
+class Int3 { int x, y, z; };
+
+// Enforce @encoding for member pointers.
+@interface MemPtr {}
+- (void) foo: (int (Int3::*)) member;
+@end
+@implementation MemPtr
+- (void) foo: (int (Int3::*)) member {
+}
+@end
diff --git a/test/CodeGenObjCXX/mangle-blocks.mm b/test/CodeGenObjCXX/mangle-blocks.mm
new file mode 100644
index 0000000..9f57557
--- /dev/null
+++ b/test/CodeGenObjCXX/mangle-blocks.mm
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -emit-llvm -fblocks -o - -triple x86_64-apple-darwin10 %s | FileCheck %s
+
+// CHECK: @_ZGVN3foo20__foo_block_invoke_05valueE = internal global i64 0
+
+int f();
+
+void foo() {
+ // CHECK: define internal i32 @__foo_block_invoke_0
+ // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVN3foo20__foo_block_invoke_05value
+ (void)^(int x) {
+ static int value = f();
+ return x + value;
+ };
+}
+
+// CHECK: define internal i32 @__block_global_0
+int i = ^(int x) { return x;}(i);
+
+@interface A
+- (void)method;
+@end
+
+@implementation A
+- (void)method {
+ // CHECK: define internal signext i8 @"__11-[A method]_block_invoke_0"
+ (void)^(int x) {
+ // CHECK: @"_ZN11-[A method]30__11-[A method]_block_invoke_04nameE"
+ static const char *name = "hello";
+ return name[x];
+ };
+}
+@end
+
+void foo(int) {
+ (void)^(int x) {
+ static const char *name = "hello";
+ return name[x];
+ };
+}
+
+namespace N {
+ // CHECK: define internal signext i8 @__bar_block_invoke_0
+ void bar() {
+ (void)^(int x) {
+ // CHECK: @_ZN1N3bar20__bar_block_invoke_04nameE
+ static const char *name = "hello";
+ return name[x];
+ };
+ }
+}
diff --git a/test/CodeGenObjCXX/property-objects.mm b/test/CodeGenObjCXX/property-objects.mm
new file mode 100644
index 0000000..662dacc
--- /dev/null
+++ b/test/CodeGenObjCXX/property-objects.mm
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - | FileCheck %s
+// CHECK-NOT: callq _objc_msgSend_stret
+// CHECK: call void @_ZN1SC1ERKS_
+// CHECK: call %class.S* @_ZN1SaSERKS_
+// CHECK: call %class.S* @_ZN6CGRectaSERKS_
+
+class S {
+public:
+ S& operator = (const S&);
+ S (const S&);
+ S ();
+};
+
+struct CGRect {
+ CGRect & operator = (const CGRect &);
+};
+
+@interface I {
+ S position;
+ CGRect bounds;
+}
+@property(assign, nonatomic) S position;
+@property CGRect bounds;
+@property CGRect frame;
+- (void)setFrame:(CGRect)frameRect;
+- (CGRect)frame;
+- (void) initWithOwner;
+@end
+
+@implementation I
+@synthesize position;
+@synthesize bounds;
+@synthesize frame;
+- (void)setFrame:(CGRect)frameRect {}
+- (CGRect)frame {return bounds;}
+
+- (void)initWithOwner {
+ I* _labelLayer;
+ CGRect labelLayerFrame = self.bounds;
+ labelLayerFrame = self.bounds;
+ _labelLayer.frame = labelLayerFrame;
+}
+@end
+
+int main() {
+ I *i;
+ S s1;
+ i.position = s1;
+ return 0;
+}
+
diff --git a/test/Coverage/ast-printing.cpp b/test/Coverage/ast-printing.cpp
index 1a75fb4..0de5642 100644
--- a/test/Coverage/ast-printing.cpp
+++ b/test/Coverage/ast-printing.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only %s
// RUN: %clang_cc1 -ast-print %s
// RUN: %clang_cc1 -ast-dump %s
-// FIXME: %clang_cc1 -ast-print-xml -o %t %s
+// RUN: %clang_cc1 -ast-print-xml -o %t %s
// RUN: %clang_cc1 -print-decl-contexts %s
// RUN: %clang_cc1 -fdump-record-layouts %s
diff --git a/test/Driver/bindings.c b/test/Driver/bindings.c
index 2271ab5..e7ec0c5 100644
--- a/test/Driver/bindings.c
+++ b/test/Driver/bindings.c
@@ -48,7 +48,7 @@
// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
// Darwin bindings
-// RUN: %clang -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings %s 2> %t
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -no-integrated-as -ccc-print-bindings %s 2> %t
// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: ".*\.s"' %t
// RUN: grep '"darwin::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
// RUN: grep '"darwin::Link", inputs: \[".*\.o"\], output: "a.out"' %t
diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c
index f1d6759..50bce3b 100644
--- a/test/Driver/clang_f_opts.c
+++ b/test/Driver/clang_f_opts.c
@@ -1,10 +1,12 @@
-// RUN: %clang -### -S -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
-// RUN: %clang -### -S -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
+// RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
+// RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-asm -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
// RUN: %clang -### -fshort-enums %s 2>&1 | FileCheck -check-prefix=CHECK-SHORT-ENUMS %s
+// CHECK-OPTIONS1: -fgnu-keywords
// CHECK-OPTIONS1: -fblocks
// CHECK-OPTIONS1: -fpascal-strings
+// CHECK_OPTIONS2: -fno-gnu-keywords
// CHECK-OPTIONS2: -fmath-errno
// CHECK-OPTIONS2: -fno-builtin
// CHECK-OPTIONS2: -fshort-wchar
diff --git a/test/FixIt/typo.m b/test/FixIt/typo.m
index f161bb8..7197bc7 100644
--- a/test/FixIt/typo.m
+++ b/test/FixIt/typo.m
@@ -1,17 +1,18 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: cp %s %t
-// RUN: %clang_cc1 -fsyntax-only -fixit %t || true
-// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x objective-c %t
-// XFAIL: *
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -DNON_FIXITS -verify %s
+// RUN: %clang -E -P %s -o %t
+// RUN: %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fixit %t || true
+// RUN: %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -pedantic -Werror %t
@interface NSString // expected-note{{'NSString' declared here}}
+ (int)method:(int)x;
@end
+#ifdef NON_FIXITS
void test() {
// FIXME: not providing fix-its
NSstring *str = @"A string"; // expected-error{{use of undeclared identifier 'NSstring'; did you mean 'NSString'?}}
}
+#endif
@protocol P1
@optional
@@ -80,18 +81,23 @@ void test2(Collide *a) {
a->vale = 17; // expected-error{{'Collide' does not have a member named 'vale'; did you mean 'value'?}}
}
+#ifdef NON_FIXITS
@interface Derived : Collid // expected-error{{cannot find interface declaration for 'Collid', superclass of 'Derived'; did you mean 'Collide'?}}
@end
+#endif
+#ifdef NON_FIXITS
@protocol NetworkSocket // expected-note{{'NetworkSocket' declared here}}
- (int)send:(void*)buffer bytes:(int)bytes;
@end
@interface IPv6 <Network_Socket> // expected-error{{cannot find protocol declaration for 'Network_Socket'; did you mean 'NetworkSocket'?}}
@end
+#endif
@interface Super
-- (int)method;
+- (int)method; // expected-note{{using}}
+- (int)method2;
@end
@interface Sub : Super
@@ -105,6 +111,18 @@ void test2(Collide *a) {
@end
+double *isupper(int);
+
+@interface Sub2 : Super
+- (int)method2;
+@end
+
+@implementation Sub2
+- (int)method2 {
+ return [supper method2]; // expected-error{{unknown receiver 'supper'; did you mean 'super'?}}
+}
+@end
+
@interface Ivar
@end
@@ -112,29 +130,19 @@ void test2(Collide *a) {
@property (retain) id ivar;
@end
+#ifdef NON_FIXITS
@interface User <Proto>
-- (void)method;
+- (void)method; // expected-note{{also found}}
@end
@implementation User
@synthesize ivar;
- (void)method {
- [ivar method]; // Test that we don't correct 'ivar' to 'Ivar'
+ // Test that we don't correct 'ivar' to 'Ivar' e
+ [ivar method]; // expected-warning{{multiple methods named 'method' found}}
}
@end
+#endif
-@interface User2
-@end
-@interface User2 (Cat) < Proto>
-- (void)method;
-@end
-
-@implementation User2 (Cat)
-@synthesize ivar;
-
-- (void)method {
- [ivar method]; // Test that we don't correct 'ivar' to 'Ivar'
-}
-@end
diff --git a/test/Index/annotate-tokens-include.c b/test/Index/annotate-tokens-include.c
new file mode 100644
index 0000000..3c3c43b
--- /dev/null
+++ b/test/Index/annotate-tokens-include.c
@@ -0,0 +1,6 @@
+#include "annotate-tokens-include.h"
+
+// RUN: c-index-test -test-annotate-tokens=%s:1:1:2:1 %s | FileCheck %s
+// CHECK: Identifier: "include" [1:2 - 1:9] preprocessing directive=
+// CHECK: Literal: ""annotate-tokens-include.h"" [1:10 - 1:37] preprocessing directive=
+
diff --git a/test/Index/annotate-tokens-include.h b/test/Index/annotate-tokens-include.h
new file mode 100644
index 0000000..5d5f8f0
--- /dev/null
+++ b/test/Index/annotate-tokens-include.h
@@ -0,0 +1 @@
+int foo();
diff --git a/test/Index/annotate-tokens.c b/test/Index/annotate-tokens.c
index 7fbf9cc..41f182d 100644
--- a/test/Index/annotate-tokens.c
+++ b/test/Index/annotate-tokens.c
@@ -11,55 +11,55 @@ void f(void *ptr) {
// RUN: c-index-test -test-annotate-tokens=%s:4:1:9:32 %s | FileCheck %s
// CHECK: Identifier: "T" [4:3 - 4:4] TypeRef=T:1:13
-// CHECK: Punctuation: "*" [4:4 - 4:5]
+// CHECK: Punctuation: "*" [4:4 - 4:5] VarDecl=t_ptr:4:6 (Definition)
// CHECK: Identifier: "t_ptr" [4:6 - 4:11] VarDecl=t_ptr:4:6 (Definition)
-// CHECK: Punctuation: "=" [4:12 - 4:13]
-// CHECK: Punctuation: "(" [4:14 - 4:15]
+// CHECK: Punctuation: "=" [4:12 - 4:13] VarDecl=t_ptr:4:6 (Definition)
+// CHECK: Punctuation: "(" [4:14 - 4:15] UnexposedExpr=ptr:3:14
// CHECK: Identifier: "T" [4:15 - 4:16] TypeRef=T:1:13
-// CHECK: Punctuation: "*" [4:17 - 4:18]
-// CHECK: Punctuation: ")" [4:18 - 4:19]
+// CHECK: Punctuation: "*" [4:17 - 4:18] UnexposedExpr=ptr:3:14
+// CHECK: Punctuation: ")" [4:18 - 4:19] UnexposedExpr=ptr:3:14
// CHECK: Identifier: "ptr" [4:19 - 4:22] DeclRefExpr=ptr:3:14
-// CHECK: Punctuation: ";" [4:22 - 4:23]
-// CHECK: Punctuation: "(" [5:3 - 5:4]
-// CHECK: Keyword: "void" [5:4 - 5:8]
-// CHECK: Punctuation: ")" [5:8 - 5:9]
-// CHECK: Keyword: "sizeof" [5:9 - 5:15]
-// CHECK: Punctuation: "(" [5:15 - 5:16]
+// CHECK: Punctuation: ";" [4:22 - 4:23] UnexposedStmt=
+// CHECK: Punctuation: "(" [5:3 - 5:4] UnexposedExpr=
+// CHECK: Keyword: "void" [5:4 - 5:8] UnexposedExpr=
+// CHECK: Punctuation: ")" [5:8 - 5:9] UnexposedExpr=
+// CHECK: Keyword: "sizeof" [5:9 - 5:15] UnexposedExpr=
+// CHECK: Punctuation: "(" [5:15 - 5:16] UnexposedExpr=
// CHECK: Identifier: "T" [5:16 - 5:17] TypeRef=T:1:13
-// CHECK: Punctuation: ")" [5:17 - 5:18]
-// CHECK: Punctuation: ";" [5:18 - 5:19]
-// CHECK: Comment: "/* A comment */" [6:3 - 6:18]
-// CHECK: Keyword: "struct" [7:3 - 7:9]
+// CHECK: Punctuation: ")" [5:17 - 5:18] UnexposedExpr=
+// CHECK: Punctuation: ";" [5:18 - 5:19] UnexposedStmt=
+// CHECK: Comment: "/* A comment */" [6:3 - 6:18] UnexposedStmt=
+// CHECK: Keyword: "struct" [7:3 - 7:9] UnexposedStmt=
// CHECK: Identifier: "X" [7:10 - 7:11] TypeRef=struct X:2:8
// CHECK: Identifier: "x" [7:12 - 7:13] VarDecl=x:7:12 (Definition)
-// CHECK: Punctuation: "=" [7:14 - 7:15]
-// CHECK: Punctuation: "(" [7:16 - 7:17]
-// CHECK: Keyword: "struct" [7:17 - 7:23]
+// CHECK: Punctuation: "=" [7:14 - 7:15] VarDecl=x:7:12 (Definition)
+// CHECK: Punctuation: "(" [7:16 - 7:17] UnexposedExpr=
+// CHECK: Keyword: "struct" [7:17 - 7:23] UnexposedExpr=
// CHECK: Identifier: "X" [7:24 - 7:25] TypeRef=struct X:2:8
-// CHECK: Punctuation: ")" [7:25 - 7:26]
-// CHECK: Punctuation: "{" [7:26 - 7:27]
-// CHECK: Literal: "1" [7:27 - 7:28]
-// CHECK: Punctuation: "," [7:28 - 7:29]
-// CHECK: Literal: "2" [7:30 - 7:31]
-// CHECK: Punctuation: "}" [7:31 - 7:32]
-// CHECK: Punctuation: ";" [7:32 - 7:33]
-// CHECK: Keyword: "void" [8:3 - 8:7]
-// CHECK: Punctuation: "*" [8:8 - 8:9]
+// CHECK: Punctuation: ")" [7:25 - 7:26] UnexposedExpr=
+// CHECK: Punctuation: "{" [7:26 - 7:27] UnexposedExpr=
+// CHECK: Literal: "1" [7:27 - 7:28] UnexposedExpr=
+// CHECK: Punctuation: "," [7:28 - 7:29] UnexposedExpr=
+// CHECK: Literal: "2" [7:30 - 7:31] UnexposedExpr=
+// CHECK: Punctuation: "}" [7:31 - 7:32] UnexposedExpr=
+// CHECK: Punctuation: ";" [7:32 - 7:33] UnexposedStmt=
+// CHECK: Keyword: "void" [8:3 - 8:7] VarDecl=xx:8:9 (Definition)
+// CHECK: Punctuation: "*" [8:8 - 8:9] VarDecl=xx:8:9 (Definition)
// CHECK: Identifier: "xx" [8:9 - 8:11] VarDecl=xx:8:9 (Definition)
-// CHECK: Punctuation: "=" [8:12 - 8:13]
+// CHECK: Punctuation: "=" [8:12 - 8:13] VarDecl=xx:8:9 (Definition)
// CHECK: Identifier: "ptr" [8:14 - 8:17] DeclRefExpr=ptr:3:14
-// CHECK: Punctuation: "?" [8:18 - 8:19]
-// CHECK: Punctuation: ":" [8:20 - 8:21]
-// CHECK: Punctuation: "&" [8:22 - 8:23]
+// CHECK: Punctuation: "?" [8:18 - 8:19] UnexposedExpr=
+// CHECK: Punctuation: ":" [8:20 - 8:21] UnexposedExpr=
+// CHECK: Punctuation: "&" [8:22 - 8:23] UnexposedExpr=
// CHECK: Identifier: "x" [8:23 - 8:24] DeclRefExpr=x:7:12
-// CHECK: Punctuation: ";" [8:24 - 8:25]
-// CHECK: Keyword: "const" [9:3 - 9:8]
-// CHECK: Keyword: "char" [9:9 - 9:13]
-// CHECK: Punctuation: "*" [9:14 - 9:15]
+// CHECK: Punctuation: ";" [8:24 - 8:25] UnexposedStmt=
+// CHECK: Keyword: "const" [9:3 - 9:8] UnexposedStmt=
+// CHECK: Keyword: "char" [9:9 - 9:13] VarDecl=hello:9:16 (Definition)
+// CHECK: Punctuation: "*" [9:14 - 9:15] VarDecl=hello:9:16 (Definition)
// CHECK: Identifier: "hello" [9:16 - 9:21] VarDecl=hello:9:16 (Definition)
-// CHECK: Punctuation: "=" [9:22 - 9:23]
-// CHECK: Literal: ""Hello"" [9:24 - 9:31]
-// CHECK: Punctuation: ";" [9:31 - 9:32]
-// CHECK: Punctuation: "}" [10:1 - 10:2]
+// CHECK: Punctuation: "=" [9:22 - 9:23] VarDecl=hello:9:16 (Definition)
+// CHECK: Literal: ""Hello"" [9:24 - 9:31] UnexposedExpr=
+// CHECK: Punctuation: ";" [9:31 - 9:32] UnexposedStmt=
+// CHECK: Punctuation: "}" [10:1 - 10:2] UnexposedStmt=
// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:32 %s | FileCheck %s
// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:38 %s | FileCheck %s
diff --git a/test/Index/annotate-tokens.m b/test/Index/annotate-tokens.m
index ce399d3..c6e746b 100644
--- a/test/Index/annotate-tokens.m
+++ b/test/Index/annotate-tokens.m
@@ -9,51 +9,245 @@
}
@end
-// RUN: c-index-test -test-annotate-tokens=%s:1:1:10:5 %s | FileCheck %s
-// CHECK: Punctuation: "@" [1:1 - 1:2]
-// CHECK: Identifier: "interface" [1:2 - 1:11]
+// From <rdar://problem/7971430>, the 'barType' referenced in the ivar
+// declarations should be annotated as TypeRefs.
+typedef int * barType;
+@interface Bar
+{
+ barType iVar;
+ barType iVar1, iVar2;
+}
+@end
+@implementation Bar
+- (void) method
+{
+ barType local = iVar;
+}
+@end
+
+// From <rdar://problem/7967123>. The ranges for attributes are not
+// currently stored, causing most of the tokens to be falsely annotated.
+// Since there are no source ranges for attributes, we currently don't
+// annotate them.
+@interface IBActionTests
+- (IBAction) actionMethod:(id)arg;
+- (void)foo:(int)x;
+@end
+extern int ibaction_test(void);
+@implementation IBActionTests
+- (IBAction) actionMethod:(id)arg
+{
+ ibaction_test();
+ [self foo:0];
+}
+- (void) foo:(int)x
+{
+ (void) x;
+}
+@end
+
+// From <rdar://problem/7961995>. Essentially the same issue as 7967123,
+// but impacting code marked as IBOutlets.
+@interface IBOutletTests
+{
+ IBOutlet char * anOutlet;
+}
+- (IBAction) actionMethod:(id)arg;
+@property IBOutlet int * aPropOutlet;
+@end
+
+// RUN: c-index-test -test-annotate-tokens=%s:1:1:58:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck %s
+// CHECK: Punctuation: "@" [1:1 - 1:2] ObjCInterfaceDecl=Foo:1:12
+// CHECK: Keyword: "interface" [1:2 - 1:11] ObjCInterfaceDecl=Foo:1:12
// CHECK: Identifier: "Foo" [1:12 - 1:15] ObjCInterfaceDecl=Foo:1:12
// CHECK: Punctuation: "-" [2:1 - 2:2] ObjCInstanceMethodDecl=compare::2:1
-// CHECK: Punctuation: "(" [2:3 - 2:4]
-// CHECK: Keyword: "int" [2:4 - 2:7]
-// CHECK: Punctuation: ")" [2:7 - 2:8]
-// CHECK: Identifier: "compare" [2:8 - 2:15]
-// CHECK: Punctuation: ":" [2:15 - 2:16]
-// CHECK: Punctuation: "(" [2:16 - 2:17]
+// CHECK: Punctuation: "(" [2:3 - 2:4] ObjCInstanceMethodDecl=compare::2:1
+// CHECK: Keyword: "int" [2:4 - 2:7] ObjCInstanceMethodDecl=compare::2:1
+// CHECK: Punctuation: ")" [2:7 - 2:8] ObjCInstanceMethodDecl=compare::2:1
+// CHECK: Identifier: "compare" [2:8 - 2:15] ObjCInstanceMethodDecl=compare::2:1
+// CHECK: Punctuation: ":" [2:15 - 2:16] ObjCInstanceMethodDecl=compare::2:1
+// CHECK: Punctuation: "(" [2:16 - 2:17] ObjCInstanceMethodDecl=compare::2:1
// CHECK: Identifier: "Foo" [2:17 - 2:20] ObjCClassRef=Foo:1:12
-// CHECK: Punctuation: "*" [2:20 - 2:21]
-// CHECK: Punctuation: ")" [2:21 - 2:22]
+// CHECK: Punctuation: "*" [2:20 - 2:21] ParmDecl=other:2:22 (Definition)
+// CHECK: Punctuation: ")" [2:21 - 2:22] ParmDecl=other:2:22 (Definition)
// CHECK: Identifier: "other" [2:22 - 2:27] ParmDecl=other:2:22 (Definition)
-// CHECK: Punctuation: ";" [2:27 - 2:28]
-// CHECK: Punctuation: "@" [3:1 - 3:2]
-// CHECK: Identifier: "end" [3:2 - 3:5]
+// CHECK: Punctuation: ";" [2:27 - 2:28] ObjCInstanceMethodDecl=compare::2:1
+// CHECK: Punctuation: "@" [3:1 - 3:2] ObjCInterfaceDecl=Foo:1:12
+// CHECK: Keyword: "end" [3:2 - 3:5] ObjCInterfaceDecl=Foo:1:12
// CHECK: Punctuation: "@" [5:1 - 5:2] ObjCImplementationDecl=Foo:5:1 (Definition)
-// CHECK: Identifier: "implementation" [5:2 - 5:16]
-// CHECK: Identifier: "Foo" [5:17 - 5:20]
+// CHECK: Keyword: "implementation" [5:2 - 5:16] ObjCImplementationDecl=Foo:5:1 (Definition)
+// CHECK: Identifier: "Foo" [5:17 - 5:20] ObjCImplementationDecl=Foo:5:1 (Definition)
// CHECK: Punctuation: "-" [6:1 - 6:2] ObjCInstanceMethodDecl=compare::6:1 (Definition)
-// CHECK: Punctuation: "(" [6:3 - 6:4]
-// CHECK: Keyword: "int" [6:4 - 6:7]
-// CHECK: Punctuation: ")" [6:7 - 6:8]
-// CHECK: Identifier: "compare" [6:8 - 6:15]
-// CHECK: Punctuation: ":" [6:15 - 6:16]
-// CHECK: Punctuation: "(" [6:16 - 6:17]
+// CHECK: Punctuation: "(" [6:3 - 6:4] ObjCInstanceMethodDecl=compare::6:1 (Definition)
+// CHECK: Keyword: "int" [6:4 - 6:7] ObjCInstanceMethodDecl=compare::6:1 (Definition)
+// CHECK: Punctuation: ")" [6:7 - 6:8] ObjCInstanceMethodDecl=compare::6:1 (Definition)
+// CHECK: Identifier: "compare" [6:8 - 6:15] ObjCInstanceMethodDecl=compare::6:1 (Definition)
+// CHECK: Punctuation: ":" [6:15 - 6:16] ObjCInstanceMethodDecl=compare::6:1 (Definition)
+// CHECK: Punctuation: "(" [6:16 - 6:17] ObjCInstanceMethodDecl=compare::6:1 (Definition)
// CHECK: Identifier: "Foo" [6:17 - 6:20] ObjCClassRef=Foo:1:12
-// CHECK: Punctuation: "*" [6:20 - 6:21]
-// CHECK: Punctuation: ")" [6:21 - 6:22]
+// CHECK: Punctuation: "*" [6:20 - 6:21] ParmDecl=other:6:22 (Definition)
+// CHECK: Punctuation: ")" [6:21 - 6:22] ParmDecl=other:6:22 (Definition)
// CHECK: Identifier: "other" [6:22 - 6:27] ParmDecl=other:6:22 (Definition)
-// CHECK: Punctuation: "{" [6:28 - 6:29]
-// CHECK: Keyword: "return" [7:3 - 7:9]
-// CHECK: Literal: "0" [7:10 - 7:11]
-// CHECK: Punctuation: ";" [7:11 - 7:12]
-// CHECK: Punctuation: "(" [8:3 - 8:4]
-// CHECK: Keyword: "void" [8:4 - 8:8]
-// CHECK: Punctuation: ")" [8:8 - 8:9]
-// CHECK: Punctuation: "@" [8:9 - 8:10]
-// CHECK: Identifier: "encode" [8:10 - 8:16]
-// CHECK: Punctuation: "(" [8:16 - 8:17]
+// CHECK: Punctuation: "{" [6:28 - 6:29] UnexposedStmt=
+// CHECK: Keyword: "return" [7:3 - 7:9] UnexposedStmt=
+// CHECK: Literal: "0" [7:10 - 7:11] UnexposedExpr=
+// CHECK: Punctuation: ";" [7:11 - 7:12] UnexposedStmt=
+// CHECK: Punctuation: "(" [8:3 - 8:4] UnexposedExpr=
+// CHECK: Keyword: "void" [8:4 - 8:8] UnexposedExpr=
+// CHECK: Punctuation: ")" [8:8 - 8:9] UnexposedExpr=
+// CHECK: Punctuation: "@" [8:9 - 8:10] UnexposedExpr=
+// CHECK: Keyword: "encode" [8:10 - 8:16] UnexposedExpr=
+// CHECK: Punctuation: "(" [8:16 - 8:17] UnexposedExpr=
// CHECK: Identifier: "Foo" [8:17 - 8:20] ObjCClassRef=Foo:1:12
-// CHECK: Punctuation: ")" [8:20 - 8:21]
-// CHECK: Punctuation: ";" [8:21 - 8:22]
-// CHECK: Punctuation: "}" [9:1 - 9:2]
-// CHECK: Punctuation: "@" [10:1 - 10:2]
-// CHECK: Identifier: "end" [10:2 - 10:5]
+// CHECK: Punctuation: ")" [8:20 - 8:21] UnexposedExpr=
+// CHECK: Punctuation: ";" [8:21 - 8:22] UnexposedStmt=
+// CHECK: Punctuation: "}" [9:1 - 9:2] UnexposedStmt=
+// CHECK: Punctuation: "@" [10:1 - 10:2] ObjCImplementationDecl=Foo:5:1 (Definition)
+// CHECK: Keyword: "end" [10:2 - 10:5]
+// CHECK: Keyword: "typedef" [14:1 - 14:8]
+// CHECK: Keyword: "int" [14:9 - 14:12]
+// CHECK: Punctuation: "*" [14:13 - 14:14]
+// CHECK: Identifier: "barType" [14:15 - 14:22] TypedefDecl=barType:14:15 (Definition)
+// CHECK: Punctuation: ";" [14:22 - 14:23]
+// CHECK: Punctuation: "@" [15:1 - 15:2] ObjCInterfaceDecl=Bar:15:12
+// CHECK: Keyword: "interface" [15:2 - 15:11] ObjCInterfaceDecl=Bar:15:12
+// CHECK: Identifier: "Bar" [15:12 - 15:15] ObjCInterfaceDecl=Bar:15:12
+// CHECK: Punctuation: "{" [16:1 - 16:2] ObjCInterfaceDecl=Bar:15:12
+// CHECK: Identifier: "barType" [17:5 - 17:12] TypeRef=barType:14:15
+// CHECK: Identifier: "iVar" [17:13 - 17:17] ObjCIvarDecl=iVar:17:13 (Definition)
+// CHECK: Punctuation: ";" [17:17 - 17:18] ObjCInterfaceDecl=Bar:15:12
+// CHECK: Identifier: "barType" [18:5 - 18:12] TypeRef=barType:14:15
+// CHECK: Identifier: "iVar1" [18:13 - 18:18] ObjCIvarDecl=iVar1:18:13 (Definition)
+// CHECK: Punctuation: "," [18:18 - 18:19] ObjCIvarDecl=iVar2:18:20 (Definition)
+// CHECK: Identifier: "iVar2" [18:20 - 18:25] ObjCIvarDecl=iVar2:18:20 (Definition)
+// CHECK: Punctuation: ";" [18:25 - 18:26] ObjCInterfaceDecl=Bar:15:12
+// CHECK: Punctuation: "}" [19:1 - 19:2] ObjCInterfaceDecl=Bar:15:12
+// CHECK: Punctuation: "@" [20:1 - 20:2] ObjCInterfaceDecl=Bar:15:12
+// CHECK: Keyword: "end" [20:2 - 20:5] ObjCInterfaceDecl=Bar:15:12
+// CHECK: Punctuation: "@" [21:1 - 21:2] ObjCImplementationDecl=Bar:21:1 (Definition)
+// CHECK: Keyword: "implementation" [21:2 - 21:16] ObjCImplementationDecl=Bar:21:1 (Definition)
+// CHECK: Identifier: "Bar" [21:17 - 21:20] ObjCImplementationDecl=Bar:21:1 (Definition)
+// CHECK: Punctuation: "-" [22:1 - 22:2] ObjCInstanceMethodDecl=method:22:1 (Definition)
+// CHECK: Punctuation: "(" [22:3 - 22:4] ObjCInstanceMethodDecl=method:22:1 (Definition)
+// CHECK: Keyword: "void" [22:4 - 22:8] ObjCInstanceMethodDecl=method:22:1 (Definition)
+// CHECK: Punctuation: ")" [22:8 - 22:9] ObjCInstanceMethodDecl=method:22:1 (Definition)
+// CHECK: Identifier: "method" [22:10 - 22:16] ObjCInstanceMethodDecl=method:22:1 (Definition)
+// CHECK: Punctuation: "{" [23:1 - 23:2] UnexposedStmt=
+// CHECK: Identifier: "barType" [24:5 - 24:12] TypeRef=barType:14:15
+// CHECK: Identifier: "local" [24:13 - 24:18] VarDecl=local:24:13 (Definition)
+// CHECK: Punctuation: "=" [24:19 - 24:20] VarDecl=local:24:13 (Definition)
+// CHECK: Identifier: "iVar" [24:21 - 24:25] MemberRefExpr=iVar:17:13
+// CHECK: Punctuation: ";" [24:25 - 24:26] UnexposedStmt=
+// CHECK: Punctuation: "}" [25:1 - 25:2] UnexposedStmt=
+// CHECK: Punctuation: "@" [26:1 - 26:2] ObjCImplementationDecl=Bar:21:1 (Definition)
+// CHECK: Keyword: "end" [26:2 - 26:5]
+// CHECK: Punctuation: "@" [32:1 - 32:2] ObjCInterfaceDecl=IBActionTests:32:12
+// CHECK: Keyword: "interface" [32:2 - 32:11] ObjCInterfaceDecl=IBActionTests:32:12
+// CHECK: Identifier: "IBActionTests" [32:12 - 32:25] ObjCInterfaceDecl=IBActionTests:32:12
+// CHECK: Punctuation: "-" [33:1 - 33:2] ObjCInstanceMethodDecl=actionMethod::33:1
+// CHECK: Punctuation: "(" [33:3 - 33:4] ObjCInstanceMethodDecl=actionMethod::33:1
+// CHECK: Identifier: "IBAction" [33:4 - 33:12] macro instantiation=IBAction
+// CHECK: Punctuation: ")" [33:12 - 33:13] ObjCInstanceMethodDecl=actionMethod::33:1
+// CHECK: Identifier: "actionMethod" [33:14 - 33:26] ObjCInstanceMethodDecl=actionMethod::33:1
+// CHECK: Punctuation: ":" [33:26 - 33:27] ObjCInstanceMethodDecl=actionMethod::33:1
+// CHECK: Punctuation: "(" [33:27 - 33:28] ObjCInstanceMethodDecl=actionMethod::33:1
+// CHECK: Identifier: "id" [33:28 - 33:30] TypeRef=id:0:0
+// CHECK: Punctuation: ")" [33:30 - 33:31] ParmDecl=arg:33:31 (Definition)
+// CHECK: Identifier: "arg" [33:31 - 33:34] ParmDecl=arg:33:31 (Definition)
+// CHECK: Punctuation: ";" [33:34 - 33:35] ObjCInstanceMethodDecl=actionMethod::33:1
+// CHECK: Punctuation: "-" [34:1 - 34:2] ObjCInstanceMethodDecl=foo::34:1
+// CHECK: Punctuation: "(" [34:3 - 34:4] ObjCInstanceMethodDecl=foo::34:1
+// CHECK: Keyword: "void" [34:4 - 34:8] ObjCInstanceMethodDecl=foo::34:1
+// CHECK: Punctuation: ")" [34:8 - 34:9] ObjCInstanceMethodDecl=foo::34:1
+// CHECK: Identifier: "foo" [34:9 - 34:12] ObjCInstanceMethodDecl=foo::34:1
+// CHECK: Punctuation: ":" [34:12 - 34:13] ObjCInstanceMethodDecl=foo::34:1
+// CHECK: Punctuation: "(" [34:13 - 34:14] ObjCInstanceMethodDecl=foo::34:1
+// CHECK: Keyword: "int" [34:14 - 34:17] ParmDecl=x:34:18 (Definition)
+// CHECK: Punctuation: ")" [34:17 - 34:18] ParmDecl=x:34:18 (Definition)
+// CHECK: Identifier: "x" [34:18 - 34:19] ParmDecl=x:34:18 (Definition)
+// CHECK: Punctuation: ";" [34:19 - 34:20] ObjCInstanceMethodDecl=foo::34:1
+// CHECK: Punctuation: "@" [35:1 - 35:2] ObjCInterfaceDecl=IBActionTests:32:12
+// CHECK: Keyword: "end" [35:2 - 35:5] ObjCInterfaceDecl=IBActionTests:32:12
+// CHECK: Keyword: "extern" [36:1 - 36:7]
+// CHECK: Keyword: "int" [36:8 - 36:11] FunctionDecl=ibaction_test:36:12
+// CHECK: Identifier: "ibaction_test" [36:12 - 36:25] FunctionDecl=ibaction_test:36:12
+// CHECK: Punctuation: "(" [36:25 - 36:26] FunctionDecl=ibaction_test:36:12
+// CHECK: Keyword: "void" [36:26 - 36:30] FunctionDecl=ibaction_test:36:12
+// CHECK: Punctuation: ")" [36:30 - 36:31] FunctionDecl=ibaction_test:36:12
+// CHECK: Punctuation: ";" [36:31 - 36:32]
+// CHECK: Punctuation: "@" [37:1 - 37:2] ObjCImplementationDecl=IBActionTests:37:1 (Definition)
+// CHECK: Keyword: "implementation" [37:2 - 37:16] ObjCImplementationDecl=IBActionTests:37:1 (Definition)
+// CHECK: Identifier: "IBActionTests" [37:17 - 37:30] ObjCImplementationDecl=IBActionTests:37:1 (Definition)
+// CHECK: Punctuation: "-" [38:1 - 38:2] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition)
+// CHECK: Punctuation: "(" [38:3 - 38:4] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition)
+// CHECK: Identifier: "IBAction" [38:4 - 38:12] macro instantiation=IBAction
+// CHECK: Punctuation: ")" [38:12 - 38:13] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition)
+// CHECK: Identifier: "actionMethod" [38:14 - 38:26] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition)
+// CHECK: Punctuation: ":" [38:26 - 38:27] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition)
+// CHECK: Punctuation: "(" [38:27 - 38:28] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition)
+// CHECK: Identifier: "id" [38:28 - 38:30] TypeRef=id:0:0
+// CHECK: Punctuation: ")" [38:30 - 38:31] ParmDecl=arg:38:31 (Definition)
+// CHECK: Identifier: "arg" [38:31 - 38:34] ParmDecl=arg:38:31 (Definition)
+// CHECK: Punctuation: "{" [39:1 - 39:2] UnexposedStmt=
+// CHECK: Identifier: "ibaction_test" [40:5 - 40:18] DeclRefExpr=ibaction_test:36:12
+// CHECK: Punctuation: "(" [40:18 - 40:19] CallExpr=ibaction_test:36:12
+// CHECK: Punctuation: ")" [40:19 - 40:20] CallExpr=ibaction_test:36:12
+// CHECK: Punctuation: ";" [40:20 - 40:21] UnexposedStmt=
+// CHECK: Punctuation: "[" [41:5 - 41:6] ObjCMessageExpr=foo::34:1
+// CHECK: Identifier: "self" [41:6 - 41:10] DeclRefExpr=self:0:0
+// CHECK: Identifier: "foo" [41:11 - 41:14] ObjCMessageExpr=foo::34:1
+// CHECK: Punctuation: ":" [41:14 - 41:15] ObjCMessageExpr=foo::34:1
+// CHECK: Literal: "0" [41:15 - 41:16] UnexposedExpr=
+// CHECK: Punctuation: "]" [41:16 - 41:17] ObjCMessageExpr=foo::34:1
+// CHECK: Punctuation: ";" [41:17 - 41:18] UnexposedStmt=
+// CHECK: Punctuation: "}" [42:1 - 42:2] UnexposedStmt=
+// CHECK: Punctuation: "-" [43:1 - 43:2] ObjCInstanceMethodDecl=foo::43:1 (Definition)
+// CHECK: Punctuation: "(" [43:3 - 43:4] ObjCInstanceMethodDecl=foo::43:1 (Definition)
+// CHECK: Keyword: "void" [43:4 - 43:8] ObjCInstanceMethodDecl=foo::43:1 (Definition)
+// CHECK: Punctuation: ")" [43:8 - 43:9] ObjCInstanceMethodDecl=foo::43:1 (Definition)
+// CHECK: Identifier: "foo" [43:10 - 43:13] ObjCInstanceMethodDecl=foo::43:1 (Definition)
+// CHECK: Punctuation: ":" [43:13 - 43:14] ObjCInstanceMethodDecl=foo::43:1 (Definition)
+// CHECK: Punctuation: "(" [43:14 - 43:15] ObjCInstanceMethodDecl=foo::43:1 (Definition)
+// CHECK: Keyword: "int" [43:15 - 43:18] ParmDecl=x:43:19 (Definition)
+// CHECK: Punctuation: ")" [43:18 - 43:19] ParmDecl=x:43:19 (Definition)
+// CHECK: Identifier: "x" [43:19 - 43:20] ParmDecl=x:43:19 (Definition)
+// CHECK: Punctuation: "{" [44:1 - 44:2] UnexposedStmt=
+// CHECK: Punctuation: "(" [45:3 - 45:4] UnexposedExpr=x:43:19
+// CHECK: Keyword: "void" [45:4 - 45:8] UnexposedExpr=x:43:19
+// CHECK: Punctuation: ")" [45:8 - 45:9] UnexposedExpr=x:43:19
+// CHECK: Identifier: "x" [45:10 - 45:11] DeclRefExpr=x:43:19
+// CHECK: Punctuation: ";" [45:11 - 45:12] UnexposedStmt=
+// CHECK: Punctuation: "}" [46:1 - 46:2] UnexposedStmt=
+// CHECK: Punctuation: "@" [47:1 - 47:2] ObjCImplementationDecl=IBActionTests:37:1 (Definition)
+// CHECK: Keyword: "end" [47:2 - 47:5]
+// CHECK: Punctuation: "@" [51:1 - 51:2] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Keyword: "interface" [51:2 - 51:11] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Identifier: "IBOutletTests" [51:12 - 51:25] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: "{" [52:1 - 52:2] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Identifier: "IBOutlet" [53:5 - 53:13] macro instantiation=IBOutlet:{{[0-9]+}}:{{[0-9]+}}
+// CHECK: Keyword: "char" [53:14 - 53:18] ObjCIvarDecl=anOutlet:53:21 (Definition)
+// CHECK: Punctuation: "*" [53:19 - 53:20] ObjCIvarDecl=anOutlet:53:21 (Definition)
+// CHECK: Identifier: "anOutlet" [53:21 - 53:29] ObjCIvarDecl=anOutlet:53:21 (Definition)
+// CHECK: Punctuation: ";" [53:29 - 53:30] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: "}" [54:1 - 54:2] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: "-" [55:1 - 55:2] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: "(" [55:3 - 55:4] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Identifier: "IBAction" [55:4 - 55:12] macro instantiation=IBAction
+// CHECK: Punctuation: ")" [55:12 - 55:13] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Identifier: "actionMethod" [55:14 - 55:26] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: ":" [55:26 - 55:27] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: "(" [55:27 - 55:28] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Identifier: "id" [55:28 - 55:30] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: ")" [55:30 - 55:31] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Identifier: "arg" [55:31 - 55:34] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: ";" [55:34 - 55:35] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: "@" [56:1 - 56:2] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Keyword: "property" [56:2 - 56:10] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Identifier: "IBOutlet" [56:11 - 56:19] macro instantiation=IBOutlet:{{[0-9]+}}:{{[0-9]+}}
+// CHECK: Keyword: "int" [56:20 - 56:23] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: "*" [56:24 - 56:25] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Identifier: "aPropOutlet" [56:26 - 56:37] ObjCPropertyDecl=aPropOutlet:56:26
+// CHECK: Punctuation: ";" [56:37 - 56:38] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: "@" [57:1 - 57:2] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Keyword: "end" [57:2 - 57:5] ObjCInterfaceDecl=IBOutletTests:51:12
+
diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m
index 5b2f86e..22875db 100644
--- a/test/Index/c-index-api-loadTU-test.m
+++ b/test/Index/c-index-api-loadTU-test.m
@@ -54,12 +54,24 @@ int main (int argc, const char * argv[]) {
main(someEnum, (const char **)bee);
}
+// Test attribute traversal.
+#define IBOutlet __attribute__((iboutlet))
+#define IBOutletCollection(ClassName) __attribute__((iboutletcollection))
+#define IBAction void)__attribute__((ibaction)
+
+@interface TestAttributes {
+ IBOutlet char * anOutlet;
+ IBOutletCollection(id) id anOutletCollection;
+}
+- (IBAction) actionMethod:(id)arg;
+@end
+
// CHECK: c-index-api-loadTU-test.m:4:12: ObjCInterfaceDecl=Foo:4:12 Extent=[4:1 - 12:5]
// CHECK: c-index-api-loadTU-test.m:6:32: ObjCIvarDecl=myoutlet:6:32 (Definition) Extent=[6:32 - 6:40]
-// CHECK: c-index-api-loadTU-test.m:6:32: attribute(iboutlet)= Extent=[6:32 - 6:40]
+// CHECK: <invalid loc>:0:0: attribute(iboutlet)=
// CHECK: c-index-api-loadTU-test.m:6:29: TypeRef=id:0:0 Extent=[6:29 - 6:31]
// CHECK: c-index-api-loadTU-test.m:8:1: ObjCInstanceMethodDecl=myMessage::8:1 Extent=[8:1 - 8:54]
-// CHECK: c-index-api-loadTU-test.m:8:1: attribute(ibaction)= Extent=[8:1 - 8:54]
+// CHECK: <invalid loc>:0:0: attribute(ibaction)=
// CHECK: c-index-api-loadTU-test.m:8:50: ParmDecl=msg:8:50 (Definition) Extent=[8:47 - 8:53]
// CHECK: c-index-api-loadTU-test.m:8:47: TypeRef=id:0:0 Extent=[8:47 - 8:49]
// CHECK: c-index-api-loadTU-test.m:9:1: ObjCInstanceMethodDecl=foo:9:1 Extent=[9:1 - 9:7]
@@ -81,27 +93,29 @@ int main (int argc, const char * argv[]) {
// CHECK: c-index-api-loadTU-test.m:33:23: ObjCProtocolRef=SubP:29:1 Extent=[33:23 - 33:27]
// CHECK: c-index-api-loadTU-test.m:35:9: ObjCIvarDecl=_anIVar:35:9 (Definition) Extent=[35:9 - 35:16]
// CHECK: c-index-api-loadTU-test.m:38:1: ObjCInstanceMethodDecl=bazMethod:38:1 Extent=[38:1 - 38:21]
+// CHECK: c-index-api-loadTU-test.m:38:4: ObjCClassRef=Foo:4:12 Extent=[38:4 - 38:7]
// CHECK: c-index-api-loadTU-test.m:42:1: EnumDecl=:42:1 (Definition) Extent=[42:1 - 44:2]
// CHECK: c-index-api-loadTU-test.m:43:3: EnumConstantDecl=someEnum:43:3 (Definition) Extent=[43:3 - 43:11]
// CHECK: c-index-api-loadTU-test.m:46:5: FunctionDecl=main:46:5 (Definition) Extent=[46:5 - 55:2]
// CHECK: c-index-api-loadTU-test.m:46:15: ParmDecl=argc:46:15 (Definition) Extent=[46:11 - 46:19]
// CHECK: c-index-api-loadTU-test.m:46:34: ParmDecl=argv:46:34 (Definition) Extent=[46:27 - 46:38]
-// CHECK: c-index-api-loadTU-test.m:46:5: UnexposedStmt= Extent=[46:42 - 55:2]
-// CHECK: c-index-api-loadTU-test.m:46:5: UnexposedStmt= Extent=[47:2 - 47:12]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[46:42 - 55:2]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[47:2 - 47:12]
// CHECK: c-index-api-loadTU-test.m:47:8: VarDecl=bee:47:8 (Definition) Extent=[47:2 - 47:11]
// CHECK: c-index-api-loadTU-test.m:47:2: ObjCClassRef=Baz:33:12 Extent=[47:2 - 47:5]
-// CHECK: c-index-api-loadTU-test.m:47:8: UnexposedStmt= Extent=[48:2 - 48:19]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[48:2 - 48:19]
// CHECK: c-index-api-loadTU-test.m:48:5: VarDecl=a:48:5 (Definition) Extent=[48:2 - 48:18]
// CHECK: c-index-api-loadTU-test.m:48:2: TypeRef=id:0:0 Extent=[48:2 - 48:4]
// CHECK: c-index-api-loadTU-test.m:48:9: ObjCMessageExpr=foo:9:1 Extent=[48:9 - 48:18]
// CHECK: c-index-api-loadTU-test.m:48:10: DeclRefExpr=bee:47:8 Extent=[48:10 - 48:13]
-// CHECK: c-index-api-loadTU-test.m:48:5: UnexposedStmt= Extent=[49:2 - 49:27]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[49:2 - 49:27]
// CHECK: c-index-api-loadTU-test.m:49:12: VarDecl=c:49:12 (Definition) Extent=[49:2 - 49:26]
// CHECK: c-index-api-loadTU-test.m:49:2: TypeRef=id:0:0 Extent=[49:2 - 49:4]
// CHECK: c-index-api-loadTU-test.m:49:6: ObjCProtocolRef=SubP:29:1 Extent=[49:6 - 49:10]
// CHECK: c-index-api-loadTU-test.m:49:16: UnexposedExpr=fooC:10:1 Extent=[49:16 - 49:26]
// CHECK: c-index-api-loadTU-test.m:49:16: ObjCMessageExpr=fooC:10:1 Extent=[49:16 - 49:26]
-// CHECK: c-index-api-loadTU-test.m:49:12: UnexposedStmt= Extent=[50:2 - 50:15]
+// CHECK: c-index-api-loadTU-test.m:49:17: ObjCClassRef=Foo:4:12 Extent=[49:17 - 49:20]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[50:2 - 50:15]
// CHECK: c-index-api-loadTU-test.m:50:13: VarDecl=d:50:13 (Definition) Extent=[50:2 - 50:14]
// CHECK: c-index-api-loadTU-test.m:50:2: TypeRef=id:0:0 Extent=[50:2 - 50:4]
// CHECK: c-index-api-loadTU-test.m:50:6: ObjCProtocolRef=Proto:25:1 Extent=[50:6 - 50:11]
@@ -121,4 +135,14 @@ int main (int argc, const char * argv[]) {
// CHECK: c-index-api-loadTU-test.m:54:8: DeclRefExpr=someEnum:43:3 Extent=[54:8 - 54:16]
// CHECK: c-index-api-loadTU-test.m:54:18: UnexposedExpr=bee:47:8 Extent=[54:18 - 54:36]
// CHECK: c-index-api-loadTU-test.m:54:33: DeclRefExpr=bee:47:8 Extent=[54:33 - 54:36]
+// CHECK: c-index-api-loadTU-test.m:62:12: ObjCInterfaceDecl=TestAttributes:62:12 Extent=[62:1 - 67:5]
+// CHECK: c-index-api-loadTU-test.m:63:19: ObjCIvarDecl=anOutlet:63:19 (Definition) Extent=[63:19 - 63:27]
+// CHECK: <invalid loc>:0:0: attribute(iboutlet)=
+// CHECK: c-index-api-loadTU-test.m:64:29: ObjCIvarDecl=anOutletCollection:64:29 (Definition) Extent=[64:29 - 64:47]
+// CHECK: <invalid loc>:0:0: attribute(iboutletcollection)=
+// CHECK: c-index-api-loadTU-test.m:64:26: TypeRef=id:0:0 Extent=[64:26 - 64:28]
+// CHECK: c-index-api-loadTU-test.m:66:1: ObjCInstanceMethodDecl=actionMethod::66:1 Extent=[66:1 - 66:35]
+// CHECK: <invalid loc>:0:0: attribute(ibaction)=
+// CHECK: c-index-api-loadTU-test.m:66:31: ParmDecl=arg:66:31 (Definition) Extent=[66:28 - 66:34]
+// CHECK: c-index-api-loadTU-test.m:66:28: TypeRef=id:0:0 Extent=[66:28 - 66:30]
diff --git a/test/Index/complete-at-directives.m b/test/Index/complete-at-directives.m
index 811bca0..a278ce8 100644
--- a/test/Index/complete-at-directives.m
+++ b/test/Index/complete-at-directives.m
@@ -5,25 +5,25 @@
@implementation MyClass
@end
-// RUN: c-index-test -code-completion-at=%s:2:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:2:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: {TypedText class}{HorizontalSpace }{Placeholder identifier}
// CHECK-CC1: {TypedText compatibility_alias}{HorizontalSpace }{Placeholder alias}{HorizontalSpace }{Placeholder class}
// CHECK-CC1: {TypedText implementation}{HorizontalSpace }{Placeholder class}
// CHECK-CC1: {TypedText interface}{HorizontalSpace }{Placeholder class}
// CHECK-CC1: {TypedText protocol}{HorizontalSpace }{Placeholder protocol}
-// RUN: c-index-test -code-completion-at=%s:3:2 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: c-index-test -code-completion-at=%s:3:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: {TypedText end}
// CHECK-CC2: {TypedText optional}
// CHECK-CC2: {TypedText property}
// CHECK-CC2: {TypedText required}
-// RUN: c-index-test -code-completion-at=%s:6:2 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: c-index-test -code-completion-at=%s:6:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: {TypedText dynamic}{HorizontalSpace }{Placeholder property}
// CHECK-CC3: {TypedText end}
// CHECK-CC3: {TypedText synthesize}{HorizontalSpace }{Placeholder property}
-// RUN: c-index-test -code-completion-at=%s:2:1 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: c-index-test -code-completion-at=%s:2:1 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: NotImplemented:{TypedText @class}{HorizontalSpace }{Placeholder identifier}
// CHECK-CC4: NotImplemented:{TypedText @compatibility_alias}{HorizontalSpace }{Placeholder alias}{HorizontalSpace }{Placeholder class}
// CHECK-CC4: NotImplemented:{TypedText @implementation}{HorizontalSpace }{Placeholder class}
@@ -34,7 +34,7 @@
// CHECK-CC4: TypedefDecl:{TypedText id}
// CHECK-CC4: TypedefDecl:{TypedText SEL}
-// RUN: c-index-test -code-completion-at=%s:3:1 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: c-index-test -code-completion-at=%s:3:1 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5: {TypedText @end}
// CHECK-CC5: {TypedText @optional}
// CHECK-CC5: {TypedText @property}
@@ -45,13 +45,13 @@
// CHECK-CC5: ObjCInterfaceDecl:{TypedText MyClass}
// CHECK-CC5: TypedefDecl:{TypedText SEL}
-// RUN: c-index-test -code-completion-at=%s:2:23 %s | FileCheck -check-prefix=CHECK-CC6 %s
+// RUN: c-index-test -code-completion-at=%s:2:23 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
// CHECK-CC6: NotImplemented:{TypedText package}
// CHECK-CC6: NotImplemented:{TypedText private}
// CHECK-CC6: NotImplemented:{TypedText protected}
// CHECK-CC6: NotImplemented:{TypedText public}
-// RUN: c-index-test -code-completion-at=%s:2:22 %s | FileCheck -check-prefix=CHECK-CC7 %s
+// RUN: c-index-test -code-completion-at=%s:2:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
// CHECK-CC7: NotImplemented:{TypedText @package}
// CHECK-CC7: NotImplemented:{TypedText @private}
// CHECK-CC7: NotImplemented:{TypedText @protected}
diff --git a/test/Index/complete-at-exprstmt.m b/test/Index/complete-at-exprstmt.m
index 87e554f..8537098 100644
--- a/test/Index/complete-at-exprstmt.m
+++ b/test/Index/complete-at-exprstmt.m
@@ -9,18 +9,18 @@
@synchronized (@encode(MyClass)) { }
}
@end
-// RUN: c-index-test -code-completion-at=%s:9:4 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:9:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )}
// CHECK-CC1: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
// CHECK-CC1: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
// CHECK-CC1: {TypedText synchronized}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}
// CHECK-CC1: {TypedText throw}{HorizontalSpace }{Placeholder expression}
// CHECK-CC1: {TypedText try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }}
-// RUN: c-index-test -code-completion-at=%s:9:19 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: c-index-test -code-completion-at=%s:9:19 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )}
// CHECK-CC2: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
// CHECK-CC2: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
-// RUN: c-index-test -code-completion-at=%s:9:3 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: c-index-test -code-completion-at=%s:9:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
// CHECK-CC3: NotImplemented:{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
// CHECK-CC3: NotImplemented:{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )}
diff --git a/test/Index/complete-exprs.c b/test/Index/complete-exprs.c
index efc82f9..65af241 100644
--- a/test/Index/complete-exprs.c
+++ b/test/Index/complete-exprs.c
@@ -7,9 +7,12 @@ int test(int i, int j, int k, int l) {
return i | j | k & l;
}
-// RUN: c-index-test -code-completion-at=%s:7:9 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )}
-// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
-// RUN: c-index-test -code-completion-at=%s:7:14 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// RUN: c-index-test -code-completion-at=%s:7:18 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// RUN: c-index-test -code-completion-at=%s:7:22 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
+// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
+// CHECK-CC1: NotImplemented:{TypedText float} (40)
+// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (8)
+// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
+// RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
diff --git a/test/Index/complete-member-access.m b/test/Index/complete-member-access.m
index 2502d77..82efb95 100644
--- a/test/Index/complete-member-access.m
+++ b/test/Index/complete-member-access.m
@@ -26,5 +26,5 @@ void test_props(Int* ptr) {
// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText prop1}
// CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp}
// RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText IVar}
-// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText SuperIVar}
+// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText IVar} (20)
+// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText SuperIVar} (22)
diff --git a/test/Index/complete-recovery.m b/test/Index/complete-recovery.m
new file mode 100644
index 0000000..c28438d
--- /dev/null
+++ b/test/Index/complete-recovery.m
@@ -0,0 +1,21 @@
+/* Run lines are at the end, since line/column matter in this test. */
+
+@interface A
+- (void)method:(int)x;
+@end
+
+@implementation A
+- (void)method:(int)x {
+ A *a = [A method:1];
+ blarg * blah = wibble
+}
+@end
+
+// RUN: c-index-test -code-completion-at=%s:9:20 -Xclang -code-completion-patterns %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: not grep error %t
+// CHECK-CC1: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
+// CHECK-CC1: NotImplemented:{TypedText _Bool}
+// CHECK-CC1: VarDecl:{ResultType A *}{TypedText a}
+// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
+
+// RUN: c-index-test -code-completion-at=%s:10:24 -Xclang -code-completion-patterns %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
diff --git a/test/Index/load-stmts.cpp b/test/Index/load-stmts.cpp
index fdfedfb..cb99aee 100644
--- a/test/Index/load-stmts.cpp
+++ b/test/Index/load-stmts.cpp
@@ -11,8 +11,15 @@ void f(int x) {
}
// RUN: c-index-test -test-load-source all %s | FileCheck %s
-// CHECK: load-stmts.cpp:3:6: UnexposedStmt= Extent=[4:3 - 5:4]
-// CHECK: load-stmts.cpp:3:6: UnexposedStmt= Extent=[4:8 - 4:16]
+// CHECK: load-stmts.cpp:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:13 - 1:14]
+// CHECK: load-stmts.cpp:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23]
+// CHECK: load-stmts.cpp:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:16 - 2:17]
+// CHECK: load-stmts.cpp:2:19: FieldDecl=b:2:19 (Definition) Extent=[2:19 - 2:20]
+// CHECK: load-stmts.cpp:3:6: FunctionDecl=f:3:6 (Definition) Extent=[3:6 - 11:2]
+// CHECK: load-stmts.cpp:3:12: ParmDecl=x:3:12 (Definition) Extent=[3:8 - 3:13]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[3:15 - 11:2]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[4:3 - 5:4]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[4:8 - 4:16]
// CHECK: load-stmts.cpp:4:10: VarDecl=y:4:10 (Definition) Extent=[4:8 - 4:15]
// CHECK: load-stmts.cpp:4:8: TypeRef=T:1:13 Extent=[4:8 - 4:9]
// CHECK: load-stmts.cpp:4:14: DeclRefExpr=x:3:12 Extent=[4:14 - 4:15]
@@ -23,29 +30,30 @@ void f(int x) {
// CHECK: load-stmts.cpp:4:19: DeclRefExpr=z:4:19 Extent=[4:19 - 4:20]
// CHECK: load-stmts.cpp:4:26: UnexposedExpr= Extent=[4:26 - 4:29]
// CHECK: load-stmts.cpp:4:28: DeclRefExpr=x:3:12 Extent=[4:28 - 4:29]
-// CHECK: load-stmts.cpp:4:19: UnexposedStmt= Extent=[4:31 - 5:4]
-// CHECK: load-stmts.cpp:4:19: UnexposedStmt= Extent=[6:3 - 6:22]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[4:31 - 5:4]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[6:3 - 6:22]
// CHECK: load-stmts.cpp:6:10: VarDecl=z2:6:10 (Definition) Extent=[6:7 - 6:17]
// CHECK: load-stmts.cpp:6:7: TypeRef=T:1:13 Extent=[6:7 - 6:8]
// CHECK: load-stmts.cpp:6:15: UnexposedExpr= Extent=[6:15 - 6:17]
// CHECK: load-stmts.cpp:6:16: DeclRefExpr=x:3:12 Extent=[6:16 - 6:17]
// CHECK: load-stmts.cpp:6:10: UnexposedExpr=z2:6:10 Extent=[6:10 - 6:12]
// CHECK: load-stmts.cpp:6:10: DeclRefExpr=z2:6:10 Extent=[6:10 - 6:12]
-// CHECK: load-stmts.cpp:6:10: UnexposedStmt= Extent=[6:19 - 6:22]
-// CHECK: load-stmts.cpp:6:10: UnexposedStmt= Extent=[7:3 - 7:25]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[6:19 - 6:22]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[7:3 - 7:25]
// CHECK: load-stmts.cpp:7:13: VarDecl=z3:7:13 (Definition) Extent=[7:10 - 7:20]
// CHECK: load-stmts.cpp:7:10: TypeRef=T:1:13 Extent=[7:10 - 7:11]
// CHECK: load-stmts.cpp:7:18: UnexposedExpr= Extent=[7:18 - 7:20]
// CHECK: load-stmts.cpp:7:19: DeclRefExpr=x:3:12 Extent=[7:19 - 7:20]
// CHECK: load-stmts.cpp:7:13: UnexposedExpr=z3:7:13 Extent=[7:13 - 7:15]
// CHECK: load-stmts.cpp:7:13: DeclRefExpr=z3:7:13 Extent=[7:13 - 7:15]
-// CHECK: load-stmts.cpp:7:13: UnexposedStmt= Extent=[7:22 - 7:25]
-// CHECK: load-stmts.cpp:7:13: UnexposedStmt= Extent=[8:3 - 10:4]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[7:22 - 7:25]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[8:3 - 10:4]
// CHECK: load-stmts.cpp:8:13: VarDecl=z4:8:13 (Definition) Extent=[8:11 - 8:19]
// CHECK: load-stmts.cpp:8:11: TypeRef=T:1:13 Extent=[8:11 - 8:12]
// CHECK: load-stmts.cpp:8:18: DeclRefExpr=x:3:12 Extent=[8:18 - 8:19]
// CHECK: load-stmts.cpp:8:13: DeclRefExpr=z4:8:13 Extent=[8:13 - 8:15]
-// CHECK: load-stmts.cpp:8:13: UnexposedStmt= Extent=[8:21 - 10:4]
-// CHECK: load-stmts.cpp:8:13: UnexposedStmt= Extent=[9:3 - 9:17]
-// CHECK: load-stmts.cpp:8:13: UnexposedStmt= Extent=[9:12 - 9:17]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[8:21 - 10:4]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[9:3 - 9:17]
// CHECK: load-stmts.cpp:9:8: UnexposedExpr= Extent=[9:8 - 9:10]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[9:12 - 9:17]
+
diff --git a/test/Index/print-typekind.c b/test/Index/print-typekind.c
new file mode 100644
index 0000000..79a9965
--- /dev/null
+++ b/test/Index/print-typekind.c
@@ -0,0 +1,20 @@
+typedef int FooType;
+int *p;
+int *f(int *p, char *x, FooType z) {
+ FooType w = z;
+ return p + z;
+}
+
+// RUN: c-index-test -test-print-typekind %s | FileCheck %s
+// CHECK: TypedefDecl=FooType:1:13 (Definition) typekind=Typedef [canonical=Int]
+// CHECK: VarDecl=p:2:6 typekind=Pointer
+// CHECK: FunctionDecl=f:3:6 (Definition) typekind=Unexposed [canonical=Unexposed]
+// CHECK: ParmDecl=p:3:13 (Definition) typekind=Pointer
+// CHECK: ParmDecl=x:3:22 (Definition) typekind=Pointer
+// CHECK: ParmDecl=z:3:33 (Definition) typekind=Typedef [canonical=Int]
+// CHECK: VarDecl=w:4:11 (Definition) typekind=Typedef [canonical=Int]
+// CHECK: DeclRefExpr=z:3:33 typekind=Typedef [canonical=Int]
+// CHECK: UnexposedExpr= typekind=Pointer
+// CHECK: DeclRefExpr=p:3:13 typekind=Pointer
+// CHECK: DeclRefExpr=z:3:33 typekind=Typedef [canonical=Int]
+
diff --git a/test/Index/properties-class-extensions.m b/test/Index/properties-class-extensions.m
new file mode 100644
index 0000000..8bca37e
--- /dev/null
+++ b/test/Index/properties-class-extensions.m
@@ -0,0 +1,28 @@
+// Test that @properties within class extensions are visited by
+// clang_visitChildren only in the class extension, not the original
+// @interface (where we have a duplicate declaration - to be removed).
+@interface Foo {} @end
+@interface Foo (Cat)
+ @property int a;
+@end
+@interface Foo ()
+ @property int b;
+ - (void) bar;
+@end
+
+// RUN: c-index-test -test-load-source local %s | FileCheck %s
+// CHECK: properties-class-extensions.m:4:12: ObjCInterfaceDecl=Foo:4:12 Extent=[4:1 - 4:23]
+// CHECK: properties-class-extensions.m:5:12: ObjCCategoryDecl=Cat:5:12 Extent=[5:1 - 7:5]
+// CHECK: properties-class-extensions.m:5:12: ObjCClassRef=Foo:4:12 Extent=[5:12 - 5:15]
+// CHECK: properties-class-extensions.m:6:17: ObjCPropertyDecl=a:6:17 Extent=[6:17 - 6:18]
+// CHECK: properties-class-extensions.m:6:17: ObjCInstanceMethodDecl=a:6:17 Extent=[6:17 - 6:18]
+// CHECK: properties-class-extensions.m:6:17: ObjCInstanceMethodDecl=setA::6:17 Extent=[6:17 - 6:18]
+// CHECK: properties-class-extensions.m:6:17: ParmDecl=a:6:17 (Definition) Extent=[6:17 - 6:18]
+// CHECK: properties-class-extensions.m:8:12: ObjCCategoryDecl=:8:12 Extent=[8:1 - 11:5]
+// CHECK: properties-class-extensions.m:8:12: ObjCClassRef=Foo:4:12 Extent=[8:12 - 8:15]
+// CHECK: properties-class-extensions.m:9:17: ObjCPropertyDecl=b:9:17 Extent=[9:17 - 9:18]
+// CHECK: properties-class-extensions.m:9:17: ObjCInstanceMethodDecl=b:9:17 Extent=[9:17 - 9:18]
+// CHECK: properties-class-extensions.m:9:17: ObjCInstanceMethodDecl=setB::9:17 Extent=[9:17 - 9:18]
+// CHECK: properties-class-extensions.m:9:17: ParmDecl=b:9:17 (Definition) Extent=[9:17 - 9:18]
+// CHECK: properties-class-extensions.m:10:3: ObjCInstanceMethodDecl=bar:10:3 Extent=[10:3 - 10:16]
+
diff --git a/test/Index/remap-load.c b/test/Index/remap-load.c
index b8415e6..d9634a4 100644
--- a/test/Index/remap-load.c
+++ b/test/Index/remap-load.c
@@ -5,8 +5,8 @@
// CHECK: remap-load.c:1:5: FunctionDecl=foo:1:5 (Definition) Extent=[1:5 - 3:2]
// CHECK: remap-load.c:1:13: ParmDecl=parm1:1:13 (Definition) Extent=[1:9 - 1:18]
// CHECK: remap-load.c:1:26: ParmDecl=parm2:1:26 (Definition) Extent=[1:20 - 1:31]
-// CHECK: remap-load.c:1:5: UnexposedStmt= Extent=[1:33 - 3:2]
-// CHECK: remap-load.c:1:5: UnexposedStmt= Extent=[2:3 - 2:23]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[1:33 - 3:2]
+// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[2:3 - 2:23]
// CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:23]
// CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:23]
// CHECK: remap-load.c:2:10: UnexposedExpr=parm1:1:13 Extent=[2:10 - 2:15]
diff --git a/test/Index/usrs.cpp b/test/Index/usrs.cpp
new file mode 100644
index 0000000..b6a6d3d
--- /dev/null
+++ b/test/Index/usrs.cpp
@@ -0,0 +1,107 @@
+namespace foo {
+ int x;
+ void bar(int z);
+}
+namespace bar {
+ typedef int QType;
+ void bar(QType z);
+}
+
+class ClsA {
+public:
+ int a, b;
+ ClsA(int A, int B) : a(A), b(B) {}
+};
+
+namespace foo {
+ class ClsB : public ClsA {
+ public:
+ ClsB() : ClsA(1, 2) {}
+ int result() const;
+ };
+}
+
+int foo::ClsB::result() const {
+ return a + b;
+}
+
+namespace {
+ class ClsC : public foo::ClsB {};
+ int w;
+}
+
+int z;
+
+namespace foo { namespace taz {
+ int x;
+ static inline int add(int a, int b) { return a + b; }
+ void sub(int a, int b);
+}
+}
+
+namespace foo { namespace taz {
+ class ClsD : public foo::ClsB {
+ public:
+ ClsD& operator=(int x) { a = x; return *this; }
+ ClsD& operator=(double x) { a = (int) x; return *this; }
+ ClsD& operator=(const ClsD &x) { a = x.a; return *this; }
+ static int qux();
+ static int uz(int z, ...);
+ bool operator==(const ClsD &x) const { return a == x.a; }
+ };
+}}
+
+extern "C" {
+ void rez(int a, int b);
+}
+
+// RUN: c-index-test -test-load-source-usrs all %s | FileCheck %s
+// CHECK: usrs.cpp c:@N@foo Extent=[1:11 - 4:2]
+// CHECK: usrs.cpp c:@N@foo@x Extent=[2:3 - 2:8]
+// CHECK: usrs.cpp c:@N@foo@F@bar#I# Extent=[3:8 - 3:18]
+// CHECK: usrs.cpp c:usrs.cpp@3:12@N@foo@F@bar#I#@z Extent=[3:12 - 3:17]
+// CHECK: usrs.cpp c:@N@bar Extent=[5:11 - 8:2]
+// CHECK: usrs.cpp c:usrs.cpp@6:15@N@bar@T@QType Extent=[6:15 - 6:20]
+// CHECK: usrs.cpp c:@N@bar@F@bar#I# Extent=[7:8 - 7:20]
+// CHECK: usrs.cpp c:usrs.cpp@7:12@N@bar@F@bar#I#@z Extent=[7:12 - 7:19]
+// CHECK: usrs.cpp c:@C@ClsA Extent=[10:1 - 14:2]
+// CHECK: usrs.cpp c:@C@ClsA@FI@a Extent=[12:7 - 12:8]
+// CHECK: usrs.cpp c:@C@ClsA@FI@b Extent=[12:10 - 12:11]
+// CHECK: usrs.cpp c:@C@ClsA@F@ClsA#I#I# Extent=[13:3 - 13:37]
+// CHECK: usrs.cpp c:usrs.cpp@13:8@C@ClsA@F@ClsA#I#I#@A Extent=[13:8 - 13:13]
+// CHECK: usrs.cpp c:usrs.cpp@13:15@C@ClsA@F@ClsA#I#I#@B Extent=[13:15 - 13:20]
+// CHECK: usrs.cpp c:@N@foo Extent=[16:11 - 22:2]
+// CHECK: usrs.cpp c:@N@foo@C@ClsB Extent=[17:3 - 21:4]
+// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@ClsB# Extent=[19:5 - 19:27]
+// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[20:9 - 20:17]
+// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[24:16 - 26:2]
+// CHECK: usrs.cpp c:@aN@C@ClsC Extent=[29:3 - 29:35]
+// CHECK: usrs.cpp c:@aN@w Extent=[30:3 - 30:8]
+// CHECK: usrs.cpp c:@z Extent=[33:1 - 33:6]
+// CHECK: usrs.cpp c:@N@foo Extent=[35:11 - 40:2]
+// CHECK: usrs.cpp c:@N@foo@N@taz Extent=[35:27 - 39:2]
+// CHECK: usrs.cpp c:@N@foo@N@taz@x Extent=[36:3 - 36:8]
+// CHECK: usrs.cpp c:usrs.cpp@37:21@N@foo@N@taz@F@add#I#I# Extent=[37:21 - 37:56]
+// CHECK: usrs.cpp c:usrs.cpp@37:25@N@foo@N@taz@F@add#I#I#@a Extent=[37:25 - 37:30]
+// CHECK: usrs.cpp c:usrs.cpp@37:32@N@foo@N@taz@F@add#I#I#@b Extent=[37:32 - 37:37]
+// CHECK: usrs.cpp c:@N@foo@N@taz@F@sub#I#I# Extent=[38:8 - 38:25]
+// CHECK: usrs.cpp c:usrs.cpp@38:12@N@foo@N@taz@F@sub#I#I#@a Extent=[38:12 - 38:17]
+// CHECK: usrs.cpp c:usrs.cpp@38:19@N@foo@N@taz@F@sub#I#I#@b Extent=[38:19 - 38:24]
+// CHECK: usrs.cpp c:@N@foo Extent=[42:11 - 52:3]
+// CHECK: usrs.cpp c:@N@foo@N@taz Extent=[42:27 - 52:2]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD Extent=[43:3 - 51:4]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#I# Extent=[45:11 - 45:52]
+// CHECK: usrs.cpp c:usrs.cpp@45:21@N@foo@N@taz@C@ClsD@F@operator=#I#@x Extent=[45:21 - 45:26]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#d# Extent=[46:11 - 46:61]
+// CHECK: usrs.cpp c:usrs.cpp@46:21@N@foo@N@taz@C@ClsD@F@operator=#d#@x Extent=[46:21 - 46:29]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD# Extent=[47:11 - 47:62]
+// CHECK: usrs.cpp c:usrs.cpp@47:27@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD#@x Extent=[47:27 - 47:34]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@qux#S Extent=[48:16 - 48:21]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@uz#I.#S Extent=[49:16 - 49:30]
+// CHECK: usrs.cpp c:usrs.cpp@49:19@N@foo@N@taz@C@ClsD@F@uz#I.#S@z Extent=[49:19 - 49:24]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1 Extent=[50:10 - 50:62]
+// CHECK: usrs.cpp c:usrs.cpp@50:27@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1@x Extent=[50:27 - 50:34]
+// CHECK: usrs.cpp c:@F@rez Extent=[55:8 - 55:25]
+// CHECK: usrs.cpp c:usrs.cpp@55:12@F@rez@a Extent=[55:12 - 55:17]
+// CHECK: usrs.cpp c:usrs.cpp@55:19@F@rez@b Extent=[55:19 - 55:24]
+
diff --git a/test/Index/usrs.m b/test/Index/usrs.m
index eb0817c..bffd0ee 100644
--- a/test/Index/usrs.m
+++ b/test/Index/usrs.m
@@ -49,18 +49,18 @@ int z;
static int local_func(int x) { return x; }
// CHECK: usrs.m c:usrs.m@3:19@F@my_helper Extent=[3:19 - 3:60]
-// CHECK: usrs.m c:usrs.m@3:29@x Extent=[3:29 - 3:34]
-// CHECK: usrs.m c:usrs.m@3:36@y Extent=[3:36 - 3:41]
-// CHECK: usrs.m c:@Ea@usrs.m@5:1 Extent=[5:1 - 8:2]
-// CHECK: usrs.m c:@Ea@usrs.m@5:1@ABA Extent=[6:3 - 6:6]
-// CHECK: usrs.m c:@Ea@usrs.m@5:1@CADABA Extent=[7:3 - 7:9]
-// CHECK: usrs.m c:@Ea@usrs.m@10:1 Extent=[10:1 - 13:2]
-// CHECK: usrs.m c:@Ea@usrs.m@10:1@FOO Extent=[11:3 - 11:6]
-// CHECK: usrs.m c:@Ea@usrs.m@10:1@BAR Extent=[12:3 - 12:6]
+// CHECK: usrs.m c:usrs.m@3:29@F@my_helper@x Extent=[3:29 - 3:34]
+// CHECK: usrs.m c:usrs.m@3:36@F@my_helper@y Extent=[3:36 - 3:41]
+// CHECK: usrs.m c:usrs.m@5:1@Ea Extent=[5:1 - 8:2]
+// CHECK: usrs.m c:usrs.m@5:1@Ea@ABA Extent=[6:3 - 6:6]
+// CHECK: usrs.m c:usrs.m@5:1@Ea@CADABA Extent=[7:3 - 7:9]
+// CHECK: usrs.m c:usrs.m@10:1@Ea Extent=[10:1 - 13:2]
+// CHECK: usrs.m c:usrs.m@10:1@Ea@FOO Extent=[11:3 - 11:6]
+// CHECK: usrs.m c:usrs.m@10:1@Ea@BAR Extent=[12:3 - 12:6]
// CHECK: usrs.m c:@SA@MyStruct Extent=[15:9 - 18:2]
// CHECK: usrs.m c:@SA@MyStruct@FI@wa Extent=[16:7 - 16:9]
// CHECK: usrs.m c:@SA@MyStruct@FI@moo Extent=[17:7 - 17:10]
-// CHECK: usrs.m c:@T@usrs.m@18:3@MyStruct Extent=[18:3 - 18:11]
+// CHECK: usrs.m c:usrs.m@18:3@T@MyStruct Extent=[18:3 - 18:11]
// CHECK: usrs.m c:@E@Pizza Extent=[20:1 - 23:2]
// CHECK: usrs.m c:@E@Pizza@CHEESE Extent=[21:3 - 21:9]
// CHECK: usrs.m c:@E@Pizza@MUSHROOMS Extent=[22:3 - 22:12]
@@ -72,16 +72,16 @@ static int local_func(int x) { return x; }
// CHECK: usrs.m c:objc(cs)Foo(cm)kingkong Extent=[30:1 - 30:17]
// CHECK: usrs.m c:objc(cs)Foo(im)d1 Extent=[31:15 - 31:17]
// CHECK: usrs.m c:objc(cs)Foo(im)setD1: Extent=[31:15 - 31:17]
-// CHECK: usrs.m c:usrs.m@31:15@d1 Extent=[31:15 - 31:17]
+// CHECK: usrs.m c:usrs.m@31:15objc(cs)Foo(im)setD1:@d1 Extent=[31:15 - 31:17]
// CHECK: usrs.m c:objc(cs)Foo Extent=[34:1 - 45:2]
// CHECK: usrs.m c:objc(cs)Foo(im)godzilla Extent=[35:1 - 39:2]
-// CHECK: usrs.m c:usrs.m@36:10@a Extent=[36:10 - 36:19]
-// CHECK: usrs.m c:@z Extent=[37:10 - 37:15]
+// CHECK: usrs.m c:usrs.m@36:10objc(cs)Foo(im)godzilla@a Extent=[36:10 - 36:19]
+// CHECK: usrs.m c:objc(cs)Foo(im)godzilla@z Extent=[37:10 - 37:15]
// CHECK: usrs.m c:objc(cs)Foo(cm)kingkong Extent=[40:1 - 43:2]
-// CHECK: usrs.m c:usrs.m@41:3@local_var Extent=[41:3 - 41:16]
+// CHECK: usrs.m c:usrs.m@41:3objc(cs)Foo(cm)kingkong@local_var Extent=[41:3 - 41:16]
// CHECK: usrs.m c:objc(cs)Foo@d1 Extent=[44:13 - 44:15]
// CHECK: usrs.m c:objc(cs)Foo(py)d1 Extent=[44:1 - 44:15]
// CHECK: usrs.m c:@z Extent=[47:1 - 47:6]
// CHECK: usrs.m c:usrs.m@49:12@F@local_func Extent=[49:12 - 49:43]
-// CHECK: usrs.m c:usrs.m@49:23@x Extent=[49:23 - 49:28]
+// CHECK: usrs.m c:usrs.m@49:23@F@local_func@x Extent=[49:23 - 49:28]
diff --git a/test/Lexer/gnu_keywords.c b/test/Lexer/gnu_keywords.c
index 3234f58..c4bd9b3 100644
--- a/test/Lexer/gnu_keywords.c
+++ b/test/Lexer/gnu_keywords.c
@@ -1,7 +1,7 @@
-// RUN: %clang -DGNU_KEYWORDS -std=gnu89 -fsyntax-only -verify %s
-// RUN: %clang -DGNU_KEYWORDS -std=c99 -fgnu-keywords -fsyntax-only -verify %s
-// RUN: %clang -std=c99 -fsyntax-only -verify %s
-// RUN: %clang -std=gnu89 -fno-gnu-keywords -fsyntax-only -verify %s
+// RUN: %clang_cc1 -DGNU_KEYWORDS -std=gnu89 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -DGNU_KEYWORDS -std=c99 -fgnu-keywords -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c99 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=gnu89 -fno-gnu-keywords -fsyntax-only -verify %s
void f() {
#ifdef GNU_KEYWORDS
diff --git a/test/Lexer/hexfloat.cpp b/test/Lexer/hexfloat.cpp
index 5a62556..a3b230e 100644
--- a/test/Lexer/hexfloat.cpp
+++ b/test/Lexer/hexfloat.cpp
@@ -1,5 +1,5 @@
-//RUN: %clang_cc1 -fsyntax-only -verify
-//RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify
#ifndef __GXX_EXPERIMENTAL_CXX0X__
float f = 0x1p+1; // expected-warning {{incompatible with C++0x}}
diff --git a/test/Makefile b/test/Makefile
index e9d8945..c3b3eab 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -18,7 +18,7 @@ ifndef TESTARGS
ifdef VERBOSE
TESTARGS = -v
else
-TESTARGS = -s -v
+TESTARGS = -s -v
endif
endif
diff --git a/test/Misc/diag-aka-types.cpp b/test/Misc/diag-aka-types.cpp
new file mode 100644
index 0000000..7233c4e
--- /dev/null
+++ b/test/Misc/diag-aka-types.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+struct X {};
+typedef X foo_t;
+
+foo_t *ptr;
+char c1 = ptr; // expected-error{{'foo_t *' (aka 'X *')}}
+
+const foo_t &ref = foo_t();
+char c2 = ref; // expected-error{{'foo_t const' (aka 'X const')}}
diff --git a/test/PCH/Inputs/namespaces.h b/test/PCH/Inputs/namespaces.h
index 1bab746..553aadd 100644
--- a/test/PCH/Inputs/namespaces.h
+++ b/test/PCH/Inputs/namespaces.h
@@ -6,8 +6,35 @@ namespace N1 {
namespace N1 {
typedef int t2;
+
+ void used_func();
+
+ struct used_cls { };
}
namespace N2 {
typedef float t1;
+
+ namespace Inner {
+ typedef int t3;
+ };
+}
+
+namespace {
+ void anon() { }
+ class C;
+}
+
+namespace N3 {
+ namespace {
+ class C;
+ }
+}
+
+namespace Alias1 = N2::Inner;
+
+using namespace N2::Inner;
+
+extern "C" {
+ void ext();
}
diff --git a/test/PCH/cxx_exprs.cpp b/test/PCH/cxx_exprs.cpp
index 0f0fe88..ec7041b 100644
--- a/test/PCH/cxx_exprs.cpp
+++ b/test/PCH/cxx_exprs.cpp
@@ -33,3 +33,7 @@ static_assert(!false_value, "false_value is false");
// CXXNullPtrLiteralExpr
cxx_null_ptr_result null_ptr = nullptr;
+
+// CXXTypeidExpr
+typeid_result1 typeid_1 = 0;
+typeid_result2 typeid_2 = 0; \ No newline at end of file
diff --git a/test/PCH/cxx_exprs.h b/test/PCH/cxx_exprs.h
index a871aa2..f647922 100644
--- a/test/PCH/cxx_exprs.h
+++ b/test/PCH/cxx_exprs.h
@@ -1,11 +1,12 @@
// Header for PCH test cxx_exprs.cpp
+
// CXXStaticCastExpr
typedef __typeof__(static_cast<void *>(0)) static_cast_result;
// CXXDynamicCastExpr
-struct Base { virtual void f(); };
-struct Derived : Base { };
+struct Base { Base(int); virtual void f(int x = 492); ~Base(); };
+struct Derived : Base { Derived(); void g(); };
Base *base_ptr;
typedef __typeof__(dynamic_cast<Derived *>(base_ptr)) dynamic_cast_result;
@@ -27,3 +28,56 @@ const bool false_value = false;
// CXXNullPtrLiteralExpr
typedef __typeof__(nullptr) cxx_null_ptr_result;
+
+void foo(Derived *P) {
+ // CXXMemberCallExpr
+ P->f(12);
+}
+
+
+// FIXME: This is a hack until <typeinfo> works completely.
+namespace std {
+ class type_info {};
+}
+
+// CXXTypeidExpr - Both expr and type forms.
+typedef __typeof__(typeid(int))* typeid_result1;
+typedef __typeof__(typeid(2))* typeid_result2;
+
+Derived foo();
+
+Derived::Derived() : Base(4) {
+}
+
+void Derived::g() {
+ // CXXThisExpr
+ f(2); // Implicit
+ this->f(1); // Explicit
+
+ // CXXThrowExpr
+ throw;
+ throw 42;
+
+ // CXXDefaultArgExpr
+ f();
+
+ const Derived &X = foo();
+
+ // FIXME: How do I make a CXXBindReferenceExpr, CXXConstructExpr?
+
+ int A = int(0.5); // CXXFunctionalCastExpr
+ A = int(); // CXXZeroInitValueExpr
+
+ new Base(4); // CXXNewExpr
+
+}
+
+
+// FIXME: The comment on CXXTemporaryObjectExpr is broken, this doesn't make
+// one.
+struct CtorStruct { CtorStruct(int, float); };
+
+CtorStruct create_CtorStruct() {
+ return CtorStruct(1, 3.14f); // CXXTemporaryObjectExpr
+};
+
diff --git a/test/PCH/namespaces.cpp b/test/PCH/namespaces.cpp
index eef9e06..532d627 100644
--- a/test/PCH/namespaces.cpp
+++ b/test/PCH/namespaces.cpp
@@ -8,7 +8,36 @@
int int_val;
N1::t1 *ip1 = &int_val;
N1::t2 *ip2 = &int_val;
+N2::Inner::t3 *ip3 = &int_val;
float float_val;
namespace N2 { }
N2::t1 *fp1 = &float_val;
+
+Alias1::t3 *ip4 = &int_val;
+t3 *ip5 = &int_val;
+
+void(*funp1)() = anon;
+
+namespace {
+ class C;
+}
+C* cp1;
+
+namespace N3 {
+ namespace {
+ class C;
+ }
+}
+
+N3::C *cp2;
+
+void(*funp2)() = ext;
+
+using N1::used_func;
+void (*pused)() = used_func;
+
+// FIXME: Disabled until CXXRecord serialization is re-added.
+// using N1::used_cls;
+// used_cls s1;
+// used_cls* ps1 = &s1;
diff --git a/test/Parser/cxx-undeclared-identifier.cpp b/test/Parser/cxx-undeclared-identifier.cpp
new file mode 100644
index 0000000..36d8f7a
--- /dev/null
+++ b/test/Parser/cxx-undeclared-identifier.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+class Foo::Bar { // expected-error {{use of undeclared identifier 'Foo'}} \
+ // expected-note {{to match this '{'}} \
+ // expected-error {{expected ';' after class}}
+ // expected-error {{expected '}'}}
diff --git a/test/Parser/namespaces.cpp b/test/Parser/namespaces.cpp
new file mode 100644
index 0000000..b8c7819
--- /dev/null
+++ b/test/Parser/namespaces.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR6596
+namespace g { enum { o = 0 }; }
+
+void foo() {
+ namespace a { typedef g::o o; } // expected-error{{namespaces can only be defined in global or namespace scope}}
+}
diff --git a/test/Parser/pragma-options.c b/test/Parser/pragma-options.c
new file mode 100644
index 0000000..332249f
--- /dev/null
+++ b/test/Parser/pragma-options.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+
+/* expected-warning {{expected 'align' following '#pragma options'}} */ #pragma options
+/* expected-warning {{expected '=' following '#pragma options align'}} */ #pragma options align
+/* expected-warning {{expected identifier in '#pragma options'}} */ #pragma options align =
+/* expected-warning {{invalid alignment option in '#pragma options align'}} */ #pragma options align = foo
+/* expected-warning {{extra tokens at end of '#pragma options'}} */ #pragma options align = reset foo
+
+#pragma options align=natural
+#pragma options align=reset
+#pragma options align=mac68k
+/* expected-warning {{unsupported alignment option}} */ #pragma options align=power
diff --git a/test/Parser/recovery.c b/test/Parser/recovery.c
index 8e7181e..6cd95da 100644
--- a/test/Parser/recovery.c
+++ b/test/Parser/recovery.c
@@ -73,3 +73,8 @@ void foo() {
int X;
X = 4 // expected-error{{expected ';' after expression}}
}
+
+
+// rdar://7980651
+typedef int intptr_t; // expected-note {{'intptr_t' declared here}}
+void bar(intptr y); // expected-error {{unknown type name 'intptr'; did you mean 'intptr_t'?}}
diff --git a/test/Parser/switch-recovery.cpp b/test/Parser/switch-recovery.cpp
new file mode 100644
index 0000000..8eb4cff
--- /dev/null
+++ b/test/Parser/switch-recovery.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// <rdar://problem/7971948>
+struct A {};
+struct B {
+ void foo() {
+ switch (a) { // expected-error{{use of undeclared identifier 'a'}}
+ default:
+ return;
+ }
+ }
+};
diff --git a/test/Rewriter/rewrite-block-argument.m b/test/Rewriter/rewrite-block-argument.m
new file mode 100644
index 0000000..4ebbef9
--- /dev/null
+++ b/test/Rewriter/rewrite-block-argument.m
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" -emit-llvm -o %t %t-rw.cpp
+// radar 7987817
+
+void *sel_registerName(const char *);
+
+@interface Test {
+}
+@end
+
+@implementation Test
+
+- (void)enumerateProvidersWithBlock:(void (^)(void))block {
+ block();
+}
+
+- (void)providerEnumerator {
+ ^(void (^providerBlock)(void)) {
+ [self enumerateProvidersWithBlock:providerBlock];
+ };
+}
+
+- (void)testNilBlock {
+ [self enumerateProvidersWithBlock:0];
+}
+
+@end
+
+
+
+int main(int argc, char *argv[]) {
+ return 0;
+}
diff --git a/test/Rewriter/rewrite-local-static-id.mm b/test/Rewriter/rewrite-local-static-id.mm
new file mode 100644
index 0000000..a0b85f4
--- /dev/null
+++ b/test/Rewriter/rewrite-local-static-id.mm
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" -emit-llvm -o %t %t-rw.cpp
+// radar 7946975
+
+void *sel_registerName(const char *);
+
+@interface foo
+@end
+
+@interface foo2 : foo
++ (id)x;
+@end
+
+typedef void (^b_t)(void);
+
+void bar(b_t block);
+
+void f() {
+ static id foo = 0;
+ bar(^{
+ foo = [foo2 x];
+ });
+}
+
diff --git a/test/Rewriter/rewrite-no-nextline.mm b/test/Rewriter/rewrite-no-nextline.mm
new file mode 100644
index 0000000..0c3657c
--- /dev/null
+++ b/test/Rewriter/rewrite-no-nextline.mm
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// radar 7946975
+
+@interface RootObject {
+}
+@end void doStuff();
+int main(int argc, char *argv[]) {
+ return 0;
+}
diff --git a/test/Sema/attr-sentinel.c b/test/Sema/attr-sentinel.c
index db90d07..5ca6a8d 100644
--- a/test/Sema/attr-sentinel.c
+++ b/test/Sema/attr-sentinel.c
@@ -4,7 +4,7 @@
#define ATTR __attribute__ ((__sentinel__))
-void foo1 (int x, ...) ATTR; // expected-note {{function has been explicitly marked sentinel here}}
+void foo1 (int x, ...) ATTR; // expected-note 2 {{function has been explicitly marked sentinel here}}
void foo5 (int x, ...) __attribute__ ((__sentinel__(1))); // expected-note {{function has been explicitly marked sentinel here}}
void foo6 (int x, ...) __attribute__ ((__sentinel__(5))); // expected-note {{function has been explicitly marked sentinel here}}
void foo7 (int x, ...) __attribute__ ((__sentinel__(0))); // expected-note {{function has been explicitly marked sentinel here}}
@@ -24,6 +24,12 @@ void test1() {
foo7(1, NULL); // OK
foo12(1); // expected-warning {{not enough variable arguments in 'foo12' declaration to fit a sentinel}}
+
+ // PR 5685
+ struct A {};
+ struct A a, b, c;
+ foo1(3, &a, &b, &c); // expected-warning {{missing sentinel in function call}}
+ foo1(3, &a, &b, &c, (struct A*) 0);
}
diff --git a/test/Sema/c89.c b/test/Sema/c89.c
index 8a9e622..038f7e5 100644
--- a/test/Sema/c89.c
+++ b/test/Sema/c89.c
@@ -61,7 +61,7 @@ void foo(T); /* typedef for void is allowed */
void foo(void) {}
/* PR2759 */
-void test10 (int x[*]); /* expected-warning {{use of C99-specific array features}} */
+void test10 (int x[*]); /* expected-warning {{variable length arrays are a C99 feature, accepted as an extension}} */
void test11 (int x[static 4]); /* expected-warning {{use of C99-specific array features}} */
void test12 (int x[const 4]) { /* expected-warning {{use of C99-specific array features}} */
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index 631b694..f997dc1 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -23,8 +23,8 @@ int ints(long a, unsigned long b) {
((signed char) a == b) + // expected-warning {{comparison of integers of different signs}}
((long) a == (unsigned long) b) + // expected-warning {{comparison of integers of different signs}}
((int) a == (unsigned int) b) + // expected-warning {{comparison of integers of different signs}}
- ((short) a == (unsigned short) b) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a == (unsigned char) b) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a == (unsigned short) b) +
+ ((signed char) a == (unsigned char) b) +
(a < (unsigned long) b) + // expected-warning {{comparison of integers of different signs}}
(a < (unsigned int) b) +
(a < (unsigned short) b) +
@@ -35,8 +35,8 @@ int ints(long a, unsigned long b) {
((signed char) a < b) + // expected-warning {{comparison of integers of different signs}}
((long) a < (unsigned long) b) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) b) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) b) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) b) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) b) +
+ ((signed char) a < (unsigned char) b) +
// (A,b)
(A == (unsigned long) b) +
@@ -87,8 +87,8 @@ int ints(long a, unsigned long b) {
((signed char) a < B) +
((long) a < (unsigned long) B) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) B) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) B) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) B) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) B) +
+ ((signed char) a < (unsigned char) B) +
// (C,b)
(C == (unsigned long) b) +
@@ -139,8 +139,8 @@ int ints(long a, unsigned long b) {
((signed char) a < C) +
((long) a < (unsigned long) C) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) C) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) C) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) C) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) C) +
+ ((signed char) a < (unsigned char) C) +
// (0x80000,b)
(0x80000 == (unsigned long) b) +
@@ -191,8 +191,8 @@ int ints(long a, unsigned long b) {
((signed char) a < 0x80000) +
((long) a < (unsigned long) 0x80000) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) 0x80000) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) 0x80000) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) 0x80000) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) 0x80000) +
+ ((signed char) a < (unsigned char) 0x80000) +
// We should be able to avoid warning about this.
(b != (a < 4 ? 1 : 2)) +
diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c
index 5e2c1a4..6e248bc 100644
--- a/test/Sema/conditional-expr.c
+++ b/test/Sema/conditional-expr.c
@@ -52,7 +52,9 @@ void foo() {
enum Enum { EVal };
test0 = test0 ? EVal : test0;
test0 = test0 ? EVal : (int) test0; // okay: EVal is an int
- test0 = test0 ? (unsigned) EVal : (int) test0; // expected-warning {{operands of ? are integers of different signs}}
+ test0 = test0 ? // expected-warning {{operands of ? are integers of different signs}}
+ (unsigned) EVal
+ : (int) test0;
}
int Postgresql() {
@@ -68,3 +70,8 @@ int f0(int a) {
// GCC considers this a warning.
return a ? f1() : nil; // expected-warning {{pointer/integer type mismatch in conditional expression ('int' and 'void *')}} expected-warning {{incompatible pointer to integer conversion returning 'void *' from a function with result type 'int'}}
}
+
+int f2(int x) {
+ // We can suppress this because the immediate context wants an int.
+ return (x != 0) ? 0U : x;
+}
diff --git a/test/Sema/conversion.c b/test/Sema/conversion.c
index addedd9..5b09ec6 100644
--- a/test/Sema/conversion.c
+++ b/test/Sema/conversion.c
@@ -287,3 +287,13 @@ void test_7676608(void) {
char c = 5;
f7676608(c *= q);
}
+
+// <rdar://problem/7904686>
+void test_7904686(void) {
+ const int i = -1;
+ unsigned u1 = i; // expected-warning {{implicit cast changes signedness}}
+ u1 = i; // expected-warning {{implicit cast changes signedness}}
+
+ unsigned u2 = -1; // expected-warning {{implicit cast changes signedness}}
+ u2 = -1; // expected-warning {{implicit cast changes signedness}}
+}
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index bdc2bb0..d6d3796 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -251,3 +251,6 @@ void test_pr_6697() {
myprintf_PR_6697("%1$s\n", 1, (int) 0); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}}
}
+void rdar8026030(FILE *fp) {
+ fprintf(fp, "\%"); // expected-warning{{incomplete format specifier}}
+}
diff --git a/test/Sema/init.c b/test/Sema/init.c
index b9867cf..c2c29ad 100644
--- a/test/Sema/init.c
+++ b/test/Sema/init.c
@@ -131,3 +131,17 @@ const wchar_t widestr[] = L"asdf";
// PR5447
const double pr5447 = (0.05 < -1.0) ? -1.0 : 0.0499878;
+// PR4386
+
+// None of these are constant initializers, but we implement GCC's old
+// behaviour of accepting bar and zed but not foo. GCC's behaviour was
+// changed in 2007 (rev 122551), so we should be able to change too one
+// day.
+int PR4386_bar();
+int PR4386_foo() __attribute((weak));
+int PR4386_zed();
+
+int PR4386_a = ((void *) PR4386_bar) != 0;
+int PR4386_b = ((void *) PR4386_foo) != 0; // expected-error{{initializer element is not a compile-time constant}}
+int PR4386_c = ((void *) PR4386_zed) != 0;
+int PR4386_zed() __attribute((weak));
diff --git a/test/Sema/pragma-align-mac68k-unsupported.c b/test/Sema/pragma-align-mac68k-unsupported.c
new file mode 100644
index 0000000..6588aa1
--- /dev/null
+++ b/test/Sema/pragma-align-mac68k-unsupported.c
@@ -0,0 +1,4 @@
+// RUN: %clang-cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
+// RUN: %clang-cc1 -triple i386-pc-linux-gnu -fsyntax-only -verify %s
+
+/* expected-error {{mac68k alignment pragma is not supported}} */ #pragma options align=mac68k
diff --git a/test/Sema/pragma-align-mac68k.c b/test/Sema/pragma-align-mac68k.c
new file mode 100644
index 0000000..d13a0be
--- /dev/null
+++ b/test/Sema/pragma-align-mac68k.c
@@ -0,0 +1,98 @@
+// RUN: %clang-cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+
+#include <stddef.h>
+
+#pragma options align=mac68k
+
+typedef float __attribute__((vector_size (8))) v2f_t;
+typedef float __attribute__((vector_size (16))) v4f_t;
+
+extern int a0_0[__alignof(v2f_t) == 8 ? 1 : -1];
+extern int a0_1[__alignof(v4f_t) == 16 ? 1 : -1];
+
+struct s1 {
+ char f0;
+ int f1;
+};
+extern int a1_0[offsetof(struct s1, f0) == 0 ? 1 : -1];
+extern int a1_1[offsetof(struct s1, f1) == 2 ? 1 : -1];
+extern int a1_2[sizeof(struct s1) == 6 ? 1 : -1];
+extern int a1_3[__alignof(struct s1) == 2 ? 1 : -1];
+
+struct s2 {
+ char f0;
+ double f1;
+};
+extern int a2_0[offsetof(struct s2, f0) == 0 ? 1 : -1];
+extern int a2_1[offsetof(struct s2, f1) == 2 ? 1 : -1];
+extern int a2_2[sizeof(struct s2) == 10 ? 1 : -1];
+extern int a2_3[__alignof(struct s2) == 2 ? 1 : -1];
+
+struct s3 {
+ char f0;
+ v4f_t f1;
+};
+extern int a3_0[offsetof(struct s3, f0) == 0 ? 1 : -1];
+extern int a3_1[offsetof(struct s3, f1) == 2 ? 1 : -1];
+extern int a3_2[sizeof(struct s3) == 18 ? 1 : -1];
+extern int a3_3[__alignof(struct s3) == 2 ? 1 : -1];
+
+struct s4 {
+ char f0;
+ char f1;
+};
+extern int a4_0[offsetof(struct s4, f0) == 0 ? 1 : -1];
+extern int a4_1[offsetof(struct s4, f1) == 1 ? 1 : -1];
+extern int a4_2[sizeof(struct s4) == 2 ? 1 : -1];
+extern int a4_3[__alignof(struct s4) == 2 ? 1 : -1];
+
+struct s5 {
+ unsigned f0 : 9;
+ unsigned f1 : 9;
+};
+extern int a5_0[sizeof(struct s5) == 4 ? 1 : -1];
+extern int a5_1[__alignof(struct s5) == 2 ? 1 : -1];
+
+struct s6 {
+ unsigned : 0;
+ unsigned : 0;
+};
+extern int a6_0[sizeof(struct s6) == 0 ? 1 : -1];
+extern int a6_1[__alignof(struct s6) == 2 ? 1 : -1];
+
+struct s7 {
+ char : 1;
+ unsigned : 1;
+};
+extern int a7_0[sizeof(struct s7) == 2 ? 1 : -1];
+extern int a7_1[__alignof(struct s7) == 2 ? 1 : -1];
+
+struct s8 {
+ char f0;
+ unsigned : 1;
+};
+extern int a8_0[sizeof(struct s8) == 2 ? 1 : -1];
+extern int a8_1[__alignof(struct s8) == 2 ? 1 : -1];
+
+struct s9 {
+ char f0[3];
+ unsigned : 0;
+ char f1;
+};
+extern int a9_0[sizeof(struct s9) == 6 ? 1 : -1];
+extern int a9_1[__alignof(struct s9) == 2 ? 1 : -1];
+
+struct s10 {
+ char f0;
+};
+extern int a10_0[sizeof(struct s10) == 2 ? 1 : -1];
+extern int a10_1[__alignof(struct s10) == 2 ? 1 : -1];
+
+struct s11 {
+ char f0;
+ v2f_t f1;
+};
+extern int a11_0[offsetof(struct s11, f0) == 0 ? 1 : -1];
+extern int a11_1[offsetof(struct s11, f1) == 2 ? 1 : -1];
+extern int a11_2[sizeof(struct s11) == 10 ? 1 : -1];
+extern int a11_3[__alignof(struct s11) == 2 ? 1 : -1];
diff --git a/test/Sema/pragma-pack-and-options-align.c b/test/Sema/pragma-pack-and-options-align.c
new file mode 100644
index 0000000..c880ed6
--- /dev/null
+++ b/test/Sema/pragma-pack-and-options-align.c
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
+
+// Check that #pragma pack and #pragma options share the same stack.
+
+#pragma pack(push, 1)
+struct s0 {
+ char c;
+ int x;
+};
+extern int a[sizeof(struct s0) == 5 ? 1 : -1];
+
+#pragma options align=natural
+struct s1 {
+ char c;
+ int x;
+};
+extern int a[sizeof(struct s1) == 8 ? 1 : -1];
+
+#pragma pack(pop)
+struct s2 {
+ char c;
+ int x;
+};
+extern int a[sizeof(struct s2) == 5 ? 1 : -1];
+#pragma pack(pop)
+
+struct s3 {
+ char c;
+ int x;
+};
+extern int a[sizeof(struct s3) == 8 ? 1 : -1];
+
+/* expected-warning {{#pragma options align=reset failed: stack empty}} */ #pragma options align=reset
+/* expected-warning {{#pragma pack(pop, ...) failed: stack empty}} */ #pragma pack(pop)
diff --git a/test/Sema/scope-check.c b/test/Sema/scope-check.c
index 6f86402..f3881ed 100644
--- a/test/Sema/scope-check.c
+++ b/test/Sema/scope-check.c
@@ -19,7 +19,7 @@ void test3clean(int*);
int test3() {
goto L; // expected-error{{illegal goto into protected scope}}
-int a __attribute((cleanup(test3clean))); // expected-note {{jump bypasses initialization of declaration with __attribute__((cleanup))}}
+int a __attribute((cleanup(test3clean))); // expected-note {{jump bypasses initialization of variable with __attribute__((cleanup))}}
L:
return a;
}
@@ -133,20 +133,20 @@ int test8(int x) {
void test9(int n, void *P) {
int Y;
int Z = 4;
- goto *P; // ok.
+ goto *P; // expected-warning {{indirect goto might cross protected scopes}}
L2: ;
- int a[n]; // expected-note 2 {{jump bypasses initialization of variable length array}}
+ int a[n]; // expected-note {{jump bypasses initialization of variable length array}}
-L3:
+L3: // expected-note {{possible target of indirect goto}}
L4:
- goto *P; // expected-warning {{illegal indirect goto in protected scope, unknown effect on scopes}}
+ goto *P;
goto L3; // ok
goto L4; // ok
void *Ptrs[] = {
- &&L2, // Ok.
- &&L3 // expected-warning {{address taken of label in protected scope, jump to it would have unknown effect on scope}}
+ &&L2,
+ &&L3
};
}
@@ -193,3 +193,9 @@ void test12(int n) {
};
}
+void test13(int n, void *p) {
+ int vla[n];
+ goto *p;
+ a0: ;
+ static void *ps[] = { &&a0 };
+}
diff --git a/test/Sema/switch.c b/test/Sema/switch.c
index e63a194..27ad066 100644
--- a/test/Sema/switch.c
+++ b/test/Sema/switch.c
@@ -24,36 +24,37 @@ void foo(int X) {
void test3(void) {
// empty switch;
- switch (0);
+ switch (0); // expected-warning {{no case matching constant switch condition '0'}}
}
extern int g();
void test4()
{
- switch (1) {
+ int cond;
+ switch (cond) {
case 0 && g():
case 1 || g():
break;
}
- switch(1) {
+ switch(cond) {
case g(): // expected-error {{expression is not an integer constant expression}}
case 0 ... g(): // expected-error {{expression is not an integer constant expression}}
break;
}
- switch (1) {
+ switch (cond) {
case 0 && g() ... 1 || g():
break;
}
- switch (1) {
+ switch (cond) {
case g() && 0: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}}
break;
}
- switch (1) {
+ switch (cond) {
case 0 ... g() || 1: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}}
break;
}
@@ -68,7 +69,7 @@ void test5(int z) {
}
void test6() {
- const char ch = 'a';
+ char ch = 'a';
switch(ch) {
case 1234: // expected-warning {{overflow converting case value}}
break;
@@ -261,3 +262,18 @@ void f1(unsigned x) {
default: break;
}
}
+
+void test15() {
+ int i = 0;
+ switch (1) { // expected-warning {{no case matching constant switch condition '1'}}
+ case 0: i = 0; break;
+ case 2: i++; break;
+ }
+}
+
+void test16() {
+ const char c = '5';
+ switch (c) { // expected-warning {{no case matching constant switch condition '53'}}
+ case '6': return;
+ }
+}
diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c
index 4ae0d4b..15608ec 100644
--- a/test/Sema/unused-expr.c
+++ b/test/Sema/unused-expr.c
@@ -110,3 +110,11 @@ void *some_function(void);
void t10() {
(void*) some_function(); //expected-warning {{expression result unused; should this cast be to 'void'?}}
}
+
+void f(int i, ...) {
+ __builtin_va_list ap;
+
+ __builtin_va_start(ap, i);
+ __builtin_va_arg(ap, int);
+ __builtin_va_end(ap);
+}
diff --git a/test/SemaCXX/alignof-sizeof-reference.cpp b/test/SemaCXX/alignof-sizeof-reference.cpp
index f02282d..dd64d6a 100644
--- a/test/SemaCXX/alignof-sizeof-reference.cpp
+++ b/test/SemaCXX/alignof-sizeof-reference.cpp
@@ -7,3 +7,9 @@ void test() {
static_assert(alignof(r) == 1, "bad alignment");
static_assert(sizeof(r) == 1, "bad size");
}
+
+void f();
+void f(int);
+void g() {
+ sizeof(&f); // expected-error{{invalid application of 'sizeof' to an overloaded function}}
+}
diff --git a/test/SemaCXX/anonymous-union.cpp b/test/SemaCXX/anonymous-union.cpp
index 5c34e01..5f84bcc 100644
--- a/test/SemaCXX/anonymous-union.cpp
+++ b/test/SemaCXX/anonymous-union.cpp
@@ -121,3 +121,37 @@ typedef struct _s {
int Foo;
};
} s, *ps;
+
+// <rdar://problem/7987650>
+namespace test4 {
+ class A {
+ struct {
+ int s0; // expected-note {{declared private here}}
+ double s1; // expected-note {{declared private here}}
+ union {
+ int su0; // expected-note {{declared private here}}
+ double su1; // expected-note {{declared private here}}
+ };
+ };
+ union {
+ int u0; // expected-note {{declared private here}}
+ double u1; // expected-note {{declared private here}}
+ struct {
+ int us0; // expected-note {{declared private here}}
+ double us1; // expected-note {{declared private here}}
+ };
+ };
+ };
+
+ void test() {
+ A a;
+ (void) a.s0; // expected-error {{private member}}
+ (void) a.s1; // expected-error {{private member}}
+ (void) a.su0; // expected-error {{private member}}
+ (void) a.su1; // expected-error {{private member}}
+ (void) a.u0; // expected-error {{private member}}
+ (void) a.u1; // expected-error {{private member}}
+ (void) a.us0; // expected-error {{private member}}
+ (void) a.us1; // expected-error {{private member}}
+ }
+}
diff --git a/test/SemaCXX/attr-deprecated.cpp b/test/SemaCXX/attr-deprecated.cpp
index d5662d3..2164f9d 100644
--- a/test/SemaCXX/attr-deprecated.cpp
+++ b/test/SemaCXX/attr-deprecated.cpp
@@ -64,3 +64,129 @@ void D::f() { }
void f(D* d) {
d->f();
}
+
+
+// Overloaded namespace members.
+namespace test1 {
+ void foo(int) __attribute__((deprecated));
+ void test1() { foo(10); } // expected-warning {{deprecated}}
+ void foo(short) __attribute__((deprecated));
+ void test2(short s) { foo(s); } // expected-warning {{deprecated}}
+ void foo(long);
+ void test3(long l) { foo(l); }
+ struct A {
+ friend void foo(A*) __attribute__((deprecated));
+ };
+ void test4(A *a) { foo(a); } // expected-warning {{deprecated}}
+
+ namespace ns {
+ struct Foo {};
+ void foo(const Foo &f) __attribute__((deprecated));
+ }
+ void test5() {
+ foo(ns::Foo()); // expected-warning {{deprecated}}
+ }
+}
+
+// Overloaded class members.
+namespace test2 {
+ struct A {
+ void foo(int) __attribute__((deprecated));
+ void foo(long);
+ static void bar(int) __attribute__((deprecated));
+ static void bar(long);
+
+ void test2(int i, long l);
+ };
+ void test1(int i, long l) {
+ A a;
+ a.foo(i); // expected-warning {{deprecated}}
+ a.foo(l);
+ a.bar(i); // expected-warning {{deprecated}}
+ a.bar(l);
+ A::bar(i); // expected-warning {{deprecated}}
+ A::bar(l);
+ }
+
+ void A::test2(int i, long l) {
+ foo(i); // expected-warning {{deprecated}}
+ foo(l);
+ bar(i); // expected-warning {{deprecated}}
+ bar(l);
+ }
+}
+
+// Overloaded operators.
+namespace test3 {
+ struct A {
+ void operator*(const A &);
+ void operator*(int) __attribute__((deprecated));
+ void operator-(const A &) const;
+ };
+ void operator+(const A &, const A &);
+ void operator+(const A &, int) __attribute__((deprecated));
+ void operator-(const A &, int) __attribute__((deprecated));
+
+ void test() {
+ A a, b;
+ a + b;
+ a + 1; // expected-warning {{deprecated}}
+ a - b;
+ a - 1; // expected-warning {{deprecated}}
+ a * b;
+ a * 1; // expected-warning {{deprecated}}
+ }
+}
+
+// Overloaded operator call.
+namespace test4 {
+ struct A {
+ typedef void (*intfn)(int);
+ typedef void (*unintfn)(unsigned);
+ operator intfn() __attribute__((deprecated));
+ operator unintfn();
+ void operator ()(A &) __attribute__((deprecated));
+ void operator ()(const A &);
+ };
+
+ void test() {
+ A a;
+ a(1); // expected-warning {{deprecated}}
+ a(1U);
+
+ A &b = a;
+ const A &c = a;
+ a(b); // expected-warning {{deprecated}}
+ a(c);
+ }
+}
+
+namespace test5 {
+ struct A {
+ operator int() __attribute__((deprecated));
+ operator long();
+ };
+ void test1(A a) {
+ int i = a; // expected-warning {{deprecated}}
+ long l = a;
+ }
+
+ void foo(int);
+ void foo(void*);
+ void bar(long);
+ void bar(void*);
+ void test2(A a) {
+ foo(a); // expected-warning {{deprecated}}
+ bar(a);
+ }
+
+ struct B {
+ int myInt;
+ long myLong;
+
+ B(A &a) :
+ myInt(a), // expected-warning {{deprecated}}
+ myLong(a)
+ {}
+ };
+}
diff --git a/test/SemaCXX/blocks.cpp b/test/SemaCXX/blocks.cpp
index 9429543..baa79e7 100644
--- a/test/SemaCXX/blocks.cpp
+++ b/test/SemaCXX/blocks.cpp
@@ -9,3 +9,35 @@ void tovoid_test(int (^f)(int, int)) {
void reference_lvalue_test(int& (^f)()) {
f() = 10;
}
+
+// PR 7165
+namespace test1 {
+ void g(void (^)());
+ struct Foo {
+ void foo();
+ void test() {
+ (void) ^{ foo(); };
+ }
+ };
+}
+
+namespace test2 {
+ int repeat(int value, int (^block)(int), unsigned n) {
+ while (n--) value = block(value);
+ return value;
+ }
+
+ class Power {
+ int base;
+
+ public:
+ Power(int base) : base(base) {}
+ int calculate(unsigned n) {
+ return repeat(1, ^(int v) { return v * base; }, n);
+ }
+ };
+
+ int test() {
+ return Power(2).calculate(10);
+ }
+}
diff --git a/test/SemaCXX/c99-variable-length-array.cpp b/test/SemaCXX/c99-variable-length-array.cpp
new file mode 100644
index 0000000..7dc912a
--- /dev/null
+++ b/test/SemaCXX/c99-variable-length-array.cpp
@@ -0,0 +1,116 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wvla %s
+struct NonPOD {
+ NonPOD();
+};
+
+struct NonPOD2 {
+ NonPOD np;
+};
+
+struct POD {
+ int x;
+ int y;
+};
+
+// We allow VLAs of POD types, only.
+void vla(int N) {
+ int array1[N]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ POD array2[N]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ NonPOD array3[N]; // expected-error{{variable length array of non-POD element type 'NonPOD'}}
+ NonPOD2 array4[N][3]; // expected-error{{variable length array of non-POD element type 'NonPOD2'}}
+}
+
+/// Warn about VLAs in templates.
+template<typename T>
+void vla_in_template(int N, T t) {
+ int array1[N]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+}
+
+struct HasConstantValue {
+ static const unsigned int value = 2;
+};
+
+struct HasNonConstantValue {
+ static unsigned int value;
+};
+
+template<typename T>
+void vla_in_template(T t) {
+ int array2[T::value]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+}
+
+template void vla_in_template<HasConstantValue>(HasConstantValue);
+template void vla_in_template<HasNonConstantValue>(HasNonConstantValue); // expected-note{{instantiation of}}
+
+template<typename T> struct X0 { };
+
+// Cannot use any variably-modified type with a template parameter or
+// argument.
+void inst_with_vla(int N) {
+ int array[N]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ X0<__typeof__(array)> x0a; // expected-error{{variably modified type 'typeof (array)' (aka 'int [N]') cannot be used as a template argument}}
+}
+
+template<typename T>
+struct X1 {
+ template<int (&Array)[T::value]> // expected-error{{non-type template parameter of variably modified type 'int (&)[HasNonConstantValue::value]'}} \
+ // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ struct Inner {
+
+ };
+};
+
+X1<HasConstantValue> x1a;
+X1<HasNonConstantValue> x1b; // expected-note{{in instantiation of}}
+
+// Template argument deduction does not allow deducing a size from a VLA.
+template<typename T, unsigned N>
+void accept_array(T (&array)[N]); // expected-note{{candidate template ignored: failed template argument deduction}}
+
+void test_accept_array(int N) {
+ int array[N]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ accept_array(array); // expected-error{{no matching function for call to 'accept_array'}}
+}
+
+// Variably-modified types cannot be used in local classes.
+void local_classes(int N) {
+ struct X {
+ int size;
+ int array[N]; // expected-error{{fields must have a constant size: 'variable length array in structure' extension will never be supported}} \
+ // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ };
+}
+
+namespace PR7206 {
+ void f(int x) {
+ struct edge_info {
+ float left;
+ float right;
+ };
+ struct edge_info edgeInfo[x]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ }
+}
+
+namespace rdar8020206 {
+ template<typename T>
+ void f(int i) {
+ const unsigned value = i;
+ int array[value * i]; // expected-warning 2{{variable length arrays are a C99 feature, accepted as an extension}}
+ }
+
+ template void f<int>(int); // expected-note{{instantiation of}}
+}
+
+namespace rdar8021385 {
+ typedef int my_int;
+ struct A { typedef int my_int; };
+ template<typename T>
+ struct B {
+ typedef typename T::my_int my_int;
+ void f0() {
+ int M = 4;
+ my_int a[M]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ }
+ };
+ B<A> a;
+}
diff --git a/test/SemaCXX/c99.cpp b/test/SemaCXX/c99.cpp
index f4c3639..b0bd45d 100644
--- a/test/SemaCXX/c99.cpp
+++ b/test/SemaCXX/c99.cpp
@@ -1,8 +1,3 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-void f0(int i) {
- char array[i]; // expected-error{{variable length arrays}}
-}
-
void f1(int i[static 5]) { // expected-error{{C99}}
}
diff --git a/test/SemaCXX/class.cpp b/test/SemaCXX/class.cpp
index 7eea67a..b5cecbc 100644
--- a/test/SemaCXX/class.cpp
+++ b/test/SemaCXX/class.cpp
@@ -136,3 +136,26 @@ namespace pr6629 {
};
};
}
+
+namespace PR7153 {
+ class EnclosingClass {
+ public:
+ struct A { } mutable *member;
+ };
+
+ void f(const EnclosingClass &ec) {
+ ec.member = 0;
+ }
+}
+
+namespace PR7196 {
+ struct A {
+ int a;
+
+ void f() {
+ char i[sizeof(a)];
+ enum { x = sizeof(i) };
+ enum { y = sizeof(a) };
+ }
+ };
+}
diff --git a/test/SemaCXX/compare.cpp b/test/SemaCXX/compare.cpp
index cd243e3..4790347 100644
--- a/test/SemaCXX/compare.cpp
+++ b/test/SemaCXX/compare.cpp
@@ -19,8 +19,8 @@ int test0(long a, unsigned long b) {
((signed char) a == b) + // expected-warning {{comparison of integers of different signs}}
((long) a == (unsigned long) b) + // expected-warning {{comparison of integers of different signs}}
((int) a == (unsigned int) b) + // expected-warning {{comparison of integers of different signs}}
- ((short) a == (unsigned short) b) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a == (unsigned char) b) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a == (unsigned short) b) +
+ ((signed char) a == (unsigned char) b) +
(a < (unsigned long) b) + // expected-warning {{comparison of integers of different signs}}
(a < (unsigned int) b) +
(a < (unsigned short) b) +
@@ -31,8 +31,8 @@ int test0(long a, unsigned long b) {
((signed char) a < b) + // expected-warning {{comparison of integers of different signs}}
((long) a < (unsigned long) b) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) b) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) b) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) b) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) b) +
+ ((signed char) a < (unsigned char) b) +
// (A,b)
(A == (unsigned long) b) +
@@ -83,8 +83,8 @@ int test0(long a, unsigned long b) {
((signed char) a < B) +
((long) a < (unsigned long) B) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) B) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) B) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) B) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) B) +
+ ((signed char) a < (unsigned char) B) +
// (C,b)
(C == (unsigned long) b) +
@@ -135,8 +135,8 @@ int test0(long a, unsigned long b) {
((signed char) a < C) +
((long) a < (unsigned long) C) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) C) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) C) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) C) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) C) +
+ ((signed char) a < (unsigned char) C) +
// (0x80000,b)
(0x80000 == (unsigned long) b) +
@@ -187,8 +187,8 @@ int test0(long a, unsigned long b) {
((signed char) a < 0x80000) +
((long) a < (unsigned long) 0x80000) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) 0x80000) + // expected-warning {{comparison of integers of different signs}}
- ((short) a < (unsigned short) 0x80000) + // expected-warning {{comparison of integers of different signs}}
- ((signed char) a < (unsigned char) 0x80000) + // expected-warning {{comparison of integers of different signs}}
+ ((short) a < (unsigned short) 0x80000) +
+ ((signed char) a < (unsigned char) 0x80000) +
10
;
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp
index a812a59..a09ff2b 100644
--- a/test/SemaCXX/conditional-expr.cpp
+++ b/test/SemaCXX/conditional-expr.cpp
@@ -238,3 +238,40 @@ namespace PR6757 {
(void)(true ? Bar() : Foo3()); // expected-error{{no viable constructor copying temporary}}
}
}
+
+// Reduced from selfhost.
+namespace test1 {
+ struct A {
+ enum Foo {
+ fa, fb, fc, fd, fe, ff
+ };
+
+ Foo x();
+ };
+
+ void foo(int);
+
+ void test(A *a) {
+ foo(a ? a->x() : 0);
+ }
+}
+
+namespace rdar7998817 {
+ class X {
+ X(X&); // expected-note{{declared private here}}
+
+ struct ref { };
+
+ public:
+ X();
+ X(ref);
+
+ operator ref();
+ };
+
+ void f(bool B) {
+ X x;
+ (void)(B? x // expected-error{{calling a private constructor of class 'rdar7998817::X'}}
+ : X());
+ }
+}
diff --git a/test/SemaCXX/constant-expression.cpp b/test/SemaCXX/constant-expression.cpp
index a17dd58..1341036 100644
--- a/test/SemaCXX/constant-expression.cpp
+++ b/test/SemaCXX/constant-expression.cpp
@@ -57,8 +57,8 @@ template <int itval, Enum etval> struct C {
i10 = sizeof(Struct),
i11 = true? 1 + cval * Struct::sval ^ itval / (int)1.5 - sizeof(Struct) : 0
;
- void f() {
- switch(0) {
+ void f(int cond) {
+ switch(cond) {
case 0 + 1:
case 100 + eval:
case 200 + cval:
diff --git a/test/SemaCXX/default-assignment-operator.cpp b/test/SemaCXX/default-assignment-operator.cpp
index dee6d13..668c600 100644
--- a/test/SemaCXX/default-assignment-operator.cpp
+++ b/test/SemaCXX/default-assignment-operator.cpp
@@ -1,15 +1,14 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
class Base { // expected-error {{cannot define the implicit default assignment operator for 'Base', because non-static reference member 'ref' can't use default assignment operator}} \
- // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}} \
- // expected-note {{synthesized method is first required here}}
+ // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}}
int &ref; // expected-note {{declared here}} \
// expected-note{{reference member 'ref' will never be initialized}}
};
class X : Base { // // expected-error {{cannot define the implicit default assignment operator for 'X', because non-static const member 'cint' can't use default assignment operator}} \
- // expected-note {{synthesized method is first required here}}
-public:
+// expected-note{{assignment operator for 'Base' first required here}}
+public:
X();
const int cint; // expected-note {{declared here}}
};
@@ -29,7 +28,7 @@ Z z2;
// Test1
void f(X x, const X cx) {
- x = cx;
+ x = cx; // expected-note{{assignment operator for 'X' first required here}}
x = cx;
z1 = z2;
}
@@ -74,8 +73,7 @@ void i() {
// Test5
-class E1 { // expected-error{{cannot define the implicit default assignment operator for 'E1', because non-static const member 'a' can't use default assignment operator}} \
- // expected-note {{synthesized method is first required here}}
+class E1 { // expected-error{{cannot define the implicit default assignment operator for 'E1', because non-static const member 'a' can't use default assignment operator}}
public:
const int a; // expected-note{{declared here}}
@@ -86,7 +84,7 @@ public:
E1 e1, e2;
void j() {
- e1 = e2;
+ e1 = e2; // expected-note{{assignment operator for 'E1' first required here}}
}
namespace ProtectedCheck {
@@ -103,7 +101,8 @@ namespace ProtectedCheck {
X x;
};
- void f(Z z) { z = z; } //
+ void f(Z z) { z = z; } // expected-note{{implicit default copy assignment operator}}
+
}
namespace MultiplePaths {
diff --git a/test/SemaCXX/empty-class-layout.cpp b/test/SemaCXX/empty-class-layout.cpp
index c3dc733..27f5040 100644
--- a/test/SemaCXX/empty-class-layout.cpp
+++ b/test/SemaCXX/empty-class-layout.cpp
@@ -2,6 +2,8 @@
#define SA(n, p) int a##n[(p) ? 1 : -1]
+namespace Test0 {
+
struct A { int a; };
SA(0, sizeof(A) == 4);
@@ -66,3 +68,19 @@ SA(11, sizeof(S7) == 8);
struct S8 : Empty, A {
};
SA(12, sizeof(S8) == 4);
+
+}
+
+namespace Test1 {
+
+// Test that we don't try to place both A subobjects at offset 0.
+struct A { };
+class B { virtual void f(); };
+class C : A, virtual B { };
+struct D : virtual C { };
+struct E : virtual A { };
+class F : D, E { };
+
+SA(0, sizeof(F) == 24);
+
+}
diff --git a/test/SemaCXX/enum.cpp b/test/SemaCXX/enum.cpp
index dc4a506..bfb5784 100644
--- a/test/SemaCXX/enum.cpp
+++ b/test/SemaCXX/enum.cpp
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++98 -verify -triple x86_64-apple-darwin %s
-
enum E {
Val1,
Val2
@@ -71,3 +70,12 @@ namespace PR6061 {
namespace Conditional {
enum a { A }; a x(const enum a x) { return 1?x:A; }
}
+
+namespace PR7051 {
+ enum E { e0 };
+ void f() {
+ E e;
+ e = 1; // expected-error{{assigning to 'PR7051::E' from incompatible type 'int'}}
+ e |= 1; // expected-error{{assigning to 'PR7051::E' from incompatible type 'int'}}
+ }
+}
diff --git a/test/SemaCXX/flexible-array-test.cpp b/test/SemaCXX/flexible-array-test.cpp
new file mode 100644
index 0000000..02e3f83
--- /dev/null
+++ b/test/SemaCXX/flexible-array-test.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// pr7029
+
+template <class Key, class T> struct QMap
+{
+ void insert(const Key &, const T &);
+ T v;
+};
+
+
+template <class Key, class T>
+void QMap<Key, T>::insert(const Key &, const T &avalue)
+{
+ v = avalue;
+}
+
+
+struct inotify_event
+{
+ int wd;
+
+ // clang doesn't like '[]':
+ // cannot initialize a parameter of type 'void *' with an rvalue of type 'char (*)[]'
+ char name [];
+};
+
+
+void foo()
+{
+ inotify_event event;
+ inotify_event* ptr = &event;
+ inotify_event event1 = *ptr;
+ *ptr = event;
+ QMap<int, inotify_event> eventForId;
+ eventForId.insert(ptr->wd, *ptr);
+}
+
+struct S {
+ virtual void foo();
+};
+
+struct X {
+ int blah;
+ S strings[]; // expected-error {{flexible array member 'strings' of non-POD element type 'S []'}}
+};
diff --git a/test/SemaCXX/i-c-e-cxx.cpp b/test/SemaCXX/i-c-e-cxx.cpp
index e8275d4..9672a42 100644
--- a/test/SemaCXX/i-c-e-cxx.cpp
+++ b/test/SemaCXX/i-c-e-cxx.cpp
@@ -17,7 +17,7 @@ void f() {
int a() {
const int t=t; // expected-note {{subexpression not valid}}
- switch(1) {
+ switch(1) { // expected-warning {{no case matching constant switch condition '1'}}
case t:; // expected-error {{not an integer constant expression}}
}
}
diff --git a/test/SemaCXX/implicit-virtual-member-functions.cpp b/test/SemaCXX/implicit-virtual-member-functions.cpp
index cb24501..f6082e5 100644
--- a/test/SemaCXX/implicit-virtual-member-functions.cpp
+++ b/test/SemaCXX/implicit-virtual-member-functions.cpp
@@ -21,9 +21,9 @@ C::C() { } // expected-note {{implicit default destructor for 'C' first require
struct D : A { // expected-error {{no suitable member 'operator delete' in 'D'}}
void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
-}; // expected-note {{implicit default destructor for 'D' first required here}}
+};
void f() {
- new D;
+ new D; // expected-note {{implicit default destructor for 'D' first required here}}
}
diff --git a/test/SemaCXX/invalid-instantiated-field-decl.cpp b/test/SemaCXX/invalid-instantiated-field-decl.cpp
new file mode 100644
index 0000000..8b26489
--- /dev/null
+++ b/test/SemaCXX/invalid-instantiated-field-decl.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template <typename T>
+class SmallVectorImpl {
+public:
+ explicit SmallVectorImpl(unsigned N) {
+ }
+
+ ~SmallVectorImpl() { }
+
+};
+
+template <typename T, unsigned N>
+class SmallVector : public SmallVectorImpl<T> {
+ typedef typename SmallVectorImpl<T>::U U; // expected-error {{no type named 'U' in 'SmallVectorImpl<CallSite>'}}
+ enum {
+
+ MinUs = (static_cast<unsigned int>(sizeof(T))*N + // expected-error {{invalid application of 'sizeof' to an incomplete type 'CallSite'}}
+ static_cast<unsigned int>(sizeof(U)) - 1) /
+ static_cast<unsigned int>(sizeof(U)),
+ NumInlineEltsElts = MinUs
+ };
+ U InlineElts[NumInlineEltsElts];
+public:
+ SmallVector() : SmallVectorImpl<T>(NumInlineEltsElts) {
+ }
+
+};
+
+class CallSite; // expected-note {{forward declaration of 'CallSite'}}
+class InlineFunctionInfo {
+public:
+ explicit InlineFunctionInfo() {}
+ SmallVector<CallSite, 2> DevirtualizedCalls; // expected-note {{in instantiation of template class 'SmallVector<CallSite, 2>' requested}}
+};
diff --git a/test/SemaCXX/member-pointer.cpp b/test/SemaCXX/member-pointer.cpp
index be25cbd..9d5cd2f 100644
--- a/test/SemaCXX/member-pointer.cpp
+++ b/test/SemaCXX/member-pointer.cpp
@@ -157,3 +157,20 @@ namespace pr6783 {
return object->*p2m; // expected-error {{left hand operand to ->*}}
}
}
+
+namespace PR7176 {
+ namespace base
+ {
+ struct Process
+ { };
+ struct Continuous : Process
+ {
+ bool cond();
+ };
+ }
+
+ typedef bool( base::Process::*Condition )();
+
+ void m()
+ { (void)(Condition) &base::Continuous::cond; }
+}
diff --git a/test/SemaCXX/namespace-alias.cpp b/test/SemaCXX/namespace-alias.cpp
index 1c3da3c..52cae2e 100644
--- a/test/SemaCXX/namespace-alias.cpp
+++ b/test/SemaCXX/namespace-alias.cpp
@@ -84,6 +84,26 @@ namespace K {
}
}
+namespace {
+ class C1;
+}
+namespace {
+ class C1;
+}
+C1 *pc1 = 0;
+
+namespace N {
+ namespace {
+ class C2;
+ }
+}
+namespace N {
+ namespace {
+ class C2;
+ }
+}
+N::C2 *pc2 = 0;
+
// PR6341
namespace A = N;
namespace N { }
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp
index 59a8e8c..0dc1097 100644
--- a/test/SemaCXX/nested-name-spec.cpp
+++ b/test/SemaCXX/nested-name-spec.cpp
@@ -228,3 +228,19 @@ namespace test3 {
A::execute(path); // expected-error {{incomplete type 'test3::A' named in nested name specifier}}
}
}
+
+namespace PR7133 {
+ namespace A {
+ class Foo;
+ }
+
+ namespace A {
+ namespace B {
+ bool foo(Foo &);
+ }
+ }
+
+ bool A::B::foo(Foo &) {
+ return false;
+ }
+}
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index 763ed2c..3f1da02 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -24,6 +24,8 @@ void* operator new(size_t, int*); // expected-note 3 {{candidate}}
void* operator new(size_t, float*); // expected-note 3 {{candidate}}
void* operator new(size_t, S); // expected-note 2 {{candidate}}
+struct foo { };
+
void good_news()
{
int *pi = new int;
@@ -43,6 +45,14 @@ void good_news()
pi = new (S(1.0f, 2)) int;
(void)new int[true];
+
+ // PR7147
+ typedef int a[2];
+ foo* f1 = new foo;
+ foo* f2 = new foo[2];
+ typedef foo x[2];
+ typedef foo y[2][2];
+ x* f3 = new y;
}
struct abstract {
@@ -93,7 +103,7 @@ void bad_deletes()
delete 0; // expected-error {{cannot delete expression of type 'int'}}
delete [0] (int*)0; // expected-error {{expected ']'}} \
// expected-note {{to match this '['}}
- delete (void*)0; // expected-error {{cannot delete expression}}
+ delete (void*)0; // expected-warning {{cannot delete expression with pointer-to-'void' type 'void *'}}
delete (T*)0; // expected-warning {{deleting pointer to incomplete type}}
::S::delete (int*)0; // expected-error {{expected unqualified-id}}
}
@@ -235,6 +245,9 @@ namespace Test1 {
void f() {
(void)new int[10](1, 2); // expected-error {{array 'new' cannot have initialization arguments}}
+
+ typedef int T[10];
+ (void)new T(1, 2); // expected-error {{array 'new' cannot have initialization arguments}}
}
template<typename T>
diff --git a/test/SemaCXX/offsetof.cpp b/test/SemaCXX/offsetof.cpp
index 47c3f22..639d7fa 100644
--- a/test/SemaCXX/offsetof.cpp
+++ b/test/SemaCXX/offsetof.cpp
@@ -26,7 +26,7 @@ struct HasArray {
// Constant and non-constant offsetof expressions
void test_ice(int i) {
int array0[__builtin_offsetof(HasArray, array[5])];
- int array1[__builtin_offsetof(HasArray, array[i])]; // expected-error{{variable length arrays are not permitted in C++}}
+ int array1[__builtin_offsetof(HasArray, array[i])];
}
// Bitfields
diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp
index 79c74ce..29133c7 100644
--- a/test/SemaCXX/overload-call.cpp
+++ b/test/SemaCXX/overload-call.cpp
@@ -430,3 +430,33 @@ namespace PR6177 {
void g() { f(""); } // expected-error{{volatile lvalue reference to type 'bool const volatile' cannot bind to a value of unrelated type 'char const [1]'}}
}
+
+namespace PR7095 {
+ struct X { };
+
+ struct Y {
+ operator const X*();
+
+ private:
+ operator X*();
+ };
+
+ void f(const X *);
+ void g(Y y) { f(y); }
+}
+
+namespace PR7224 {
+ class A {};
+ class B : public A {};
+
+ int &foo(A *const d);
+ float &foo(const A *const d);
+
+ void bar()
+ {
+ B *const d = 0;
+ B const *const d2 = 0;
+ int &ir = foo(d);
+ float &fr = foo(d2);
+ }
+}
diff --git a/test/SemaCXX/references.cpp b/test/SemaCXX/references.cpp
index e40ea01..a7aafe4 100644
--- a/test/SemaCXX/references.cpp
+++ b/test/SemaCXX/references.cpp
@@ -115,3 +115,18 @@ void test10() {
int &c = ev.x; // expected-error{{non-const reference cannot bind to vector element}}
const int &d = ev.x;
}
+
+namespace PR7149 {
+ template<typename T> struct X0
+ {
+ T& first;
+ X0(T& p1) : first(p1) { }
+ };
+
+
+ void f()
+ {
+ int p1[1];
+ X0< const int[1]> c(p1);
+ }
+}
diff --git a/test/SemaCXX/return-noreturn.cpp b/test/SemaCXX/return-noreturn.cpp
new file mode 100644
index 0000000..9242d12
--- /dev/null
+++ b/test/SemaCXX/return-noreturn.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -Wmissing-noreturn -Wno-unreachable-code
+
+// A destructor may be marked noreturn and should still influence the CFG.
+namespace PR6884 {
+ struct abort_struct {
+ abort_struct() {} // Make this non-POD so the destructor is invoked.
+ ~abort_struct() __attribute__((noreturn));
+ };
+
+ int f() {
+ abort_struct();
+ }
+
+ int f2() {
+ abort_struct s;
+ } // expected-warning{{control reaches end of non-void function}}
+}
diff --git a/test/SemaCXX/scope-check.cpp b/test/SemaCXX/scope-check.cpp
new file mode 100644
index 0000000..cef64f6
--- /dev/null
+++ b/test/SemaCXX/scope-check.cpp
@@ -0,0 +1,123 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-unreachable-code
+
+namespace test0 {
+ struct D { ~D(); };
+
+ int f(bool b) {
+ if (b) {
+ D d;
+ goto end;
+ }
+
+ end:
+ return 1;
+ }
+}
+
+namespace test1 {
+ struct C { C(); };
+
+ int f(bool b) {
+ if (b)
+ goto foo; // expected-error {{illegal goto into protected scope}}
+ C c; // expected-note {{jump bypasses variable initialization}}
+ foo:
+ return 1;
+ }
+}
+
+namespace test2 {
+ struct C { C(); };
+
+ int f(void **ip) {
+ static void *ips[] = { &&lbl1, &&lbl2 };
+
+ C c;
+ goto *ip;
+ lbl1:
+ return 0;
+ lbl2:
+ return 1;
+ }
+}
+
+namespace test3 {
+ struct C { C(); };
+
+ int f(void **ip) {
+ static void *ips[] = { &&lbl1, &&lbl2 };
+
+ goto *ip;
+ lbl1: {
+ C c;
+ return 0;
+ }
+ lbl2:
+ return 1;
+ }
+}
+
+namespace test4 {
+ struct C { C(); };
+ struct D { ~D(); };
+
+ int f(void **ip) {
+ static void *ips[] = { &&lbl1, &&lbl2 };
+
+ C c0;
+
+ goto *ip; // expected-warning {{indirect goto might cross protected scopes}}
+ C c1; // expected-note {{jump bypasses variable initialization}}
+ lbl1: // expected-note {{possible target of indirect goto}}
+ return 0;
+ lbl2:
+ return 1;
+ }
+}
+
+namespace test5 {
+ struct C { C(); };
+ struct D { ~D(); };
+
+ int f(void **ip) {
+ static void *ips[] = { &&lbl1, &&lbl2 };
+ C c0;
+
+ goto *ip;
+ lbl1: // expected-note {{possible target of indirect goto}}
+ return 0;
+ lbl2:
+ if (ip[1]) {
+ D d; // expected-note {{jump exits scope of variable with non-trivial destructor}}
+ ip += 2;
+ goto *ip; // expected-warning {{indirect goto might cross protected scopes}}
+ }
+ return 1;
+ }
+}
+
+namespace test6 {
+ struct C { C(); };
+
+ unsigned f(unsigned s0, unsigned s1, void **ip) {
+ static void *ips[] = { &&lbl1, &&lbl2, &&lbl3, &&lbl4 };
+ C c0;
+
+ goto *ip;
+ lbl1:
+ s0++;
+ goto *++ip;
+ lbl2:
+ s0 -= s1;
+ goto *++ip;
+ lbl3: {
+ unsigned tmp = s0;
+ s0 = s1;
+ s1 = tmp;
+ goto *++ip;
+ }
+ lbl4:
+ return s0;
+ }
+}
+
diff --git a/test/SemaCXX/switch.cpp b/test/SemaCXX/switch.cpp
index c256960..fc13630 100644
--- a/test/SemaCXX/switch.cpp
+++ b/test/SemaCXX/switch.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum %s
void test() {
bool x = true;
@@ -40,3 +40,20 @@ void x3(C &c) {
switch (c) { // expected-error{{incomplete class type}}
}
}
+
+namespace test3 {
+ enum En { A, B, C };
+ template <En how> void foo() {
+ int x = 0, y = 5;
+
+ switch (how) { //expected-warning {{no case matching constant switch condition '2'}}
+ case A: x *= y; break;
+ case B: x += y; break;
+ // No case for C, but it's okay because we have a constant condition.
+ }
+ }
+
+ template void foo<A>();
+ template void foo<B>();
+ template void foo<C>(); //expected-note {{in instantiation}}
+}
diff --git a/test/SemaCXX/vararg-non-pod.cpp b/test/SemaCXX/vararg-non-pod.cpp
index d31f1f7..55ec941 100644
--- a/test/SemaCXX/vararg-non-pod.cpp
+++ b/test/SemaCXX/vararg-non-pod.cpp
@@ -88,3 +88,13 @@ void test_typeid(Base &base) {
(void)typeid(get_base(base)); // expected-warning{{cannot pass object of non-POD type 'Base' through variadic function; call will abort at runtime}}
(void)typeid(eat_base(base)); // okay
}
+
+
+// rdar://7985267 - Shouldn't warn, doesn't actually use __builtin_va_start is
+// magic.
+
+void t6(Foo somearg, ... ) {
+ __builtin_va_list list;
+ __builtin_va_start(list, somearg);
+}
+
diff --git a/test/SemaCXX/vector.cpp b/test/SemaCXX/vector.cpp
new file mode 100644
index 0000000..b548865
--- /dev/null
+++ b/test/SemaCXX/vector.cpp
@@ -0,0 +1,188 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
+typedef char char16 __attribute__ ((__vector_size__ (16)));
+typedef long long longlong16 __attribute__ ((__vector_size__ (16)));
+typedef char char16_e __attribute__ ((__ext_vector_type__ (16)));
+typedef long long longlong16_e __attribute__ ((__ext_vector_type__ (2)));
+
+// Test overloading and function calls with vector types.
+void f0(char16);
+
+void f0_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
+ f0(c16);
+ f0(ll16);
+ f0(c16e);
+ f0(ll16e);
+}
+
+int &f1(char16); // expected-note 2{{candidate function}}
+float &f1(longlong16); // expected-note 2{{candidate function}}
+
+void f1_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
+ int &ir1 = f1(c16);
+ float &fr1 = f1(ll16);
+ f1(c16e); // expected-error{{call to 'f1' is ambiguous}}
+ f1(ll16e); // expected-error{{call to 'f1' is ambiguous}}
+}
+
+void f2(char16_e); // expected-note{{no known conversion from 'longlong16_e' to 'char16_e' for 1st argument}} \
+ // expected-note{{candidate function not viable: no known conversion from 'convertible_to<longlong16_e>' to 'char16_e' for 1st argument}}
+
+void f2_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
+ f2(c16);
+ f2(ll16);
+ f2(c16e);
+ f2(ll16e); // expected-error{{no matching function}}
+ f2('a');
+ f2(17);
+}
+
+// Test the conditional operator with vector types.
+void conditional(bool Cond, char16 c16, longlong16 ll16, char16_e c16e,
+ longlong16_e ll16e) {
+ // Conditional operators with the same type.
+ __typeof__(Cond? c16 : c16) *c16p1 = &c16;
+ __typeof__(Cond? ll16 : ll16) *ll16p1 = &ll16;
+ __typeof__(Cond? c16e : c16e) *c16ep1 = &c16e;
+ __typeof__(Cond? ll16e : ll16e) *ll16ep1 = &ll16e;
+
+ // Conditional operators with similar types.
+ __typeof__(Cond? c16 : c16e) *c16ep2 = &c16e;
+ __typeof__(Cond? c16e : c16) *c16ep3 = &c16e;
+ __typeof__(Cond? ll16 : ll16e) *ll16ep2 = &ll16e;
+ __typeof__(Cond? ll16e : ll16) *ll16ep3 = &ll16e;
+
+ // Conditional operators with incompatible types.
+ (void)(Cond? c16 : ll16); // expected-error{{can't convert between vector values}}
+ (void)(Cond? ll16e : c16e); // expected-error{{can't convert between vector values}}
+ (void)(Cond? ll16e : c16); // expected-error{{can't convert between vector values}}
+}
+
+// Test C++ cast'ing of vector types.
+void casts(longlong16 ll16, longlong16_e ll16e) {
+ // C-style casts.
+ (void)(char16)ll16;
+ (void)(char16_e)ll16;
+ (void)(longlong16)ll16;
+ (void)(longlong16_e)ll16;
+ (void)(char16)ll16e;
+ (void)(char16_e)ll16e;
+ (void)(longlong16)ll16e;
+ (void)(longlong16_e)ll16e;
+
+ // Function-style casts.
+ (void)char16(ll16);
+ (void)char16_e(ll16);
+ (void)longlong16(ll16);
+ (void)longlong16_e(ll16);
+ (void)char16(ll16e);
+ (void)char16_e(ll16e);
+ (void)longlong16(ll16e);
+ (void)longlong16_e(ll16e);
+
+ // static_cast
+ (void)static_cast<char16>(ll16);
+ (void)static_cast<char16_e>(ll16);
+ (void)static_cast<longlong16>(ll16);
+ (void)static_cast<longlong16_e>(ll16);
+ (void)static_cast<char16>(ll16e);
+ (void)static_cast<char16_e>(ll16e); // expected-error{{static_cast from 'longlong16_e' to 'char16_e' is not allowed}}
+ (void)static_cast<longlong16>(ll16e);
+ (void)static_cast<longlong16_e>(ll16e);
+
+ // reinterpret_cast
+ (void)reinterpret_cast<char16>(ll16);
+ (void)reinterpret_cast<char16_e>(ll16);
+ (void)reinterpret_cast<longlong16>(ll16);
+ (void)reinterpret_cast<longlong16_e>(ll16);
+ (void)reinterpret_cast<char16>(ll16e);
+ (void)reinterpret_cast<char16_e>(ll16e);
+ (void)reinterpret_cast<longlong16>(ll16e);
+ (void)reinterpret_cast<longlong16_e>(ll16e);
+}
+
+template<typename T>
+struct convertible_to { // expected-note 3 {{candidate function (the implicit copy assignment operator)}}
+ operator T() const;
+};
+
+void test_implicit_conversions(bool Cond, char16 c16, longlong16 ll16,
+ char16_e c16e, longlong16_e ll16e,
+ convertible_to<char16> to_c16,
+ convertible_to<longlong16> to_ll16,
+ convertible_to<char16_e> to_c16e,
+ convertible_to<longlong16_e> to_ll16e,
+ convertible_to<char16&> rto_c16,
+ convertible_to<char16_e&> rto_c16e) {
+ f0(to_c16);
+ f0(to_ll16);
+ f0(to_c16e);
+ f0(to_ll16e);
+ f2(to_c16);
+ f2(to_ll16);
+ f2(to_c16e);
+ f2(to_ll16e); // expected-error{{no matching function}}
+
+ (void)(c16 == c16e);
+ (void)(c16 == to_c16);
+ (void)+to_c16;
+ (void)-to_c16;
+ (void)~to_c16;
+ (void)(to_c16 == to_c16e);
+ (void)(to_c16 != to_c16e);
+ (void)(to_c16 < to_c16e);
+ (void)(to_c16 <= to_c16e);
+ (void)(to_c16 > to_c16e);
+ (void)(to_c16 >= to_c16e);
+ (void)(to_c16 + to_c16);
+ (void)(to_c16 - to_c16);
+ (void)(to_c16 * to_c16);
+ (void)(to_c16 / to_c16);
+ (void)(rto_c16 = to_c16); // expected-error{{no viable overloaded '='}}
+ (void)(rto_c16 += to_c16);
+ (void)(rto_c16 -= to_c16);
+ (void)(rto_c16 *= to_c16);
+ (void)(rto_c16 /= to_c16);
+
+ (void)+to_c16e;
+ (void)-to_c16e;
+ (void)~to_c16e;
+ (void)(to_c16e == to_c16e);
+ (void)(to_c16e != to_c16e);
+ (void)(to_c16e < to_c16e);
+ (void)(to_c16e <= to_c16e);
+ (void)(to_c16e > to_c16e);
+ (void)(to_c16e >= to_c16e);
+ (void)(to_c16e + to_c16);
+ (void)(to_c16e - to_c16);
+ (void)(to_c16e * to_c16);
+ (void)(to_c16e / to_c16);
+ (void)(rto_c16e = to_c16); // expected-error{{no viable overloaded '='}}
+ (void)(rto_c16e += to_c16);
+ (void)(rto_c16e -= to_c16);
+ (void)(rto_c16e *= to_c16);
+ (void)(rto_c16e /= to_c16);
+
+ (void)+to_c16;
+ (void)-to_c16;
+ (void)~to_c16;
+ (void)(to_c16 == to_c16e);
+ (void)(to_c16 != to_c16e);
+ (void)(to_c16 < to_c16e);
+ (void)(to_c16 <= to_c16e);
+ (void)(to_c16 > to_c16e);
+ (void)(to_c16 >= to_c16e);
+ (void)(to_c16 + to_c16e);
+ (void)(to_c16 - to_c16e);
+ (void)(to_c16 * to_c16e);
+ (void)(to_c16 / to_c16e);
+ (void)(rto_c16 = c16e); // expected-error{{no viable overloaded '='}}
+ (void)(rto_c16 += to_c16e); // expected-error{{expression is not assignable}}
+ (void)(rto_c16 -= to_c16e); // expected-error{{expression is not assignable}}
+ (void)(rto_c16 *= to_c16e); // expected-error{{expression is not assignable}}
+ (void)(rto_c16 /= to_c16e); // expected-error{{expression is not assignable}}
+
+ (void)(Cond? to_c16 : to_c16e);
+ (void)(Cond? to_ll16e : to_ll16);
+ (void)(Cond? to_c16 : to_ll16); // expected-error{{can't convert between vector values of different size}}
+ (void)(Cond? to_c16e : to_ll16e); // expected-error{{can't convert between vector values of different size}}
+}
diff --git a/test/SemaCXX/virtual-member-functions-key-function.cpp b/test/SemaCXX/virtual-member-functions-key-function.cpp
index 97164d9..09a30b9 100644
--- a/test/SemaCXX/virtual-member-functions-key-function.cpp
+++ b/test/SemaCXX/virtual-member-functions-key-function.cpp
@@ -4,17 +4,17 @@ struct A {
};
struct B : A { // expected-error {{no suitable member 'operator delete' in 'B'}}
- B() { }
+ B() { } // expected-note {{implicit default destructor for 'B' first required here}}
void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
-}; // expected-note {{implicit default destructor for 'B' first required here}}
+};
struct C : A { // expected-error {{no suitable member 'operator delete' in 'C'}}
void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
-}; // expected-note {{implicit default destructor for 'C' first required here}}
+};
void f() {
- (void)new B;
- (void)new C;
+ (void)new B;
+ (void)new C; // expected-note {{implicit default destructor for 'C' first required here}}
}
// Make sure that the key-function computation is consistent when the
diff --git a/test/SemaCXX/warn-missing-noreturn.cpp b/test/SemaCXX/warn-missing-noreturn.cpp
index 8016c3d..f2f9b2e 100644
--- a/test/SemaCXX/warn-missing-noreturn.cpp
+++ b/test/SemaCXX/warn-missing-noreturn.cpp
@@ -36,3 +36,17 @@ namespace test1 {
while (condition()) {}
}
}
+
+
+// <rdar://problem/7880658> - This test case previously had a false "missing return"
+// warning.
+struct R7880658 {
+ R7880658 &operator++();
+ bool operator==(const R7880658 &) const;
+ bool operator!=(const R7880658 &) const;
+};
+
+void f_R7880658(R7880658 f, R7880658 l) { // no-warning
+ for (; f != l; ++f) {
+ }
+}
diff --git a/test/SemaCXX/warn-reorder-ctor-initialization.cpp b/test/SemaCXX/warn-reorder-ctor-initialization.cpp
index 3ff01af..8c254e5 100644
--- a/test/SemaCXX/warn-reorder-ctor-initialization.cpp
+++ b/test/SemaCXX/warn-reorder-ctor-initialization.cpp
@@ -120,3 +120,13 @@ namespace test3 {
};
};
}
+
+namespace PR7179 {
+ struct X
+ {
+ struct Y
+ {
+ template <class T> Y(T x) : X(x) { }
+ };
+ };
+}
diff --git a/test/SemaCXX/warn-weak-vtables.cpp b/test/SemaCXX/warn-weak-vtables.cpp
index 39333c1..c0cfd74 100644
--- a/test/SemaCXX/warn-weak-vtables.cpp
+++ b/test/SemaCXX/warn-weak-vtables.cpp
@@ -18,4 +18,14 @@ void f() {
struct A {
virtual void f() { }
};
+
+ A *a;
+ a->f();
+}
+
+// Use the vtables
+void uses(A &a, B<int> &b, C &c) {
+ a.f();
+ b.f();
+ c.f();
}
diff --git a/test/SemaObjC/block-attr.m b/test/SemaObjC/block-attr.m
index c89aed4..de203e7 100644
--- a/test/SemaObjC/block-attr.m
+++ b/test/SemaObjC/block-attr.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-gc-only %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-gc-only %s
@interface Thing {}
diff --git a/test/SemaObjC/error-property-gc-attr.m b/test/SemaObjC/error-property-gc-attr.m
index a361704..661638c 100644
--- a/test/SemaObjC/error-property-gc-attr.m
+++ b/test/SemaObjC/error-property-gc-attr.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s
@interface INTF
{
@@ -11,7 +12,7 @@
}
@property (assign) __weak id pweak;
@property (assign) __weak id WID;
-@property (assign) __strong id not;
+@property (assign) __strong id NOT;
@property (assign) id ID;
@property (assign) INTF* AWEAK;
@property (assign) __weak INTF* WI;
@@ -19,7 +20,7 @@
@implementation INTF
@synthesize pweak=IVAR; // expected-error {{existing ivar 'IVAR' for __weak property 'pweak' must be __weak}}
-@synthesize not=II; // expected-error {{existing ivar 'II' for a __strong property 'not' must be garbage collectable}}
+@synthesize NOT=II; // expected-error {{existing ivar 'II' for a __strong property 'NOT' must be garbage collectable}}
@synthesize WID;
@synthesize ID;
@synthesize AWEAK; // expected-error {{existing ivar 'AWEAK' for a __strong property 'AWEAK' must be garbage collectable}}
diff --git a/test/SemaObjC/method-conflict.m b/test/SemaObjC/method-conflict.m
index 08fdfc0..5dc886f 100644
--- a/test/SemaObjC/method-conflict.m
+++ b/test/SemaObjC/method-conflict.m
@@ -53,3 +53,14 @@ typedef NSUInteger XDSourceLanguage;
return 0;
}
@end
+
+// rdar: // 8006060
+@interface Bar
+- (void)foo:(id)format, ...; // expected-note {{previous declaration is here}}
+- (void)foo1:(id)format; // expected-note {{previous declaration is here}}
+@end
+@implementation Bar
+- (void)foo:(id)format {}; // expected-warning {{conflicting variadic declaration of method and its implementation}}
+- (void)foo1:(id)format, ... {}; // expected-warning {{conflicting variadic declaration of method and its implementation}}
+@end
+
diff --git a/test/SemaObjC/objc2-warn-weak-decl.m b/test/SemaObjC/objc2-warn-weak-decl.m
index 76b542d..22a3fca 100644
--- a/test/SemaObjC/objc2-warn-weak-decl.m
+++ b/test/SemaObjC/objc2-warn-weak-decl.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s
+// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s
struct S {
__weak id p; // expected-warning {{__weak attribute cannot be specified on a field declaration}}
};
diff --git a/test/SemaObjC/warn-assign-property-nscopying.m b/test/SemaObjC/warn-assign-property-nscopying.m
index 953814c..1bdb4f0 100644
--- a/test/SemaObjC/warn-assign-property-nscopying.m
+++ b/test/SemaObjC/warn-assign-property-nscopying.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fobjc-gc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fobjc-gc -fsyntax-only -verify %s
@protocol NSCopying @end
diff --git a/test/SemaObjC/warn-weak-field.m b/test/SemaObjC/warn-weak-field.m
index f20691c..ead454a 100644
--- a/test/SemaObjC/warn-weak-field.m
+++ b/test/SemaObjC/warn-weak-field.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s
+// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s
struct S {
__weak id w; // expected-warning {{__weak attribute cannot be specified on a field declaration}}
diff --git a/test/SemaObjCXX/const-cast.mm b/test/SemaObjCXX/const-cast.mm
new file mode 100644
index 0000000..933fd47
--- /dev/null
+++ b/test/SemaObjCXX/const-cast.mm
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@class Foo;
+
+void test() {
+ const Foo *foo1 = 0;
+ Foo *foo2 = foo1; // expected-error {{cannot initialize}}
+}
+
+void test1() {
+ const Foo *foo1 = 0;
+ Foo *foo2 = const_cast<Foo*>(foo1);
+}
diff --git a/test/SemaObjCXX/conversion-to-objc-pointer-2.mm b/test/SemaObjCXX/conversion-to-objc-pointer-2.mm
new file mode 100644
index 0000000..5277d10
--- /dev/null
+++ b/test/SemaObjCXX/conversion-to-objc-pointer-2.mm
@@ -0,0 +1,87 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: // 7963410
+
+@protocol NSObject @end
+@interface NSObject
+- (id)init;
+- (id) alloc;
+- (id) autorelease;
+@end
+
+template<class T>
+class TNSAutoRef
+{
+public:
+ TNSAutoRef(T t)
+ : fRef(t)
+ { }
+
+ ~TNSAutoRef()
+ { }
+
+ operator T() const
+ { return fRef; }
+
+private:
+ T fRef;
+};
+
+
+#pragma mark -
+
+
+@protocol TFooProtocol <NSObject>
+
+- (void) foo;
+@end
+
+
+#pragma mark -
+
+
+@interface TFoo : NSObject
+
+- (void) setBlah: (id<TFooProtocol>)blah;
+@end
+
+
+#pragma mark -
+
+
+@implementation TFoo
+
+- (void) setBlah: (id<TFooProtocol>)blah
+ { }
+@end
+
+
+#pragma mark -
+
+
+@interface TBar : NSObject
+
+- (void) setBlah: (id)blah;
+@end
+
+#pragma mark -
+
+
+@implementation TBar
+
+- (void) setBlah: (id)blah
+ { }
+@end
+
+
+#pragma mark -
+
+
+int main (int argc, const char * argv[]) {
+
+ NSObject* object1 = [[[NSObject alloc] init] autorelease];
+ TNSAutoRef<NSObject*> object2([[NSObject alloc] init]);
+ TNSAutoRef<TBar*> bar([[TBar alloc] init]);
+ [bar setBlah: object1]; // <== Does not compile. It should.
+ [bar setBlah: object2]; // <== Does not compile. It should.
+ return 0;
+}
diff --git a/test/SemaObjCXX/conversion-to-objc-pointer.mm b/test/SemaObjCXX/conversion-to-objc-pointer.mm
new file mode 100644
index 0000000..235aaac
--- /dev/null
+++ b/test/SemaObjCXX/conversion-to-objc-pointer.mm
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: // 7963410
+
+template<class T>
+class TNSAutoRef
+{
+public:
+ TNSAutoRef(T t)
+ : fRef(t)
+ { }
+
+ ~TNSAutoRef()
+ { }
+
+ operator T() const
+ { return fRef; }
+
+ T Get() const
+ { return fRef; }
+
+private:
+ T fRef;
+};
+
+@interface NSObject
+- (id) alloc;
+- (id)init;
+@end
+
+@interface TFoo : NSObject
+- (void) foo;
+@end
+
+@implementation TFoo
+- (void) foo {}
+@end
+
+@interface TBar : NSObject
+- (void) foo;
+@end
+
+@implementation TBar
+- (void) foo {}
+@end
+
+int main () {
+ TNSAutoRef<TBar*> bar([[TBar alloc] init]);
+ [bar foo];
+ return 0;
+}
diff --git a/test/SemaObjCXX/deduction.mm b/test/SemaObjCXX/deduction.mm
new file mode 100644
index 0000000..6dd449d
--- /dev/null
+++ b/test/SemaObjCXX/deduction.mm
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@class NSString;
+
+// Reduced from WebKit.
+namespace test0 {
+ template <typename T> struct RemovePointer {
+ typedef T Type;
+ };
+
+ template <typename T> struct RemovePointer<T*> {
+ typedef T Type;
+ };
+
+ template <typename T> struct RetainPtr {
+ typedef typename RemovePointer<T>::Type ValueType;
+ typedef ValueType* PtrType;
+ RetainPtr(PtrType ptr);
+ };
+
+ void test(NSString *S) {
+ RetainPtr<NSString*> ptr(S);
+ }
+
+ void test(id S) {
+ RetainPtr<id> ptr(S);
+ }
+}
+
+@class Test1Class;
+@protocol Test1Protocol;
+namespace test1 {
+ template <typename T> struct RemovePointer {
+ typedef T type;
+ };
+ template <typename T> struct RemovePointer<T*> {
+ typedef T type;
+ };
+ template <typename A, typename B> struct is_same {};
+ template <typename A> struct is_same<A,A> {
+ static void foo();
+ };
+ template <typename T> struct tester {
+ void test() {
+ is_same<T, typename RemovePointer<T>::type*>::foo(); // expected-error 2 {{no member named 'foo'}}
+ }
+ };
+
+ template struct tester<id>;
+ template struct tester<id<Test1Protocol> >;
+ template struct tester<Class>;
+ template struct tester<Class<Test1Protocol> >;
+ template struct tester<Test1Class*>;
+ template struct tester<Test1Class<Test1Protocol>*>;
+
+ template struct tester<Test1Class>; // expected-note {{in instantiation}}
+ template struct tester<Test1Class<Test1Protocol> >; // expected-note {{in instantiation}}
+}
diff --git a/test/SemaObjCXX/ivar-construct.mm b/test/SemaObjCXX/ivar-construct.mm
new file mode 100644
index 0000000..da066e9
--- /dev/null
+++ b/test/SemaObjCXX/ivar-construct.mm
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+struct Y {
+ Y();
+
+private:
+ ~Y(); // expected-note 3{{declared private here}}
+};
+
+template<typename T>
+struct X : T { }; // expected-error 2{{private destructor}}
+
+struct Z; // expected-note{{forward declaration}}
+
+@interface A {
+ X<Y> x; // expected-note{{implicit default destructor}}
+ Y y; // expected-error{{private destructor}}
+}
+@end
+
+@implementation A // expected-note{{implicit default constructor}}
+@end
+
+@interface B {
+ Z z; // expected-error{{incomplete type}}
+}
+@end
+
+@implementation B
+@end
diff --git a/test/SemaObjCXX/ivar-struct.mm b/test/SemaObjCXX/ivar-struct.mm
new file mode 100644
index 0000000..3f9c7eb
--- /dev/null
+++ b/test/SemaObjCXX/ivar-struct.mm
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+@interface A {
+ struct X {
+ int x, y;
+ } X;
+}
+@end
diff --git a/test/SemaObjCXX/objc2-merge-gc-attribue-decl.mm b/test/SemaObjCXX/objc2-merge-gc-attribue-decl.mm
new file mode 100644
index 0000000..7be5f17
--- /dev/null
+++ b/test/SemaObjCXX/objc2-merge-gc-attribue-decl.mm
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s
+@interface INTF @end
+
+extern INTF* p2;
+extern __strong INTF* p2;
+
+extern __strong id p1;
+extern id p1;
+
+extern id CFRunLoopGetMain();
+extern __strong id CFRunLoopGetMain();
+
+extern __strong id CFRunLoopGetMain2();
+extern id CFRunLoopGetMain2();
+
+extern INTF* CFRunLoopGetMain3();
+extern __strong INTF* CFRunLoopGetMain3();
+
+extern __strong INTF* CFRunLoopGetMain4();
+extern INTF* CFRunLoopGetMain4();
+
+typedef id ID;
+extern ID CFRunLoopGetMain5();
+extern __strong id CFRunLoopGetMain5();
+
+extern __strong id CFRunLoopGetMain6();
+extern ID CFRunLoopGetMain6();
+
+extern ID CFRunLoopGetMain7();
+extern __strong ID CFRunLoopGetMain7();
+
+extern __strong ID CFRunLoopGetMain8();
+extern ID CFRunLoopGetMain8();
+
+extern __weak id WLoopGetMain(); // expected-note {{previous declaration is here}}
+extern id WLoopGetMain(); // expected-error {{functions that differ only in their return type cannot be overloaded}}
+
+extern id p3; // expected-note {{previous definition is here}}
+extern __weak id p3; // expected-error {{redefinition of 'p3' with a different type}}
+
+extern void *p4; // expected-note {{previous definition is here}}
+extern void * __strong p4; // expected-error {{redefinition of 'p4' with a different type}}
+
+extern id p5;
+extern __strong id p5;
+
+extern char* __strong p6; // expected-note {{previous definition is here}}
+extern char* p6; // expected-error {{redefinition of 'p6' with a different type}}
+
+extern __strong char* p7; // expected-note {{previous definition is here}}
+extern char* p7; // expected-error {{redefinition of 'p7' with a different type}}
diff --git a/test/SemaObjCXX/static-cast.mm b/test/SemaObjCXX/static-cast.mm
new file mode 100644
index 0000000..e282702
--- /dev/null
+++ b/test/SemaObjCXX/static-cast.mm
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@protocol NSTextViewDelegate;
+
+@interface NSResponder @end
+
+class AutoreleaseObject
+{
+public:
+ AutoreleaseObject();
+ ~AutoreleaseObject();
+
+
+ AutoreleaseObject& operator=(NSResponder* inValue);
+ AutoreleaseObject& operator=(const AutoreleaseObject& inValue);
+
+ AutoreleaseObject(const AutoreleaseObject& inValue);
+
+ operator NSResponder*() const;
+};
+
+
+void InvokeSaveFocus()
+{
+ AutoreleaseObject mResolvedFirstResponder;
+ id<NSTextViewDelegate> Mydelegate;
+ mResolvedFirstResponder = static_cast<NSResponder*>(Mydelegate);
+}
+
diff --git a/test/SemaObjCXX/vla.mm b/test/SemaObjCXX/vla.mm
index 9c6fc54..d6da1c0 100644
--- a/test/SemaObjCXX/vla.mm
+++ b/test/SemaObjCXX/vla.mm
@@ -6,7 +6,7 @@
@end
void test(Data *d) {
- char buffer[[d length]]; // expected-error{{variable length arrays are not permitted in C++}}
+ char buffer[[d length]];
[d getData:buffer];
}
diff --git a/test/SemaObjCXX/void_to_obj.mm b/test/SemaObjCXX/void_to_obj.mm
index 52510c8..7dca9fa 100644
--- a/test/SemaObjCXX/void_to_obj.mm
+++ b/test/SemaObjCXX/void_to_obj.mm
@@ -9,3 +9,18 @@ void func() {
obj = vv; // expected-error{{assigning to 'XX *' from incompatible type 'void *'}}
}
+
+// <rdar://problem/7952457>
+@interface I
+{
+ void* delegate;
+}
+- (I*) Meth;
+- (I*) Meth1;
+@end
+
+@implementation I
+- (I*) Meth { return static_cast<I*>(delegate); }
+- (I*) Meth1 { return reinterpret_cast<I*>(delegate); }
+@end
+
diff --git a/test/SemaTemplate/attributes.cpp b/test/SemaTemplate/attributes.cpp
new file mode 100644
index 0000000..b696c5c
--- /dev/null
+++ b/test/SemaTemplate/attributes.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<int N>
+struct X {
+ struct __attribute__((__aligned__((N)))) Aligned { }; // expected-error{{'aligned' attribute requires integer constant}}
+
+ int __attribute__((__address_space__(N))) *ptr; // expected-error{{attribute requires 1 argument(s)}}
+};
diff --git a/test/SemaTemplate/current-instantiation.cpp b/test/SemaTemplate/current-instantiation.cpp
index 4563748..c631dd7 100644
--- a/test/SemaTemplate/current-instantiation.cpp
+++ b/test/SemaTemplate/current-instantiation.cpp
@@ -151,3 +151,16 @@ struct X1 {
X1<T*>::a = b;
}
};
+
+namespace ConstantInCurrentInstantiation {
+ template<typename T>
+ struct X {
+ static const int value = 2;
+ static int array[value];
+ };
+
+ template<typename T> const int X<T>::value;
+
+ template<typename T>
+ int X<T>::array[X<T>::value] = { 1, 2 };
+}
diff --git a/test/SemaTemplate/dependent-base-classes.cpp b/test/SemaTemplate/dependent-base-classes.cpp
index d0dd9c9..e64d623 100644
--- a/test/SemaTemplate/dependent-base-classes.cpp
+++ b/test/SemaTemplate/dependent-base-classes.cpp
@@ -6,7 +6,7 @@ struct X0 : T::template apply<U> {
};
template<typename T, typename U>
-struct X1 : T::apply<U> { }; // expected-error{{missing 'template' keyword prior to dependent template name 'T::apply'}}
+struct X1 : T::apply<U> { }; // expected-error{{use 'template' keyword to treat 'apply' as a dependent template name}}
template<typename T>
struct X2 : vector<T> { }; // expected-error{{unknown template name 'vector'}}
diff --git a/test/SemaTemplate/dependent-expr.cpp b/test/SemaTemplate/dependent-expr.cpp
index 3f481b5..9fa7571 100644
--- a/test/SemaTemplate/dependent-expr.cpp
+++ b/test/SemaTemplate/dependent-expr.cpp
@@ -24,3 +24,19 @@ namespace PR6045 {
(void)(k % member);
}
}
+
+namespace PR7198 {
+ struct A
+ {
+ ~A() { }
+ };
+
+ template<typename T>
+ struct B {
+ struct C : A {};
+ void f()
+ {
+ C c = C();
+ }
+ };
+}
diff --git a/test/SemaTemplate/dependent-template-recover.cpp b/test/SemaTemplate/dependent-template-recover.cpp
new file mode 100644
index 0000000..e91ffb5
--- /dev/null
+++ b/test/SemaTemplate/dependent-template-recover.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+template<typename T, typename U, int N>
+struct X {
+ void f(T* t) {
+ t->f0<U>(); // expected-error{{use 'template' keyword to treat 'f0' as a dependent template name}}
+ t->f0<int>(); // expected-error{{use 'template' keyword to treat 'f0' as a dependent template name}}
+
+ t->operator+<U const, 1>(); // expected-error{{use 'template' keyword to treat 'operator +' as a dependent template name}}
+ t->f1<int const, 2>(); // expected-error{{use 'template' keyword to treat 'f1' as a dependent template name}}
+
+ T::getAs<U>(); // expected-error{{use 'template' keyword to treat 'getAs' as a dependent template name}}
+ t->T::getAs<U>(); // expected-error{{use 'template' keyword to treat 'getAs' as a dependent template name}}
+
+ // FIXME: We can't recover from these yet
+ (*t).f2<N>(); // expected-error{{expected expression}}
+ (*t).f2<0>(); // expected-error{{expected expression}}
+ }
+};
diff --git a/test/SemaTemplate/dependent-type-identity.cpp b/test/SemaTemplate/dependent-type-identity.cpp
index e095812..feffdcf 100644
--- a/test/SemaTemplate/dependent-type-identity.cpp
+++ b/test/SemaTemplate/dependent-type-identity.cpp
@@ -70,3 +70,19 @@ struct X1 {
void f8(typename N::X2<U>::template apply<T> *);
void f8(typename ::Nalias::X2<type>::template apply<U_type> *); // expected-error{{redeclar}}
};
+
+namespace PR6851 {
+ template <bool v>
+ struct S;
+
+ struct N {
+ template <bool w>
+ S< S<w>::cond && 1 > foo();
+ };
+
+ struct Alien;
+ bool operator&&(const Alien&, const Alien&);
+
+ template <bool w>
+ S< S<w>::cond && 1 > N::foo() { }
+}
diff --git a/test/SemaTemplate/enum-argument.cpp b/test/SemaTemplate/enum-argument.cpp
index de89487..7d23757 100644
--- a/test/SemaTemplate/enum-argument.cpp
+++ b/test/SemaTemplate/enum-argument.cpp
@@ -21,3 +21,16 @@ struct X0 {
};
X0<int> x0i;
+
+namespace rdar8020920 {
+ template<typename T>
+ struct X {
+ enum { e0 = 32 };
+
+ unsigned long long bitfield : e0;
+
+ void f(int j) {
+ bitfield + j;
+ }
+ };
+}
diff --git a/test/SemaTemplate/instantiate-anonymous-union.cpp b/test/SemaTemplate/instantiate-anonymous-union.cpp
index 7c75885..255454b 100644
--- a/test/SemaTemplate/instantiate-anonymous-union.cpp
+++ b/test/SemaTemplate/instantiate-anonymous-union.cpp
@@ -29,3 +29,21 @@ template <typename T> struct C {
};
C<int> c0(0);
+
+namespace PR7088 {
+ template<typename T>
+ void f() {
+ union {
+ int a;
+ union {
+ float real;
+ T d;
+ };
+ };
+
+ a = 17;
+ d = 3.14;
+ }
+
+ template void f<double>();
+}
diff --git a/test/SemaTemplate/instantiate-attr.cpp b/test/SemaTemplate/instantiate-attr.cpp
index 7fb1736..e8291ed 100644
--- a/test/SemaTemplate/instantiate-attr.cpp
+++ b/test/SemaTemplate/instantiate-attr.cpp
@@ -2,6 +2,12 @@
template <typename T>
struct A {
char a __attribute__((aligned(16)));
+
+ struct B {
+ typedef T __attribute__((aligned(16))) i16;
+ i16 x;
+ };
};
int a[sizeof(A<int>) == 16 ? 1 : -1];
+int a2[sizeof(A<int>::B) == 16 ? 1 : -1];
diff --git a/test/SemaTemplate/instantiate-complete.cpp b/test/SemaTemplate/instantiate-complete.cpp
index d854c9e..c13930d 100644
--- a/test/SemaTemplate/instantiate-complete.cpp
+++ b/test/SemaTemplate/instantiate-complete.cpp
@@ -99,3 +99,32 @@ namespace TemporaryObjectCopy {
template void f(int);
}
+
+namespace PR7080 {
+ template <class T, class U>
+ class X
+ {
+ typedef char true_t;
+ class false_t { char dummy[2]; };
+ static true_t dispatch(U);
+ static false_t dispatch(...);
+ static T trigger();
+ public:
+ enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) };
+ };
+
+ template <class T>
+ class rv : public T
+ { };
+
+ bool x = X<int, rv<int>&>::value;
+}
+
+namespace pr7199 {
+ template <class T> class A; // expected-note {{template is declared here}}
+ template <class T> class B {
+ class A<T>::C field; // expected-error {{implicit instantiation of undefined template 'pr7199::A<int>'}}
+ };
+
+ template class B<int>; // expected-note {{in instantiation}}
+}
diff --git a/test/SemaTemplate/instantiate-declref-ice.cpp b/test/SemaTemplate/instantiate-declref-ice.cpp
index e88b494..0f3c08b 100644
--- a/test/SemaTemplate/instantiate-declref-ice.cpp
+++ b/test/SemaTemplate/instantiate-declref-ice.cpp
@@ -31,5 +31,4 @@ struct X1 {
template<typename T>
const unsigned X1<T>::value = sizeof(T);
-int array3[X1<int>::value == sizeof(int)? 1 : -1]; // expected-error{{variable length arrays are not permitted in C++}} \
-// expected-error{{variable length array declaration not allowed at file scope}}
+int array3[X1<int>::value == sizeof(int)? 1 : -1]; // expected-error{{variable length array declaration not allowed at file scope}}
diff --git a/test/SemaTemplate/instantiate-expr-2.cpp b/test/SemaTemplate/instantiate-expr-2.cpp
index b91b398..eaa68dd 100644
--- a/test/SemaTemplate/instantiate-expr-2.cpp
+++ b/test/SemaTemplate/instantiate-expr-2.cpp
@@ -194,6 +194,37 @@ namespace N12 {
void f0(int **a) { C::f0(a); }
}
+namespace PR7202 {
+ template<typename U, typename T>
+ struct meta {
+ typedef T type;
+ };
+
+ struct X {
+ struct dummy;
+
+ template<typename T>
+ X(T, typename meta<T, dummy*>::type = 0);
+
+ template<typename T, typename A>
+ X(T, A);
+ };
+
+ template<typename T>
+ struct Z { };
+
+ template<typename T> Z<T> g(T);
+
+ struct Y {
+ template<typename T>
+ void f(T t) {
+ new X(g(*this));
+ }
+ };
+
+ template void Y::f(int);
+}
+
namespace N13 {
class A{
A(const A&);
diff --git a/test/SemaTemplate/instantiate-expr-3.cpp b/test/SemaTemplate/instantiate-expr-3.cpp
index 41a96a3..d506b19 100644
--- a/test/SemaTemplate/instantiate-expr-3.cpp
+++ b/test/SemaTemplate/instantiate-expr-3.cpp
@@ -63,7 +63,7 @@ template struct Conditional0<int, int, int>;
template<typename T>
struct StatementExpr0 {
void f(T t) {
- (void)({ if (t) t = t + 17; t + 12;}); // expected-error{{invalid}}
+ (void)({ if (t) t = t + 17; t + 12;}); // expected-error{{contextually convertible}}
}
};
diff --git a/test/SemaTemplate/instantiate-field.cpp b/test/SemaTemplate/instantiate-field.cpp
index 60d4b21..a260635 100644
--- a/test/SemaTemplate/instantiate-field.cpp
+++ b/test/SemaTemplate/instantiate-field.cpp
@@ -26,3 +26,58 @@ void test2(const X<float> *xf) {
void test3(const X<int(int)> *xf) {
(void)xf->x; // expected-note{{in instantiation of template class 'X<int (int)>' requested here}}
}
+
+namespace PR7123 {
+ template <class > struct requirement_;
+
+ template <void(*)()> struct instantiate
+ { };
+
+ template <class > struct requirement ;
+ struct failed ;
+
+ template <class Model> struct requirement<failed *Model::*>
+ {
+ static void failed()
+ {
+ ((Model*)0)->~Model(); // expected-note{{in instantiation of}}
+ }
+ };
+
+ template <class Model> struct requirement_<void(*)(Model)> : requirement<failed *Model::*>
+ { };
+
+ template <int> struct Requires_
+ { typedef void type; };
+
+ template <class Model> struct usage_requirements
+ {
+ ~usage_requirements()
+ {((Model*)0)->~Model(); } // expected-note{{in instantiation of}}
+ };
+
+ template < typename TT > struct BidirectionalIterator
+ {
+ enum
+ { value = 0 };
+
+ instantiate< requirement_<void(*)(usage_requirements<BidirectionalIterator>)>::failed> int534; // expected-note{{in instantiation of}}
+
+ ~BidirectionalIterator()
+ { i--; } // expected-error{{cannot decrement value of type 'PR7123::X'}}
+
+ TT i;
+ };
+
+ struct X
+ { };
+
+ template<typename RanIter>
+ typename Requires_< BidirectionalIterator<RanIter>::value >::type sort(RanIter,RanIter){}
+
+ void f()
+ {
+ X x;
+ sort(x,x);
+ }
+}
diff --git a/test/SemaTemplate/instantiate-function-2.cpp b/test/SemaTemplate/instantiate-function-2.cpp
index 6318fac..afca358 100644
--- a/test/SemaTemplate/instantiate-function-2.cpp
+++ b/test/SemaTemplate/instantiate-function-2.cpp
@@ -10,3 +10,13 @@ void f() {
S<int> s1;
S<int> s2(10);
}
+
+namespace PR7184 {
+ template<typename T>
+ void f() {
+ typedef T type;
+ void g(int array[sizeof(type)]);
+ }
+
+ template void f<int>();
+}
diff --git a/test/SemaTemplate/instantiate-member-pointers.cpp b/test/SemaTemplate/instantiate-member-pointers.cpp
index 2308ac5..dca0f62 100644
--- a/test/SemaTemplate/instantiate-member-pointers.cpp
+++ b/test/SemaTemplate/instantiate-member-pointers.cpp
@@ -53,3 +53,15 @@ void accept_X4(X4<Member>);
void test_accept_X4(X4<&Y::x> x4) {
accept_X4(x4);
}
+
+namespace ValueDepMemberPointer {
+ template <void (*)()> struct instantiate_function {};
+ template <typename T> struct S {
+ static void instantiate();
+ typedef instantiate_function<&S::instantiate> x; // expected-note{{instantiation}}
+ };
+ template <typename T> void S<T>::instantiate() {
+ int a[(int)sizeof(T)-42]; // expected-error{{array size is negative}}
+ }
+ S<int> s;
+}
diff --git a/test/SemaTemplate/instantiate-non-dependent-types.cpp b/test/SemaTemplate/instantiate-non-dependent-types.cpp
new file mode 100644
index 0000000..a0005c5
--- /dev/null
+++ b/test/SemaTemplate/instantiate-non-dependent-types.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+template<typename T>
+struct X1 {
+ static void member() { T* x = 1; } // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
+};
+
+template<void(*)()> struct instantiate { };
+
+template<typename T>
+struct X2 {
+ typedef instantiate<&X1<int>::member> i; // expected-note{{in instantiation of}}
+};
+
+X2<int> x;
diff --git a/test/SemaTemplate/instantiate-overload-candidates.cpp b/test/SemaTemplate/instantiate-overload-candidates.cpp
new file mode 100644
index 0000000..5b7e60d
--- /dev/null
+++ b/test/SemaTemplate/instantiate-overload-candidates.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// This is the function actually selected during overload resolution, and the
+// only one defined.
+template <typename T> void f(T*, int) {}
+
+template <typename T> struct S;
+template <typename T> struct S_ : S<T> { typedef int type; }; // expected-note{{in instantiation}}
+template <typename T> struct S {
+ // Force T to have a complete type here so we can observe instantiations with
+ // incomplete types.
+ T t; // expected-error{{field has incomplete type}}
+};
+
+// Provide a bad class and an overload that instantiates templates with it.
+class NoDefinition; // expected-note{{forward declaration}}
+template <typename T> S_<NoDefinition>::type f(T*, NoDefinition*); // expected-note{{in instantiation}}
+
+void test(int x) {
+ f(&x, 0);
+}
diff --git a/test/SemaTemplate/nested-name-spec-template.cpp b/test/SemaTemplate/nested-name-spec-template.cpp
index 9d25a05..54e615b 100644
--- a/test/SemaTemplate/nested-name-spec-template.cpp
+++ b/test/SemaTemplate/nested-name-spec-template.cpp
@@ -64,3 +64,10 @@ namespace test1 {
template <class T>
T pair<T>::* const pair<T>::mem_array[2] = { &pair<T>::x, &pair<T>::y };
}
+
+typedef int T;
+namespace N1 {
+ template<typename T> T f0();
+}
+
+template<typename T> T N1::f0() { }
diff --git a/test/SemaTemplate/overload-candidates.cpp b/test/SemaTemplate/overload-candidates.cpp
new file mode 100644
index 0000000..8762cc8
--- /dev/null
+++ b/test/SemaTemplate/overload-candidates.cpp
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename T>
+const T& min(const T&, const T&); // expected-note{{candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'long')}}
+
+void test_min() {
+ (void)min(1, 2l); // expected-error{{no matching function for call to 'min'}}
+}
+
+template<typename R, typename T>
+R *dyn_cast(const T&); // expected-note{{candidate template ignored: couldn't infer template argument 'R'}}
+
+void test_dyn_cast(int* ptr) {
+ (void)dyn_cast(ptr); // expected-error{{no matching function for call to 'dyn_cast'}}
+}
+
+template<int I, typename T>
+ void get(const T&); // expected-note{{candidate template ignored: invalid explicitly-specified argument for template parameter 'I'}}
+template<template<class T> class, typename T>
+ void get(const T&); // expected-note{{candidate template ignored: invalid explicitly-specified argument for 1st template parameter}}
+
+void test_get(void *ptr) {
+ get<int>(ptr); // expected-error{{no matching function for call to 'get'}}
+}
+
+template<typename T>
+ typename T::type get_type(const T&); // expected-note{{candidate template ignored: substitution failure [with T = int *]}}
+
+void test_get_type(int *ptr) {
+ (void)get_type(ptr); // expected-error{{no matching function for call to 'get_type'}}
+}
+
+struct X {
+ template<typename T>
+ const T& min(const T&, const T&); // expected-note{{candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'long')}}
+};
+
+void test_X_min(X x) {
+ (void)x.min(1, 2l); // expected-error{{no matching member function for call to 'min'}}
+}
diff --git a/test/SemaTemplate/partial-spec-instantiate.cpp b/test/SemaTemplate/partial-spec-instantiate.cpp
index 3156892..68b4964 100644
--- a/test/SemaTemplate/partial-spec-instantiate.cpp
+++ b/test/SemaTemplate/partial-spec-instantiate.cpp
@@ -18,3 +18,23 @@ struct X2<U*> {
};
void a(char *a, char *b) {X2<char*>::f();}
+
+namespace WonkyAccess {
+ template<typename T>
+ struct X {
+ int m;
+ };
+
+ template<typename U>
+ class Y;
+
+ template<typename U>
+ struct Y<U*> : X<U> { };
+
+ template<>
+ struct Y<float*> : X<float> { };
+
+ int f(Y<int*> y, Y<float*> y2) {
+ return y.m + y2.m;
+ }
+}
diff --git a/test/SemaTemplate/temp_explicit.cpp b/test/SemaTemplate/temp_explicit.cpp
index fbb41ff..76244c2 100644
--- a/test/SemaTemplate/temp_explicit.cpp
+++ b/test/SemaTemplate/temp_explicit.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++0x-compat %s
//
// Tests explicit instantiation of templates.
template<typename T, typename U = T> class X0 { };
@@ -125,3 +125,27 @@ template <> // expected-warning{{extraneous template parameter list}}
template <>
struct Foo<int>::Bar<void>
{};
+
+namespace N1 {
+
+ template<typename T> struct X7 { }; // expected-note{{here}}
+
+ namespace Inner {
+ template<typename T> struct X8 { };
+ }
+
+ template struct X7<int>;
+ template struct Inner::X8<int>;
+}
+
+template<typename T> struct X9 { }; // expected-note{{here}}
+
+template struct ::N1::Inner::X8<float>;
+
+namespace N2 {
+ using namespace N1;
+
+ template struct X7<double>; // expected-warning{{must occur in namespace}}
+
+ template struct X9<float>; // expected-warning{{must occur in the global}}
+}
diff --git a/test/SemaTemplate/template-id-expr.cpp b/test/SemaTemplate/template-id-expr.cpp
index b3f41be..de8d7f6 100644
--- a/test/SemaTemplate/template-id-expr.cpp
+++ b/test/SemaTemplate/template-id-expr.cpp
@@ -44,3 +44,41 @@ struct X {
};
template struct X<3>;
+
+// 'template' as a disambiguator.
+// PR7030
+struct Y0 {
+ template<typename U>
+ void f1(U);
+
+ template<typename U>
+ static void f2(U);
+
+ void f3(int);
+
+ static int f4(int);
+ template<typename U>
+ static void f4(U);
+
+ template<typename U>
+ void f() {
+ Y0::template f1<U>(0);
+ Y0::template f1(0);
+ this->template f1(0);
+
+ Y0::template f2<U>(0);
+ Y0::template f2(0);
+
+ Y0::template f3(0); // expected-error {{'f3' following the 'template' keyword does not refer to a template}}
+ Y0::template f3(); // expected-error {{'f3' following the 'template' keyword does not refer to a template}}
+
+ int x;
+ x = Y0::f4(0);
+ x = Y0::f4<int>(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
+ x = Y0::template f4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
+
+ x = this->f4(0);
+ x = this->f4<int>(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
+ x = this->template f4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
+ }
+};
diff --git a/test/SemaTemplate/unused-variables.cpp b/test/SemaTemplate/unused-variables.cpp
new file mode 100644
index 0000000..1b9350b
--- /dev/null
+++ b/test/SemaTemplate/unused-variables.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused -verify %s
+
+struct X0 {
+ ~X0();
+};
+
+struct X1 { };
+
+template<typename T>
+void f() {
+ X0 x0;
+ X1 x1; // expected-warning{{unused variable 'x1'}}
+}
+
+template<typename T, typename U>
+void g() {
+ T t;
+ U u; // expected-warning{{unused variable 'u'}}
+}
+
+template void g<X0, X1>(); // expected-note{{in instantiation of}}
diff --git a/test/SemaTemplate/virtual-member-functions.cpp b/test/SemaTemplate/virtual-member-functions.cpp
index 59df3c2..974f664 100644
--- a/test/SemaTemplate/virtual-member-functions.cpp
+++ b/test/SemaTemplate/virtual-member-functions.cpp
@@ -3,7 +3,7 @@
namespace PR5557 {
template <class T> struct A {
A();
- virtual void anchor(); // expected-note{{instantiation}}
+ virtual void anchor();
virtual int a(T x);
};
template<class T> A<T>::A() {}
@@ -14,7 +14,7 @@ template<class T> int A<T>::a(T x) {
}
void f(A<int> x) {
- x.anchor();
+ x.anchor(); // expected-note{{instantiation}}
}
template<typename T>
@@ -43,7 +43,7 @@ template struct Derived<int>; // expected-note {{in instantiation of member func
template<typename T>
struct HasOutOfLineKey {
- HasOutOfLineKey() { } // expected-note{{in instantiation of member function 'HasOutOfLineKey<int>::f' requested here}}
+ HasOutOfLineKey() { }
virtual T *f(float *fp);
};
@@ -52,4 +52,35 @@ T *HasOutOfLineKey<T>::f(float *fp) {
return fp; // expected-error{{cannot initialize return object of type 'int *' with an lvalue of type 'float *'}}
}
-HasOutOfLineKey<int> out_of_line;
+HasOutOfLineKey<int> out_of_line; // expected-note{{in instantiation of member function 'HasOutOfLineKey<int>::f' requested here}}
+
+namespace std {
+ class type_info;
+}
+
+namespace PR7114 {
+ class A { virtual ~A(); }; // expected-note{{declared private here}}
+
+ template<typename T>
+ class B {
+ public:
+ class Inner : public A { }; // expected-error{{base class 'PR7114::A' has private destructor}}
+ static Inner i;
+ static const unsigned value = sizeof(i) == 4;
+ };
+
+ int f() { return B<int>::value; }
+
+ void test_typeid(B<float>::Inner bfi) {
+ (void)typeid(bfi); // expected-note{{implicit default destructor}}
+ }
+
+ template<typename T>
+ struct X : A {
+ void f() { }
+ };
+
+ void test_X(X<int> xi, X<float> xf) {
+ xi.f();
+ }
+}
OpenPOWER on IntegriCloud