diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-12 23:21:09 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-12 23:21:09 +0000 |
commit | b6acda0f3606fec82a782b8c0e316335696e4b4e (patch) | |
tree | 83587ca83a45dc07a5582a476d2f56496fda08dd /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | c208f4617c2e1391bf2593492d3c17032fc16366 (diff) | |
download | bcm5719-llvm-b6acda0f3606fec82a782b8c0e316335696e4b4e.tar.gz bcm5719-llvm-b6acda0f3606fec82a782b8c0e316335696e4b4e.zip |
Don't build identifiers for C++ constructors, destructors, or
conversion functions. Instead, we just use a placeholder identifier
for these (e.g., "<constructor>") and override NamedDecl::getName() to
provide a human-readable name.
This is one potential solution to the problem; another solution would
be to replace the use of IdentifierInfo* in NamedDecl with a different
class that deals with identifiers better. I'm also prototyping that to
see how it compares, but this commit is better than what we had
previously.
llvm-svn: 59193
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 128df113858..9bf10cece81 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -705,7 +705,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { CXXConstructorDecl *DefaultCon = CXXConstructorDecl::Create(Context, ClassDecl, ClassDecl->getLocation(), - ClassDecl->getIdentifier(), + &Context.Idents.getConstructorId(), Context.getFunctionType(Context.VoidTy, 0, 0, false, 0), /*isExplicit=*/false, @@ -771,7 +771,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { CXXConstructorDecl *CopyConstructor = CXXConstructorDecl::Create(Context, ClassDecl, ClassDecl->getLocation(), - ClassDecl->getIdentifier(), + &Context.Idents.getConstructorId(), Context.getFunctionType(Context.VoidTy, &ArgType, 1, false, 0), @@ -795,12 +795,10 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { // If a class has no user-declared destructor, a destructor is // declared implicitly. An implicitly-declared destructor is an // inline public member of its class. - std::string DestructorName = "~"; - DestructorName += ClassDecl->getName(); CXXDestructorDecl *Destructor = CXXDestructorDecl::Create(Context, ClassDecl, ClassDecl->getLocation(), - &PP.getIdentifierTable().get(DestructorName), + &Context.Idents.getConstructorId(), Context.getFunctionType(Context.VoidTy, 0, 0, false, 0), /*isInline=*/true, |