summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExceptionSpec.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-07-31 23:46:44 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-07-31 23:46:44 +0000
commit6de7a247824b4d15e97c551a919410cbce90a24f (patch)
tree217dfefa68c7c49319cbe2c2bc8a725a293d033c /clang/lib/Sema/SemaExceptionSpec.cpp
parentb7e2f6015ae8fe44580ed242a0bca9c0001612ac (diff)
downloadbcm5719-llvm-6de7a247824b4d15e97c551a919410cbce90a24f.tar.gz
bcm5719-llvm-6de7a247824b4d15e97c551a919410cbce90a24f.zip
[modules] Maintain an AST invariant across module load/save: if any declaration
of a function has a resolved exception specification, then all declarations of the function do. We should probably improve the AST representation to make this implicit (perhaps only store the exception specification on the canonical declaration), but this fixes things for now. The testcase for this (which used to assert) also exposes the actual bug I was trying to reduce here: we sometimes fail to emit the body of an imported special member function definition. Fix for that to follow. llvm-svn: 214458
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r--clang/lib/Sema/SemaExceptionSpec.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp
index 192b273c7c3..e4963b13d64 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/lib/Sema/SemaExceptionSpec.cpp
@@ -135,13 +135,16 @@ Sema::ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT) {
void
Sema::UpdateExceptionSpec(FunctionDecl *FD,
const FunctionProtoType::ExceptionSpecInfo &ESI) {
- const FunctionProtoType *Proto =
- FD->getType()->castAs<FunctionProtoType>();
-
- // Overwrite the exception spec and rebuild the function type.
- FD->setType(Context.getFunctionType(
- Proto->getReturnType(), Proto->getParamTypes(),
- Proto->getExtProtoInfo().withExceptionSpec(ESI)));
+ for (auto *Redecl : FD->redecls()) {
+ auto *RedeclFD = dyn_cast<FunctionDecl>(Redecl);
+ const FunctionProtoType *Proto =
+ RedeclFD->getType()->castAs<FunctionProtoType>();
+
+ // Overwrite the exception spec and rebuild the function type.
+ RedeclFD->setType(Context.getFunctionType(
+ Proto->getReturnType(), Proto->getParamTypes(),
+ Proto->getExtProtoInfo().withExceptionSpec(ESI)));
+ }
// If we've fully resolved the exception specification, notify listeners.
if (!isUnresolvedExceptionSpec(ESI.Type))
OpenPOWER on IntegriCloud