Survive and signal non-unique lookup results.

This commit is contained in:
Axel Naumann 2014-04-27 17:45:55 +02:00 committed by sftnight
parent 04d0d17f3e
commit 8b60eaf361
2 changed files with 6 additions and 5 deletions

View File

@ -189,7 +189,7 @@ namespace utils {
///\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.
///\returns the found NamespaceDecl or 0.
///
clang::NamespaceDecl* Namespace(clang::Sema* S,
const char* Name,
@ -202,7 +202,7 @@ namespace utils {
///\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.
///\returns the found result if single, -1 if multiple or 0 if not found.
///
clang::NamedDecl* Named(clang::Sema* S,
const char* Name,
@ -216,7 +216,7 @@ namespace utils {
/// 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.
///\returns the found result if single, -1 if multiple or 0 if not found.
///
clang::NamedDecl* Named(clang::Sema* S,
const clang::DeclarationName& Name,

View File

@ -1180,8 +1180,9 @@ namespace utils {
R.resolveKind();
return R.getFoundDecl();
if (R.isSingleResult())
return R.getFoundDecl();
return (clang::NamedDecl*)-1;
}
static NestedNameSpecifier*