aboutsummaryrefslogtreecommitdiff
path: root/test/Modules
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-02-18 15:53:43 +0000
committerDouglas Gregor <dgregor@apple.com>2013-02-18 15:53:43 +0000
commitaa945900d5438984bdcaac85c4f54868292231f4 (patch)
tree3dbdeb36b0741abc4b881816eeec040eafcaa9da /test/Modules
parent82282dc907a04b1931f8f578693b035ad751fd3b (diff)
Ensure that the identifier chains have the most recent declaration after module deserialization.
This commit introduces a set of related changes to ensure that the declaration that shows up in the identifier chain after deserializing declarations with a given identifier is, in fact, the most recent declaration. The primary change involves waiting until after we deserialize and wire up redeclaration chains before updating the identifier chains. There is a minor optimization in here to avoid recursively deserializing names as part of looking to see whether top-level declarations for a given name exist. A related change that became suddenly more urgent is to property record a merged declaration when an entity first declared in the current translation unit is later deserialized from a module (that had not been loaded at the time of the original declaration). Since we key off the canonical declaration (which is parsed, not from an AST file) for emitted redeclarations, we simply record this as a merged declaration during AST writing and let the readers merge them. Re-fixes <rdar://problem/13189985>, presumably for good this time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175447 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules')
-rw-r--r--test/Modules/Inputs/redecl-merge-left.h1
-rw-r--r--test/Modules/Inputs/redecl-merge-right.h3
-rw-r--r--test/Modules/Inputs/redecl-merge-top.h2
-rw-r--r--test/Modules/redecl-merge.m25
4 files changed, 30 insertions, 1 deletions
diff --git a/test/Modules/Inputs/redecl-merge-left.h b/test/Modules/Inputs/redecl-merge-left.h
index cf07165a26..d66b4aa780 100644
--- a/test/Modules/Inputs/redecl-merge-left.h
+++ b/test/Modules/Inputs/redecl-merge-left.h
@@ -90,3 +90,4 @@ typedef void funcptr_with_id(int id);
@class DeclaredThenLoaded;
+void eventually_noreturn2(void);
diff --git a/test/Modules/Inputs/redecl-merge-right.h b/test/Modules/Inputs/redecl-merge-right.h
index b664ae9a72..46a16d3b13 100644
--- a/test/Modules/Inputs/redecl-merge-right.h
+++ b/test/Modules/Inputs/redecl-merge-right.h
@@ -85,3 +85,6 @@ const int one = ONE;
@interface ClassWithDef
- (void)method;
@end
+
+void eventually_noreturn(void) __attribute__((noreturn));
+void eventually_noreturn2(void) __attribute__((noreturn));
diff --git a/test/Modules/Inputs/redecl-merge-top.h b/test/Modules/Inputs/redecl-merge-top.h
index 690e6df1c9..27e71a7383 100644
--- a/test/Modules/Inputs/redecl-merge-top.h
+++ b/test/Modules/Inputs/redecl-merge-top.h
@@ -16,3 +16,5 @@ struct S2;
struct S2;
int func1(int);
+
+void eventually_noreturn(void);
diff --git a/test/Modules/redecl-merge.m b/test/Modules/redecl-merge.m
index 8937002299..e37366748d 100644
--- a/test/Modules/redecl-merge.m
+++ b/test/Modules/redecl-merge.m
@@ -1,5 +1,6 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class
+// RUN: %clang_cc1 -fmodules -Wreturn-type -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class
+
@class C2;
@class C3;
@class C3;
@@ -8,8 +9,28 @@ typedef struct my_struct_type *my_struct_ref;
@protocol P4;
@class C3;
@class C3;
+
+int *call_eventually_noreturn(void) {
+ eventually_noreturn();
+} // expected-warning{{control reaches end of non-void function}}
+
+int *call_eventually_noreturn2(void) {
+ eventually_noreturn2();
+} // expected-warning{{control reaches end of non-void function}}
+
@import redecl_merge_right;
+int *call_eventually_noreturn_again(void) {
+ eventually_noreturn();
+}
+
+int *call_eventually_noreturn2_again(void) {
+ // noreturn and non-noreturn functions have different types
+ eventually_noreturn2(); // expected-error{{call to 'eventually_noreturn2' is ambiguous}}
+ // expected-note@93{{candidate function}}
+ // expected-note@90{{candidate function}}
+}
+
@implementation A
- (Super*)init { return self; }
@end
@@ -148,3 +169,5 @@ id<P3> p3;
// Make sure we don't get conflicts with 'id'.
funcptr_with_id fid;
id id_global;
+
+