From: Chris Lattner Date: Tue, 6 Jan 2009 07:24:29 +0000 (+0000) Subject: it is ok to insert empty source ranges into diagnostics, declare variable in an if. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ead013e4a89d8a51acacebe541b922b309867642;p=clang it is ok to insert empty source ranges into diagnostics, declare variable in an if. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61800 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index e67b8c0389..19582c0d79 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1448,14 +1448,11 @@ Sema::DeclTy *Sema::ActOnUsingDirective(Scope *S, // FIXME: This still requires lot more checks, and AST support. // Lookup namespace name. DeclContext *DC = static_cast(SS.getScopeRep()); - Decl *NS = 0; - if ((NS = LookupNamespaceName(NamespcName, S, DC))) { + if (Decl *NS = LookupNamespaceName(NamespcName, S, DC)) { assert(isa(NS) && "expected namespace decl"); } else { - DiagnosticBuilder Builder = Diag(IdentLoc, diag::err_expected_namespace_name); - if (SS.isSet()) - Builder << SS.getRange(); + Diag(IdentLoc, diag::err_expected_namespace_name) << SS.getRange(); } // FIXME: We ignore AttrList for now, and delete it to avoid leak.