зеркало из https://github.com/microsoft/clang-1.git
Ignore visibility attributes after definitions. This matches newer (4.7) gcc's
behavior and is the first step in fixing pr13338. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160104 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
6a1f94b89b
Коммит
f729ce0b23
|
@ -1637,6 +1637,9 @@ def err_attribute_aligned_greater_than_8192 : Error<
|
|||
def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
|
||||
"'%0' redeclared without %1 attribute: previous %1 ignored">;
|
||||
def warn_attribute_ignored : Warning<"%0 attribute ignored">;
|
||||
def warn_attribute_after_definition_ignored : Warning<
|
||||
"attribute %0 after definition is ignored">,
|
||||
InGroup<IgnoredAttributes>;
|
||||
def warn_unknown_attribute_ignored : Warning<
|
||||
"unknown attribute %0 ignored">, InGroup<UnknownAttributes>;
|
||||
def warn_unhandled_ms_attribute_ignored : Warning<
|
||||
|
|
|
@ -4700,6 +4700,14 @@ void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
|
|||
|
||||
AdjustDeclIfTemplate(TagDecl);
|
||||
|
||||
for (const AttributeList* l = AttrList; l; l = l->getNext()) {
|
||||
if (l->getKind() != AttributeList::AT_Visibility)
|
||||
continue;
|
||||
l->setInvalid();
|
||||
Diag(l->getLoc(), diag::warn_attribute_after_definition_ignored) <<
|
||||
l->getName();
|
||||
}
|
||||
|
||||
ActOnFields(S, RLoc, TagDecl, llvm::makeArrayRef(
|
||||
// strict aliasing violation!
|
||||
reinterpret_cast<Decl**>(FieldCollector->getCurFields()),
|
||||
|
|
|
@ -16,14 +16,6 @@ int x2::y = 10;
|
|||
// CHECK: @_ZN2x21yE = global
|
||||
#pragma GCC visibility pop
|
||||
|
||||
#pragma GCC visibility push(hidden)
|
||||
struct x3 {
|
||||
static int y;
|
||||
} __attribute((visibility("default")));
|
||||
int x3::y = 10;
|
||||
// CHECK: @_ZN2x31yE = global
|
||||
#pragma GCC visibility pop
|
||||
|
||||
#pragma GCC visibility push(hidden)
|
||||
template<class T> struct x4 {
|
||||
static int y;
|
||||
|
|
|
@ -14,3 +14,7 @@ template <>
|
|||
__attribute__((visibility("default"))) // expected-error {{visibility does not match previous declaration}}
|
||||
void foo<int>() {
|
||||
}
|
||||
|
||||
struct x3 {
|
||||
static int y;
|
||||
} __attribute((visibility("default"))); // expected-warning {{attribute 'visibility' after definition is ignored}}
|
||||
|
|
Загрузка…
Ссылка в новой задаче