diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-17 14:58:09 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-17 14:58:09 +0000 |
commit | 2e1cd4264d363ca869bf37ef160902f211d21b8c (patch) | |
tree | b4e6314529ad811be3463a668f8b4e515f66fbcc /lib/Sema/SemaDecl.cpp | |
parent | b8abbdc90f902a2c09c566193b900c2c45a46672 (diff) |
Introduction the DeclarationName class, as a single, general method of
representing the names of declarations in the C family of
languages. DeclarationName is used in NamedDecl to store the name of
the declaration (naturally), and ObjCMethodDecl is now a NamedDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59441 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 1ecaaa370a..48073694a3 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -877,9 +877,13 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { bool isInvalidDecl = CheckConstructorDeclarator(D, R, SC); // Create the new declaration + QualType ClassType = Context.getTypeDeclType(cast<CXXRecordDecl>(DC)); + ClassType = Context.getCanonicalType(ClassType); + DeclarationName ConName + = Context.DeclarationNames.getCXXConstructorName(ClassType); NewFD = CXXConstructorDecl::Create(Context, cast<CXXRecordDecl>(DC), - D.getIdentifierLoc(), II, R, + D.getIdentifierLoc(), ConName, R, isExplicit, isInline, /*isImplicitlyDeclared=*/false); @@ -890,9 +894,14 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { if (DC->isCXXRecord()) { bool isInvalidDecl = CheckDestructorDeclarator(D, R, SC); + QualType ClassType = Context.getTypeDeclType(cast<CXXRecordDecl>(DC)); + ClassType = Context.getCanonicalType(ClassType); + DeclarationName DesName + = Context.DeclarationNames.getCXXDestructorName(ClassType); + NewFD = CXXDestructorDecl::Create(Context, cast<CXXRecordDecl>(DC), - D.getIdentifierLoc(), II, R, + D.getIdentifierLoc(), DesName, R, isInline, /*isImplicitlyDeclared=*/false); @@ -916,9 +925,14 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { } else { bool isInvalidDecl = CheckConversionDeclarator(D, R, SC); + QualType ConvType = R->getAsFunctionType()->getResultType(); + ConvType = Context.getCanonicalType(ConvType); + DeclarationName ConvName + = Context.DeclarationNames.getCXXConversionFunctionName(ConvType); + NewFD = CXXConversionDecl::Create(Context, cast<CXXRecordDecl>(DC), - D.getIdentifierLoc(), II, R, + D.getIdentifierLoc(), ConvName, R, isInline, isExplicit); if (isInvalidDecl) |