[cfe-commits] r63756 - in /cfe/trunk: include/clang/Parse/Action.h lib/Sema/Sema.h lib/Sema/SemaDecl.cpp
Douglas Gregor
dgregor at apple.com
Wed Feb 4 11:16:12 PST 2009
Author: dgregor
Date: Wed Feb 4 13:16:12 2009
New Revision: 63756
URL: http://llvm.org/viewvc/llvm-project?rev=63756&view=rev
Log:
Improve documentation for Sema::getTypeName. Also, it's return type is
DeclTy*, not TypeTy*.
Modified:
cfe/trunk/include/clang/Parse/Action.h
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=63756&r1=63755&r2=63756&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Wed Feb 4 13:16:12 2009
@@ -135,7 +135,7 @@
/// 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 @@
/// 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
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=63756&r1=63755&r2=63756&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Wed Feb 4 13:16:12 2009
@@ -282,7 +282,7 @@
//===--------------------------------------------------------------------===//
// 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);
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=63756&r1=63755&r2=63756&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Feb 4 13:16:12 2009
@@ -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);
More information about the cfe-commits
mailing list