Introduce Lookup::Named overload taking a StringRef

This commit is contained in:
Philippe Canal 2014-09-15 05:14:40 -05:00 committed by sftnight
parent c4ad2ff154
commit 2aacd83287
2 changed files with 20 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
namespace clang {
class ASTContext;
@ -195,6 +196,19 @@ namespace utils {
const char* Name,
const clang::DeclContext* Within = 0);
///\brief Quick lookup for a single named declaration in a given
/// declaration context.
///
///\param[in] S - Semantic Analysis object doing the lookup.
///\param[in] Name - The name we are looking up.
///\param[in] Within - The context within the lookup is done. If 0 the
/// TranslationUnitDecl is used.
///\returns the found result if single, -1 if multiple or 0 if not found.
///
clang::NamedDecl* Named(clang::Sema* S,
llvm::StringRef Name,
const clang::DeclContext* Within = 0);
///\brief Quick lookup for a single named declaration in a given
/// declaration context.
///

View File

@ -1237,6 +1237,12 @@ namespace utils {
return dyn_cast<NamespaceDecl>(R.getFoundDecl());
}
NamedDecl* Lookup::Named(Sema* S, llvm::StringRef Name,
const DeclContext* Within) {
DeclarationName DName = &S->Context.Idents.get(Name);
return Lookup::Named(S, DName, Within);
}
NamedDecl* Lookup::Named(Sema* S, const char* Name,
const DeclContext* Within) {
DeclarationName DName = &S->Context.Idents.get(Name);