Be nice to the caller - lookup inside a DeclContext should work even for a const DeclContext, so do a const_cast in the source.
git-svn-id: http://root.cern.ch/svn/root/trunk@47496 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
parent
2da8caecff
commit
3df2500a81
@ -116,7 +116,7 @@ namespace utils {
|
||||
///
|
||||
static clang::NamespaceDecl* Namespace(clang::Sema* S,
|
||||
const char* Name,
|
||||
clang::DeclContext* Within = 0);
|
||||
const clang::DeclContext* Within = 0);
|
||||
|
||||
///\brief Quick lookup for a single named declaration in a given
|
||||
/// declaration context.
|
||||
@ -129,7 +129,7 @@ namespace utils {
|
||||
///
|
||||
static clang::NamedDecl* Named(clang::Sema* S,
|
||||
const char* Name,
|
||||
clang::DeclContext* Within = 0);
|
||||
const clang::DeclContext* Within = 0);
|
||||
|
||||
///\brief Quick lookup for a single namespace declaration in a given
|
||||
/// declaration context.
|
||||
@ -143,7 +143,7 @@ namespace utils {
|
||||
///
|
||||
static clang::NamedDecl* Named(clang::Sema* S,
|
||||
const clang::DeclarationName& Name,
|
||||
clang::DeclContext* Within = 0);
|
||||
const clang::DeclContext* Within = 0);
|
||||
|
||||
};
|
||||
} // end namespace utils
|
||||
|
@ -466,14 +466,14 @@ namespace utils {
|
||||
}
|
||||
|
||||
NamespaceDecl* Lookup::Namespace(Sema* S, const char* Name,
|
||||
DeclContext* Within) {
|
||||
const DeclContext* Within) {
|
||||
DeclarationName DName = &S->Context.Idents.get(Name);
|
||||
LookupResult R(*S, DName, SourceLocation(),
|
||||
Sema::LookupNestedNameSpecifierName);
|
||||
if (!Within)
|
||||
S->LookupName(R, S->TUScope);
|
||||
else
|
||||
S->LookupQualifiedName(R, Within);
|
||||
S->LookupQualifiedName(R, const_cast<DeclContext*>(Within));
|
||||
|
||||
if (R.empty())
|
||||
return 0;
|
||||
@ -483,19 +483,20 @@ namespace utils {
|
||||
return dyn_cast<NamespaceDecl>(R.getFoundDecl());
|
||||
}
|
||||
|
||||
NamedDecl* Lookup::Named(Sema* S, const char* Name, DeclContext* Within) {
|
||||
NamedDecl* Lookup::Named(Sema* S, const char* Name,
|
||||
const DeclContext* Within) {
|
||||
DeclarationName DName = &S->Context.Idents.get(Name);
|
||||
return Lookup::Named(S, DName, Within);
|
||||
}
|
||||
|
||||
NamedDecl* Lookup::Named(Sema* S, const DeclarationName& Name,
|
||||
DeclContext* Within) {
|
||||
const DeclContext* Within) {
|
||||
LookupResult R(*S, Name, SourceLocation(), Sema::LookupOrdinaryName,
|
||||
Sema::ForRedeclaration);
|
||||
if (!Within)
|
||||
S->LookupName(R, S->TUScope);
|
||||
else
|
||||
S->LookupQualifiedName(R, Within);
|
||||
S->LookupQualifiedName(R, const_cast<DeclContext*>(Within));
|
||||
|
||||
if (R.empty())
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user