From: Sebastian Redl Date: Wed, 3 Feb 2010 02:08:48 +0000 (+0000) Subject: Don't do an expensive definition check where a cheap 'is this C?' check suffices. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6c048a916f6bf526c12217f4a2bc3aa1a62bd62e;p=clang Don't do an expensive definition check where a cheap 'is this C?' check suffices. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95188 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index d203376f91..80831f42c8 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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();