diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-05-27 22:11:52 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-05-27 22:11:52 +0000 |
commit | 465226e23a3008bd68973513dda1f9e3cd27dbdd (patch) | |
tree | c42f2171260da10cac2a87d0f8bc530feef24d00 /lib/Sema/SemaType.cpp | |
parent | cfcceab862141b7cc3df42ced5f421d76e536a36 (diff) |
Reintroduce the home for exception specs, and make Sema fill it. However, keep the spec out of the canonical type this time. Net effect is currently nothing, because the spec isn't checked anywhere.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72498 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 19ff9bbd4c..298a6cddda 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -716,12 +716,20 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip) { T = Context.IntTy; D.setInvalidType(true); } - + if (FTI.NumArgs == 0) { if (getLangOptions().CPlusPlus) { // C++ 8.3.5p2: If the parameter-declaration-clause is empty, the // function takes no arguments. - T = Context.getFunctionType(T, NULL, 0, FTI.isVariadic,FTI.TypeQuals); + llvm::SmallVector<QualType, 4> Exceptions; + Exceptions.reserve(FTI.NumExceptions); + for(unsigned ei = 0, ee = FTI.NumExceptions; ei != ee; ++ei) + Exceptions.push_back( + QualType::getFromOpaquePtr(FTI.Exceptions[ei])); + T = Context.getFunctionType(T, NULL, 0, FTI.isVariadic, FTI.TypeQuals, + FTI.hasExceptionSpec, + FTI.hasAnyExceptionSpec, + FTI.NumExceptions, Exceptions.data()); } else if (FTI.isVariadic) { // We allow a zero-parameter variadic function in C if the // function is marked with the "overloadable" @@ -795,8 +803,17 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip) { ArgTys.push_back(ArgTy); } + + llvm::SmallVector<QualType, 4> Exceptions; + Exceptions.reserve(FTI.NumExceptions); + for(unsigned ei = 0, ee = FTI.NumExceptions; ei != ee; ++ei) + Exceptions.push_back(QualType::getFromOpaquePtr(FTI.Exceptions[ei])); + T = Context.getFunctionType(T, ArgTys.data(), ArgTys.size(), - FTI.isVariadic, FTI.TypeQuals); + FTI.isVariadic, FTI.TypeQuals, + FTI.hasExceptionSpec, + FTI.hasAnyExceptionSpec, + FTI.NumExceptions, Exceptions.data()); } break; } |