summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-05-10 02:50:16 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-05-10 02:50:16 +0000
commitc67f223c9ee4cbfa478a1d6e9cfe5b03c524b4fa (patch)
treef663bdb4be2998a02f90d5d6a9c8a5891334f75e /clang/test/Sema
parent62cce9e47d2cb1f3068cd7346bdedb0ce4c7c24d (diff)
downloadbcm5719-llvm-c67f223c9ee4cbfa478a1d6e9cfe5b03c524b4fa.tar.gz
bcm5719-llvm-c67f223c9ee4cbfa478a1d6e9cfe5b03c524b4fa.zip
Fix an old (2009) FIXME:
// FIXME: This needs to happen before we merge declarations. Then, // let attribute merging cope with attribute conflicts. This was already being done for variables, but for functions we were merging then first and then applying the attributes. To avoid duplicating merging logic, some of the helpers in SemaDeclAttr.cpp become methods that can handle merging two attributes in one decl or inheriting attributes from one decl to another. With this change we are now able to produce errors for variables with incompatible visibility attributes or warn about unused dllimports in variables. This changes the attribute list iteration back to being in reverse source code order, as that matches what decl merging does and avoids differentiating the two cases is the merge*Attr methods. llvm-svn: 156531
Diffstat (limited to 'clang/test/Sema')
-rw-r--r--clang/test/Sema/attr-visibility.c3
-rw-r--r--clang/test/Sema/dllimport-dllexport.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Sema/attr-visibility.c b/clang/test/Sema/attr-visibility.c
index cb549921abe..cc3c54a047b 100644
--- a/clang/test/Sema/attr-visibility.c
+++ b/clang/test/Sema/attr-visibility.c
@@ -17,3 +17,6 @@ struct __attribute__((visibility("default"))) test5; // expected-error {{visibil
void test6() __attribute__((visibility("hidden"), // expected-note {{previous attribute is here}}
visibility("default"))); // expected-error {{visibility does not match previous declaration}}
+
+extern int test7 __attribute__((visibility("default"))); // expected-note {{previous attribute is here}}
+extern int test7 __attribute__((visibility("hidden"))); // expected-error {{visibility does not match previous declaration}}
diff --git a/clang/test/Sema/dllimport-dllexport.c b/clang/test/Sema/dllimport-dllexport.c
index 4c049026978..00c9df594b6 100644
--- a/clang/test/Sema/dllimport-dllexport.c
+++ b/clang/test/Sema/dllimport-dllexport.c
@@ -38,3 +38,6 @@ void foo12(){} // expected-warning {{'foo12' redeclared without dllimport attrib
void __attribute__((dllimport)) foo13(); // expected-warning{{dllimport attribute ignored}}
void __attribute__((dllexport)) foo13();
+
+extern int foo14 __attribute__((dllexport));
+extern int foo14 __attribute__((dllimport)); // expected-warning{{dllimport attribute ignored}}
OpenPOWER on IntegriCloud