aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-06 07:24:29 +0000
committerChris Lattner <sabre@nondot.org>2009-01-06 07:24:29 +0000
commitead013e4a89d8a51acacebe541b922b309867642 (patch)
tree755641c1029208fc891da8f1181720a1181fdce4
parent7bea766fc90752eb5415c40dd70fc7176383bdbc (diff)
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
-rw-r--r--lib/Sema/SemaDeclCXX.cpp7
1 files changed, 2 insertions, 5 deletions
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<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.