aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-06-20 17:50:03 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-06-20 17:50:03 +0000
commitab27d6ea7b4ce2762a16905281de796db32bb6f2 (patch)
tree2d9752b470843ef1b270db7d85fbb9a37ae69414 /lib/Sema/SemaDecl.cpp
parent6fe6bac2ad79dee2fb2077c8959b1bf8679fe1b7 (diff)
llvm-gcc treats a tentative definition with a previous
(or follow up) extern declaration with weak_import as an actual definition. make clang follows this behavior. // rdar://9538608 llvm-gcc treats an extern declaration with weak_import git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 897b01d093..fe3b3b4f7c 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2039,6 +2039,12 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
}
mergeDeclAttributes(New, Old, Context);
+ // weak_import on current declaration is applied to previous
+ // tentative definiton.
+ if (New->getAttr<WeakImportAttr>() &&
+ Old->getStorageClass() == SC_None &&
+ !Old->getAttr<WeakImportAttr>())
+ Old->addAttr(::new (Context) WeakImportAttr(SourceLocation(), Context));
// Merge the types.
MergeVarDeclTypes(New, Old);