diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-24 05:06:35 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-24 05:06:35 +0000 |
| commit | 4e42bc8365e944ef7d01dbf32a938c70fc408e6c (patch) | |
| tree | 5972aa985bc1d01a3cbaa12e885441f36a60c022 /clang/lib/Sema/SemaDeclCXX.cpp | |
| parent | 1eac0c729f6615d570f4fe8845800d31c14f6891 (diff) | |
| download | bcm5719-llvm-4e42bc8365e944ef7d01dbf32a938c70fc408e6c.tar.gz bcm5719-llvm-4e42bc8365e944ef7d01dbf32a938c70fc408e6c.zip | |
PR12629: Cope with parenthesized function types when attaching a delayed
exception specification to a function.
llvm-svn: 155424
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index b6395f5dcbf..8645de1fcd6 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -11315,11 +11315,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; @@ -11332,6 +11330,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 |

