[PATCH] D44439: [Sema] Pop function scope when instantiating a func with skipped body

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 14 06:21:20 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC327504: [Sema] Pop function scope when instantiating a func with skipped body (authored by ibiryukov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44439?vs=138333&id=138338#toc

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
@@ -3937,8 +3937,10 @@
                                          TemplateArgs))
       return;
 
+    StmtResult Body;
     if (PatternDecl->hasSkippedBody()) {
       ActOnSkippedFunctionBody(Function);
+      Body = nullptr;
     } else {
       if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(Function)) {
         // If this is a constructor, instantiate the member initializers.
@@ -3954,16 +3956,14 @@
       }
 
       // Instantiate the function body.
-      StmtResult Body = SubstStmt(Pattern, TemplateArgs);
+      Body = SubstStmt(Pattern, TemplateArgs);
 
       if (Body.isInvalid())
         Function->setInvalidDecl();
-
-      // FIXME: finishing the function body while in an expression evaluation
-      // context seems wrong. Investigate more.
-      ActOnFinishFunctionBody(Function, Body.get(),
-                              /*IsInstantiation=*/true);
     }
+    // FIXME: finishing the function body while in an expression evaluation
+    // context seems wrong. Investigate more.
+    ActOnFinishFunctionBody(Function, Body.get(), /*IsInstantiation=*/true);
 
     PerformDependentDiagnostics(PatternDecl, TemplateArgs);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44439.138338.patch
Type: text/x-patch
Size: 1368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180314/0692be46/attachment.bin>


More information about the cfe-commits mailing list