* Add another overload taking DeclarationName as an argument. This is useful when
we have to deal with failed lookups. * Improve documentation. git-svn-id: http://root.cern.ch/svn/root/trunk@46394 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
parent
9ac54aa5d9
commit
a67f0ebca8
@ -13,6 +13,7 @@ namespace clang {
|
||||
class ASTContext;
|
||||
class Expr;
|
||||
class DeclContext;
|
||||
class DeclarationName;
|
||||
class NamedDecl;
|
||||
class NamespaceDecl;
|
||||
class QualType;
|
||||
@ -64,13 +65,47 @@ namespace utils {
|
||||
///
|
||||
class Lookup {
|
||||
public:
|
||||
|
||||
///\brief Quick lookup for a single namespace 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) or 0.
|
||||
///
|
||||
static clang::NamespaceDecl* Namespace(clang::Sema* S,
|
||||
const char* Name,
|
||||
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) or 0.
|
||||
///
|
||||
static clang::NamedDecl* Named(clang::Sema* S,
|
||||
const char* Name,
|
||||
clang::DeclContext* Within = 0);
|
||||
|
||||
///\brief Quick lookup for a single namespace declaration in a given
|
||||
/// declaration context.
|
||||
///
|
||||
///\param[in] S - Semantic Analysis object doing the lookup.
|
||||
///\param[in] Name - The name we are looking up. The & avoids inclusion of
|
||||
/// DeclarationName.h (faster at runtime).
|
||||
///\param[in] Within - The context within the lookup is done. If 0 the
|
||||
/// TranslationUnitDecl is used.
|
||||
///\returns the found result (if single) or 0.
|
||||
///
|
||||
static clang::NamedDecl* Named(clang::Sema* S,
|
||||
const clang::DeclarationName& Name,
|
||||
clang::DeclContext* Within = 0);
|
||||
|
||||
};
|
||||
} // end namespace utils
|
||||
} // end namespace cling
|
||||
|
@ -389,8 +389,12 @@ namespace utils {
|
||||
|
||||
NamedDecl* Lookup::Named(Sema* S, const char* Name, DeclContext* Within) {
|
||||
DeclarationName DName = &S->Context.Idents.get(Name);
|
||||
return Lookup::Named(S, DName, Within);
|
||||
}
|
||||
|
||||
LookupResult R(*S, DName, SourceLocation(), Sema::LookupOrdinaryName,
|
||||
NamedDecl* Lookup::Named(Sema* S, const DeclarationName& Name,
|
||||
DeclContext* Within) {
|
||||
LookupResult R(*S, Name, SourceLocation(), Sema::LookupOrdinaryName,
|
||||
Sema::ForRedeclaration);
|
||||
if (!Within)
|
||||
S->LookupName(R, S->TUScope);
|
||||
|
Loading…
Reference in New Issue
Block a user