From 6c048a916f6bf526c12217f4a2bc3aa1a62bd62e Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Wed, 3 Feb 2010 02:08:48 +0000 Subject: [PATCH] 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 --- lib/Sema/SemaDecl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(); -- 2.50.1