diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-05-12 00:26:39 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-05-12 00:26:39 +0000 |
commit | 8d02531001c4e1a90809e0a086fb5d2c79028a04 (patch) | |
tree | 7561cc6ff587a560c3fde6e8174dae387c8c95bf /lib | |
parent | a5301de60d7b02629aa14c8a94f8731efeb1d923 (diff) |
Merging r155424:
------------------------------------------------------------------------
r155424 | rsmith | 2012-04-23 22:06:35 -0700 (Mon, 23 Apr 2012) | 3 lines
PR12629: Cope with parenthesized function types when attaching a delayed
exception specification to a function.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_31@156679 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 1d251b9eb7..cec20af2d7 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -11279,11 +11279,9 @@ void Sema::actOnDelayedExceptionSpecification(Decl *MethodD, if (!Method) return; - // Dig out the prototype. This should never fail. + // Dig out the prototype, looking through only parens. This should never fail. const FunctionProtoType *Proto - = dyn_cast<FunctionProtoType>(Method->getType()); - if (!Proto) - return; + = cast<FunctionProtoType>(Method->getType().IgnoreParens()); // Check the exception specification. llvm::SmallVector<QualType, 4> Exceptions; @@ -11296,6 +11294,12 @@ void Sema::actOnDelayedExceptionSpecification(Decl *MethodD, Proto->arg_type_begin(), Proto->getNumArgs(), EPI); + + // Rebuild any parens around the function type. + for (const ParenType *PT = dyn_cast<ParenType>(Method->getType()); PT; + PT = dyn_cast<ParenType>(PT->getInnerType())) + T = Context.getParenType(T); + if (TypeSourceInfo *TSInfo = Method->getTypeSourceInfo()) { // FIXME: When we get proper type location information for exceptions, // we'll also have to rebuild the TypeSourceInfo. For now, we just patch |