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
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 19ff9bb..298a6cd 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -716,12 +716,20 @@
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 @@
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;
}