From: Douglas Gregor Date: Wed, 4 Feb 2009 19:16:12 +0000 (+0000) Subject: Improve documentation for Sema::getTypeName. Also, it's return type is X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6efafa5144a3e9942d1b09a246b118b1ba77a48;p=clang Improve documentation for Sema::getTypeName. Also, it's return type is DeclTy*, not TypeTy*. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63756 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index bf67b7873f..2a860a849d 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -135,7 +135,7 @@ public: /// An optional CXXScopeSpec can be passed to indicate the C++ scope (class or /// namespace) that the identifier must be a member of. /// i.e. for "foo::bar", 'II' will be "bar" and 'SS' will be "foo::". - virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, + virtual DeclTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, const CXXScopeSpec *SS = 0) = 0; /// isCurrentClassName - Return true if the specified name is the @@ -1348,7 +1348,7 @@ public: /// getTypeName - This looks at the IdentifierInfo::FETokenInfo field to /// determine whether the name is a typedef or not in this scope. - virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, + virtual DeclTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, const CXXScopeSpec *SS); /// isCurrentClassName - Always returns false, because MinimalAction diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index b27f11b77c..4879ac8458 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -282,7 +282,7 @@ public: //===--------------------------------------------------------------------===// // Symbol table / Decl tracking callbacks: SemaDecl.cpp. // - virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, + virtual DeclTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, const CXXScopeSpec *SS); virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup) { return ActOnDeclarator(S, D, LastInGroup, false); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 3e501f450a..e31f376d86 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -31,7 +31,17 @@ using namespace clang; -Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, +/// \brief If the identifier refers to a type name within this scope, +/// return the declaration of that type. +/// +/// This routine performs ordinary name lookup of the identifier II +/// within the given scope, with optional C++ scope specifier SS, to +/// determine whether the name refers to a type. If so, returns the +/// declaration corresponding to that type. Otherwise, returns NULL. +/// +/// If name lookup results in an ambiguity, this routine will complain +/// and then return NULL. +Sema::DeclTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, const CXXScopeSpec *SS) { Decl *IIDecl = 0; LookupResult Result = LookupParsedName(S, SS, &II, LookupOrdinaryName, false);