ilya-biryukov created this revision.
ilya-biryukov added reviewers: bkramer, sammccall, sepavloff.
By calling ActOnFinishFunctionBody(). Previously we were only calling
ActOnSkippedFunctionBody, which didn't pop the function scope.
This causes a crash when running on our internal code. No test-case,
though, since I couldn't come up with a small example in reasonable
time.
The bug was introduced in r321174.
Repository:
rC Clang
https://reviews.llvm.org/D44439
Files:
lib/Sema/SemaTemplateInstantiateDecl.cpp
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===================================================================
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3939,6 +3939,9 @@
if (PatternDecl->hasSkippedBody()) {
ActOnSkippedFunctionBody(Function);
+ // FIXME: finishing the function body while in an expression evaluation
+ // context seems wrong. Investigate more.
+ ActOnFinishFunctionBody(Function, nullptr, /*IsInstantiation=*/true);
} else {
if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(Function)) {
// If this is a constructor, instantiate the member initializers.
@@ -3961,8 +3964,7 @@
// FIXME: finishing the function body while in an expression evaluation
// context seems wrong. Investigate more.
- ActOnFinishFunctionBody(Function, Body.get(),
- /*IsInstantiation=*/true);
+ ActOnFinishFunctionBody(Function, Body.get(), /*IsInstantiation=*/true);
}
PerformDependentDiagnostics(PatternDecl, TemplateArgs);
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===================================================================
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3939,6 +3939,9 @@
if (PatternDecl->hasSkippedBody()) {
ActOnSkippedFunctionBody(Function);
+ // FIXME: finishing the function body while in an expression evaluation
+ // context seems wrong. Investigate more.
+ ActOnFinishFunctionBody(Function, nullptr, /*IsInstantiation=*/true);
} else {
if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(Function)) {
// If this is a constructor, instantiate the member initializers.
@@ -3961,8 +3964,7 @@
// FIXME: finishing the function body while in an expression evaluation
// context seems wrong. Investigate more.
- ActOnFinishFunctionBody(Function, Body.get(),
- /*IsInstantiation=*/true);
+ ActOnFinishFunctionBody(Function, Body.get(), /*IsInstantiation=*/true);
}
PerformDependentDiagnostics(PatternDecl, TemplateArgs);
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits