diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-03-09 05:15:28 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-03-09 05:15:28 +0000 |
| commit | 0098a4bd0434d9e65439748e08bc9b60d0220ca9 (patch) | |
| tree | 17a4d4c2b3b072f2e627284fa70ed9a73247df24 | |
| parent | 821b66669cc7ccd53221b1e4e7ad4dde861927d7 (diff) | |
| download | bcm5719-llvm-0098a4bd0434d9e65439748e08bc9b60d0220ca9.tar.gz bcm5719-llvm-0098a4bd0434d9e65439748e08bc9b60d0220ca9.zip | |
[Sema] Fix assertion hit with #pragma weak.
rdar://16264844
llvm-svn: 203372
| -rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/pragma-weak.cpp | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 1d5d9d12c1a..7817ca9efc5 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -4655,6 +4655,8 @@ void Sema::DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W) { // 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 diff --git a/clang/test/SemaCXX/pragma-weak.cpp b/clang/test/SemaCXX/pragma-weak.cpp index 057cf6b463f..c1ff2062fcf 100644 --- a/clang/test/SemaCXX/pragma-weak.cpp +++ b/clang/test/SemaCXX/pragma-weak.cpp @@ -6,3 +6,6 @@ extern "C" { void foo() { }; } + +extern "C" int Test; +#pragma weak test = Test |

