summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-04-04 02:47:57 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-04-04 02:47:57 +0000
commit869fe0448b8798c828061ebe515defb629a9c1f0 (patch)
tree32138339e9ea0690e33a0ede6c1b0bbd1cedd170 /clang/lib/Sema/SemaDecl.cpp
parentfce1dad04210b9ea0a2271c02592bac12444cb27 (diff)
downloadbcm5719-llvm-869fe0448b8798c828061ebe515defb629a9c1f0.tar.gz
bcm5719-llvm-869fe0448b8798c828061ebe515defb629a9c1f0.zip
Fix linkage related crash.
This test was exactly the opposite of what it should be. We should check if there old decl has linkage (where it makes sense) and if the new decl has the extern keyword. llvm-svn: 178735
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 42d7d2bdf5f..a25204d8089 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2929,8 +2929,8 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous,
Diag(Old->getLocation(), diag::note_previous_definition);
return New->setInvalidDecl();
}
- if (Old->hasExternalStorage() &&
- New->isLocalVarDecl() && !New->hasLinkage()) {
+ if (Old->hasLinkage() && New->isLocalVarDecl() &&
+ !New->hasExternalStorage()) {
Diag(New->getLocation(), diag::err_non_extern_extern) << New->getDeclName();
Diag(Old->getLocation(), diag::note_previous_definition);
return New->setInvalidDecl();
OpenPOWER on IntegriCloud