r203372 - [Sema] Fix assertion hit with #pragma weak.
Argyrios Kyrtzidis
akyrtzi at gmail.com
Sat Mar 8 21:15:28 PST 2014
Author: akirtzidis
Date: Sat Mar 8 23:15:28 2014
New Revision: 203372
URL: http://llvm.org/viewvc/llvm-project?rev=203372&view=rev
Log:
[Sema] Fix assertion hit with #pragma weak.
rdar://16264844
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaCXX/pragma-weak.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=203372&r1=203371&r2=203372&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sat Mar 8 23:15:28 2014
@@ -4655,6 +4655,8 @@ void Sema::DeclApplyPragmaWeak(Scope *S,
// to insert Decl at TU scope, sorry.
DeclContext *SavedContext = CurContext;
CurContext = Context.getTranslationUnitDecl();
+ NewD->setDeclContext(CurContext);
+ NewD->setLexicalDeclContext(CurContext);
PushOnScopeChains(NewD, S);
CurContext = SavedContext;
} else { // just add weak to existing
Modified: cfe/trunk/test/SemaCXX/pragma-weak.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/pragma-weak.cpp?rev=203372&r1=203371&r2=203372&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/pragma-weak.cpp (original)
+++ cfe/trunk/test/SemaCXX/pragma-weak.cpp Sat Mar 8 23:15:28 2014
@@ -6,3 +6,6 @@ extern "C" {
void foo() {
};
}
+
+extern "C" int Test;
+#pragma weak test = Test
More information about the cfe-commits
mailing list