Updated IdentifierResolver to deal with DeclarationNames. The names of
C++ constructors, destructors, and conversion functions now have a
FETokenInfo field that IdentifierResolver can access, so that these
special names are handled just like ordinary identifiers. A few other
Sema routines now use DeclarationNames instead of IdentifierInfo*'s.
To validate this design, this code also implements parsing and
semantic analysis for id-expressions that name conversion functions,
e.g.,
return operator bool();
The new parser action ActOnConversionFunctionExpr takes the result of
parsing "operator type-id" and turning it into an expression, using
the IdentifierResolver with the DeclarationName of the conversion
function. ActOnDeclarator pushes those conversion function names into
scope so that the IdentifierResolver can find them, of course.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59462 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp
index 1480527..f22ca0c 100644
--- a/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/lib/Sema/SemaCXXScopeSpec.cpp
@@ -20,9 +20,9 @@
namespace {
Decl *LookupNestedName(DeclContext *LookupCtx, bool LookInParentCtx,
- const IdentifierInfo &II, bool &IdIsUndeclared) {
+ DeclarationName Name, bool &IdIsUndeclared) {
IdentifierResolver::iterator
- I = IdentifierResolver::begin(&II, LookupCtx, LookInParentCtx),
+ I = IdentifierResolver::begin(Name, LookupCtx, LookInParentCtx),
E = IdentifierResolver::end();
if (I == E) {
@@ -67,15 +67,16 @@
const CXXScopeSpec &SS,
SourceLocation IdLoc,
SourceLocation CCLoc,
- const IdentifierInfo &II) {
+ IdentifierInfo &II) {
DeclContext *DC = static_cast<DeclContext*>(SS.getScopeRep());
Decl *SD;
bool IdIsUndeclared;
if (DC)
- SD = LookupNestedName(DC, false/*LookInParentCtx*/, II, IdIsUndeclared);
+ SD = LookupNestedName(DC, false/*LookInParentCtx*/, &II, IdIsUndeclared);
else
- SD = LookupNestedName(CurContext, true/*LookInParent*/, II, IdIsUndeclared);
+ SD = LookupNestedName(CurContext, true/*LookInParent*/, &II,
+ IdIsUndeclared);
if (SD) {
if (TypedefDecl *TD = dyn_cast<TypedefDecl>(SD)) {