diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-08-27 17:04:39 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-08-27 17:04:39 +0000 |
commit | 8bf410fafae2496f48578fad0bee9a6503693d1b (patch) | |
tree | 682c1813a8bd80ebe7963b8df8b633523526ca96 /clang/lib/Sema/SemaExpr.cpp | |
parent | 7d1c2d88785305c169e740dc72727c6a410d9d7e (diff) | |
download | bcm5719-llvm-8bf410fafae2496f48578fad0bee9a6503693d1b.tar.gz bcm5719-llvm-8bf410fafae2496f48578fad0bee9a6503693d1b.zip |
Call ResolveExceptionSpec for non-OdrUsed functions.
In C++11, instantiation of exception specs is deferred. The instantiation is
done in MarkFunctionReferenced(), which wasn't called for non-OdrUsed functions,
which then caused an assert in codegen. Fixes PR19190, see the bug for details.
llvm-svn: 216562
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 5bb042ce3da..6a530c71ec2 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -11398,7 +11398,8 @@ static bool IsPotentiallyEvaluatedContext(Sema &SemaRef) { /// \brief Mark a function referenced, and check whether it is odr-used /// (C++ [basic.def.odr]p2, C99 6.9p3) -void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func) { +void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, + bool OdrUse) { assert(Func && "No function?"); Func->setReferenced(); @@ -11497,6 +11498,8 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func) { if (FPT && isUnresolvedExceptionSpec(FPT->getExceptionSpecType())) ResolveExceptionSpec(Loc, FPT); + if (!OdrUse) return; + // Implicit instantiation of function templates and member functions of // class templates. if (Func->isImplicitlyInstantiable()) { @@ -12623,14 +12626,14 @@ void Sema::MarkMemberReferenced(MemberExpr *E) { /// normal expression which refers to a variable. void Sema::MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool OdrUse) { if (OdrUse) { - if (VarDecl *VD = dyn_cast<VarDecl>(D)) { + if (auto *VD = dyn_cast<VarDecl>(D)) { MarkVariableReferenced(Loc, VD); return; } - if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { - MarkFunctionReferenced(Loc, FD); - return; - } + } + if (auto *FD = dyn_cast<FunctionDecl>(D)) { + MarkFunctionReferenced(Loc, FD, OdrUse); + return; } D->setReferenced(); } |