aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaAttr.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-12-02 08:25:40 +0000
committerJohn McCall <rjmccall@apple.com>2009-12-02 08:25:40 +0000
commit1bcee0a5a29981f8c78a8620d1c78841dbc5c348 (patch)
treef405434b0c3717a4c586c06e49b5c86c89758270 /lib/Sema/SemaAttr.cpp
parent666571afadd9dc472da9696377a05b50c9b3f2ab (diff)
Rip out the last remaining implicit use of OverloadedFunctionDecl in Sema:
LookupResult::getAsSingleDecl() is no more. Shift Sema::LookupSingleName to return null on overloaded results. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaAttr.cpp')
-rw-r--r--lib/Sema/SemaAttr.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Sema/SemaAttr.cpp b/lib/Sema/SemaAttr.cpp
index 5769716b33..095f537f71 100644
--- a/lib/Sema/SemaAttr.cpp
+++ b/lib/Sema/SemaAttr.cpp
@@ -183,20 +183,19 @@ void Sema::ActOnPragmaUnused(const Token *Identifiers, unsigned NumIdentifiers,
LookupResult Lookup(*this, Name, Tok.getLocation(), LookupOrdinaryName);
LookupParsedName(Lookup, curScope, NULL, true);
- NamedDecl *ND = Lookup.getAsSingleDecl(Context);
-
- if (!ND) {
+ if (Lookup.empty()) {
Diag(PragmaLoc, diag::warn_pragma_unused_undeclared_var)
<< Name << SourceRange(Tok.getLocation());
continue;
}
- if (!isa<VarDecl>(ND) || !cast<VarDecl>(ND)->hasLocalStorage()) {
+ VarDecl *VD = Lookup.getAsSingle<VarDecl>();
+ if (!VD || !VD->hasLocalStorage()) {
Diag(PragmaLoc, diag::warn_pragma_unused_expected_localvar)
<< Name << SourceRange(Tok.getLocation());
continue;
}
- ND->addAttr(::new (Context) UnusedAttr());
+ VD->addAttr(::new (Context) UnusedAttr());
}
}