diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-10-21 22:27:12 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-10-21 22:27:12 +0000 |
commit | 13c7fcceb9fd96f5be03af038ce16b05bb5e9598 (patch) | |
tree | 9637da52c0f5ee1e41a9cad79ddf9256094f929f /lib/Sema/SemaDeclAttr.cpp | |
parent | 9c0778bbdaab668e173f20f10b57c59aa586d69d (diff) |
c++: support gcc's application of weak attribute on
class declaration which forces any such class and any
class that inherits from such a class to have their
typeinfo symbols be marked as weak.
// rdar://10246395
A test/CodeGenCXX/weak-extern-typeinfo.cpp
M lib/Sema/SemaDeclCXX.cpp
M lib/Sema/SemaDeclAttr.cpp
M lib/CodeGen/CGRTTI.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142693 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index b83b716fdf..d801664ad6 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -1914,6 +1914,10 @@ static void handleWeakAttr(Sema &S, Decl *D, const AttributeList &Attr) { } if (!isa<VarDecl>(D) && !isa<FunctionDecl>(D)) { + if (isa<CXXRecordDecl>(D)) { + D->addAttr(::new (S.Context) WeakAttr(Attr.getRange(), S.Context)); + return; + } S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << Attr.getName() << ExpectedVariableOrFunction; return; |