forked from OSchip/llvm-project
Warn about visibility attributes in typedefs.
llvm-svn: 156534
This commit is contained in:
parent
5cc6ef9e89
commit
a6b3cd493c
|
@ -1857,6 +1857,10 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,
|
|||
bool Sema::mergeVisibilityAttr(Decl *D, SourceRange Range,
|
||||
bool Inherited,
|
||||
VisibilityAttr::VisibilityType Vis) {
|
||||
if (isa<TypedefNameDecl>(D)) {
|
||||
Diag(Range.getBegin(), diag::warn_attribute_ignored) << "visibility";
|
||||
return false;
|
||||
}
|
||||
VisibilityAttr *ExistingAttr = D->getAttr<VisibilityAttr>();
|
||||
if (ExistingAttr) {
|
||||
VisibilityAttr::VisibilityType ExistingVis = ExistingAttr->getVisibility();
|
||||
|
|
|
@ -20,3 +20,5 @@ void test6() __attribute__((visibility("hidden"), // expected-note {{previous at
|
|||
|
||||
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}}
|
||||
|
||||
typedef int __attribute__((visibility("default"))) bar; // expected-warning {{visibility attribute ignored}}
|
||||
|
|
Loading…
Reference in New Issue