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 | 77324f385482d592ef54b286ffbb00f47b9259ac (patch) | |
tree | 7c60f2f71c6e87fbc3242d87e24cf4b23cd9d435 /clang/lib/Sema/SemaDecl.cpp | |
parent | d1f5e5d30458080f3591251d29bd6758f667a448 (diff) | |
download | bcm5719-llvm-77324f385482d592ef54b286ffbb00f47b9259ac.tar.gz bcm5719-llvm-77324f385482d592ef54b286ffbb00f47b9259ac.zip |
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.
llvm-svn: 59441
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 1ecaaa370a4..48073694a32 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/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) |