]> granicus.if.org Git - clang/commitdiff
it is ok to insert empty source ranges into diagnostics, declare variable in an if.
authorChris Lattner <sabre@nondot.org>
Tue, 6 Jan 2009 07:24:29 +0000 (07:24 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 6 Jan 2009 07:24:29 +0000 (07:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61800 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp

index e67b8c0389706a4cece54a804ac0a9e0b4b2b25f..19582c0d798807431f409325547933d57db4fb01 100644 (file)
@@ -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<DeclContext*>(SS.getScopeRep());
-  Decl *NS = 0;
 
-  if ((NS = LookupNamespaceName(NamespcName, S, DC))) {
+  if (Decl *NS = LookupNamespaceName(NamespcName, S, DC)) {
     assert(isa<NamespaceDecl>(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.