]> granicus.if.org Git - clang/commitdiff
Don't do an expensive definition check where a cheap 'is this C?' check suffices.
authorSebastian Redl <sebastian.redl@getdesigned.at>
Wed, 3 Feb 2010 02:08:48 +0000 (02:08 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Wed, 3 Feb 2010 02:08:48 +0000 (02:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95188 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index d203376f91bae8efaba8fd6b50156eb844a4e408..80831f42c8c7bb000884d81ab2b0552b006aeabd 100644 (file)
@@ -1300,7 +1300,8 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
 
   // C++ doesn't have tentative definitions, so go right ahead and check here.
   const VarDecl *Def;
-  if (New->isThisDeclarationADefinition() == VarDecl::Definition &&
+  if (getLangOptions().CPlusPlus &&
+      New->isThisDeclarationADefinition() == VarDecl::Definition &&
       (Def = Old->getDefinition())) {
     Diag(New->getLocation(), diag::err_redefinition)
       << New->getDeclName();