diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-05-06 23:27:55 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-05-06 23:27:55 +0000 |
commit | f08aa62c80df79cb1cb34e34b6140b9f7dba4204 (patch) | |
tree | 4910143865480d8281e2da7c8feeeebf3f4a6284 /clang/lib | |
parent | 39b480cea0749a5b7ce17db642ef9068d8fd54d8 (diff) | |
download | bcm5719-llvm-f08aa62c80df79cb1cb34e34b6140b9f7dba4204.tar.gz bcm5719-llvm-f08aa62c80df79cb1cb34e34b6140b9f7dba4204.zip |
Back out r70506 (exception spec in AST) again. We won't have exception specs until we've had a lot more discussion.
llvm-svn: 71125
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 34 | ||||
-rw-r--r-- | clang/lib/AST/Type.cpp | 13 | ||||
-rw-r--r-- | clang/lib/Frontend/PCHReader.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Frontend/PCHWriter.cpp | 5 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 1 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 3 |
6 files changed, 13 insertions, 53 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index a947fea95aa..c1a232c88e9 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1296,15 +1296,12 @@ QualType ASTContext::getFunctionNoProtoType(QualType ResultTy) { /// list. isVariadic indicates whether the argument list includes '...'. QualType ASTContext::getFunctionType(QualType ResultTy,const QualType *ArgArray, unsigned NumArgs, bool isVariadic, - unsigned TypeQuals, bool hasExceptionSpec, - bool hasAnyExceptionSpec, unsigned NumExs, - const QualType *ExArray) { + unsigned TypeQuals) { // Unique functions, to guarantee there is only one function of a particular // structure. llvm::FoldingSetNodeID ID; FunctionProtoType::Profile(ID, ResultTy, ArgArray, NumArgs, isVariadic, - TypeQuals, hasExceptionSpec, hasAnyExceptionSpec, - NumExs, ExArray); + TypeQuals); void *InsertPos = 0; if (FunctionProtoType *FTP = @@ -1324,32 +1321,24 @@ QualType ASTContext::getFunctionType(QualType ResultTy,const QualType *ArgArray, CanonicalArgs.reserve(NumArgs); for (unsigned i = 0; i != NumArgs; ++i) CanonicalArgs.push_back(getCanonicalType(ArgArray[i])); - llvm::SmallVector<QualType, 2> CanonicalExs; - CanonicalExs.reserve(NumExs); - for (unsigned i = 0; i != NumExs; ++i) - CanonicalExs.push_back(getCanonicalType(ExArray[i])); - + Canonical = getFunctionType(getCanonicalType(ResultTy), &CanonicalArgs[0], NumArgs, - isVariadic, TypeQuals, hasExceptionSpec, - hasAnyExceptionSpec, NumExs, &CanonicalExs[0]); - + isVariadic, TypeQuals); + // Get the new insert position for the node we care about. FunctionProtoType *NewIP = FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos); assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP; } - + // FunctionProtoType objects are allocated with extra bytes after them - // for two variable size arrays (for parameter and exception types) at the - // end of them. + // for a variable size array (for parameter types) at the end of them. FunctionProtoType *FTP = - (FunctionProtoType*)Allocate(sizeof(FunctionProtoType) + - NumArgs*sizeof(QualType) + - NumExs*sizeof(QualType), 8); + (FunctionProtoType*)Allocate(sizeof(FunctionProtoType) + + NumArgs*sizeof(QualType), 8); new (FTP) FunctionProtoType(ResultTy, ArgArray, NumArgs, isVariadic, - TypeQuals, hasExceptionSpec, hasAnyExceptionSpec, - ExArray, NumExs, Canonical); + TypeQuals, Canonical); Types.push_back(FTP); FunctionProtoTypes.InsertNode(FTP, InsertPos); return QualType(FTP, 0); @@ -2916,8 +2905,6 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs) { allRTypes = false; if (lproto && rproto) { // two C99 style function prototypes - assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() && - "C++ shouldn't be here"); unsigned lproto_nargs = lproto->getNumArgs(); unsigned rproto_nargs = rproto->getNumArgs(); @@ -2956,7 +2943,6 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs) { const FunctionProtoType *proto = lproto ? lproto : rproto; if (proto) { - assert(!proto->hasExceptionSpec() && "C++ shouldn't be here"); if (proto->isVariadic()) return QualType(); // Check that the types are compatible with the types that // would result from default argument promotions (C99 6.7.5.3p15). diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 9308288ce35..d6cf4bd0c35 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -920,26 +920,17 @@ const char *BuiltinType::getName() const { void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, QualType Result, arg_type_iterator ArgTys, unsigned NumArgs, bool isVariadic, - unsigned TypeQuals, bool hasExceptionSpec, - bool anyExceptionSpec, unsigned NumExceptions, - exception_iterator Exs) { + unsigned TypeQuals) { ID.AddPointer(Result.getAsOpaquePtr()); for (unsigned i = 0; i != NumArgs; ++i) ID.AddPointer(ArgTys[i].getAsOpaquePtr()); ID.AddInteger(isVariadic); ID.AddInteger(TypeQuals); - ID.AddInteger(hasExceptionSpec); - if (hasExceptionSpec) { - ID.AddInteger(anyExceptionSpec); - for(unsigned i = 0; i != NumExceptions; ++i) - ID.AddPointer(Exs[i].getAsOpaquePtr()); - } } void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, getResultType(), arg_type_begin(), NumArgs, isVariadic(), - getTypeQuals(), hasExceptionSpec(), hasAnyExceptionSpec(), - getNumExceptions(), exception_begin()); + getTypeQuals()); } void ObjCQualifiedInterfaceType::Profile(llvm::FoldingSetNodeID &ID, diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index 949d02a985c..93236209380 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/lib/Frontend/PCHReader.cpp @@ -1584,16 +1584,8 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { ParamTypes.push_back(GetType(Record[Idx++])); bool isVariadic = Record[Idx++]; unsigned Quals = Record[Idx++]; - bool hasExceptionSpec = Record[Idx++]; - bool hasAnyExceptionSpec = Record[Idx++]; - unsigned NumExceptions = Record[Idx++]; - llvm::SmallVector<QualType, 2> Exceptions; - for (unsigned I = 0; I != NumExceptions; ++I) - Exceptions.push_back(GetType(Record[Idx++])); return Context->getFunctionType(ResultType, &ParamTypes[0], NumParams, - isVariadic, Quals, hasExceptionSpec, - hasAnyExceptionSpec, NumExceptions, - &Exceptions[0]); + isVariadic, Quals); } case pch::TYPE_TYPEDEF: diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp index 9b14a94fad2..dacb2cdfd3a 100644 --- a/clang/lib/Frontend/PCHWriter.cpp +++ b/clang/lib/Frontend/PCHWriter.cpp @@ -161,11 +161,6 @@ void PCHTypeWriter::VisitFunctionProtoType(const FunctionProtoType *T) { Writer.AddTypeRef(T->getArgType(I), Record); Record.push_back(T->isVariadic()); Record.push_back(T->getTypeQuals()); - Record.push_back(T->hasExceptionSpec()); - Record.push_back(T->hasAnyExceptionSpec()); - Record.push_back(T->getNumExceptions()); - for (unsigned I = 0, N = T->getNumExceptions(); I != N; ++I) - Writer.AddTypeRef(T->getExceptionType(I), Record); Code = pch::TYPE_FUNCTION_PROTO; } diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 69989b131df..ea6913769a8 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -714,7 +714,6 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { (OldProto = dyn_cast<FunctionProtoType>(OldFuncType))) { // The old declaration provided a function prototype, but the // new declaration does not. Merge in the prototype. - assert(!OldProto->hasExceptionSpec() && "Exception spec in C"); llvm::SmallVector<QualType, 16> ParamTypes(OldProto->arg_type_begin(), OldProto->arg_type_end()); NewQType = Context.getFunctionType(NewFuncType->getResultType(), diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index d385e9c0759..11a38869e15 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -995,9 +995,6 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { QualType ClassType = Context.getTypeDeclType(ClassDecl); ClassType = Context.getCanonicalType(ClassType); - // FIXME: Implicit declarations have exception specifications, which are - // the union of the specifications of the implicitly called functions. - if (!ClassDecl->hasUserDeclaredConstructor()) { // C++ [class.ctor]p5: // A default constructor for a class X is a constructor of class X |