summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-01 03:28:42 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-01 03:28:42 +0000
commit3671ad4571850ffe5248c73add85e329b2270219 (patch)
tree75342861ea51052219b5124ecdeed81300263beb /clang/lib/Sema/SemaDeclCXX.cpp
parent722f5fc5672e6fdde1731e9d0cee3fd6bee1f490 (diff)
downloadbcm5719-llvm-3671ad4571850ffe5248c73add85e329b2270219.tar.gz
bcm5719-llvm-3671ad4571850ffe5248c73add85e329b2270219.zip
Revert r107374, which broke bootstrap.
llvm-svn: 107378
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index c59575f13b5..1c0a72bf118 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -2990,7 +2990,9 @@ QualType Sema::CheckConstructorDeclarator(Declarator &D, QualType R,
// Rebuild the function type "R" without any type qualifiers (in
// case any of the errors above fired) and with "void" as the
- // return type, since constructors don't have return types.
+ // return type, since constructors don't have return types. We
+ // *always* have to do this, because GetTypeForDeclarator will
+ // put in a result type of "int" when none was specified.
const FunctionProtoType *Proto = R->getAs<FunctionProtoType>();
return Context.getFunctionType(Context.VoidTy, Proto->arg_type_begin(),
Proto->getNumArgs(),
@@ -3085,7 +3087,7 @@ FTIHasSingleVoidArgument(DeclaratorChunk::FunctionTypeInfo &FTI) {
/// emit diagnostics and set the declarator to invalid. Even if this happens,
/// will be updated to reflect a well-formed type for the destructor and
/// returned.
-QualType Sema::CheckDestructorDeclarator(Declarator &D, QualType R,
+QualType Sema::CheckDestructorDeclarator(Declarator &D,
FunctionDecl::StorageClass& SC) {
// C++ [class.dtor]p1:
// [...] A typedef-name that names a class is a class-name
@@ -3093,9 +3095,11 @@ QualType Sema::CheckDestructorDeclarator(Declarator &D, QualType R,
// be used as the identifier in the declarator for a destructor
// declaration.
QualType DeclaratorType = GetTypeFromParser(D.getName().DestructorName);
- if (isa<TypedefType>(DeclaratorType))
+ if (isa<TypedefType>(DeclaratorType)) {
Diag(D.getIdentifierLoc(), diag::err_destructor_typedef_name)
<< DeclaratorType;
+ D.setInvalidType();
+ }
// C++ [class.dtor]p2:
// A destructor is used to destroy objects of its class type. A
@@ -3109,10 +3113,9 @@ QualType Sema::CheckDestructorDeclarator(Declarator &D, QualType R,
if (!D.isInvalidType())
Diag(D.getIdentifierLoc(), diag::err_destructor_cannot_be)
<< "static" << SourceRange(D.getDeclSpec().getStorageClassSpecLoc())
- << SourceRange(D.getIdentifierLoc())
- << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc());
-
+ << SourceRange(D.getIdentifierLoc());
SC = FunctionDecl::None;
+ D.setInvalidType();
}
if (D.getDeclSpec().hasTypeSpecifier() && !D.isInvalidType()) {
// Destructors don't have return types, but the parser will
@@ -3160,17 +3163,11 @@ QualType Sema::CheckDestructorDeclarator(Declarator &D, QualType R,
// Rebuild the function type "R" without any type qualifiers or
// parameters (in case any of the errors above fired) and with
// "void" as the return type, since destructors don't have return
- // types.
- const FunctionProtoType *Proto = R->getAs<FunctionProtoType>();
- if (!Proto)
- return QualType();
-
+ // types. We *always* have to do this, because GetTypeForDeclarator
+ // will put in a result type of "int" when none was specified.
+ // FIXME: Exceptions!
return Context.getFunctionType(Context.VoidTy, 0, 0, false, 0,
- Proto->hasExceptionSpec(),
- Proto->hasAnyExceptionSpec(),
- Proto->getNumExceptions(),
- Proto->exception_begin(),
- Proto->getExtInfo());
+ false, false, 0, 0, FunctionType::ExtInfo());
}
/// CheckConversionDeclarator - Called by ActOnDeclarator to check the
OpenPOWER on IntegriCloud