tbaeder updated this revision to Diff 485714.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140776/new/

https://reviews.llvm.org/D140776

Files:
  clang/lib/AST/Interp/ByteCodeEmitter.cpp
  clang/test/AST/Interp/records.cpp


Index: clang/test/AST/Interp/records.cpp
===================================================================
--- clang/test/AST/Interp/records.cpp
+++ clang/test/AST/Interp/records.cpp
@@ -325,3 +325,9 @@
                                        // expected-error {{must be initialized 
by a constant expression}}
                                        // FIXME: Missing reason for rejection.
 };
+
+namespace EmptyCtor {
+  struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
+  constexpr piecewise_construct_t piecewise_construct =
+    piecewise_construct_t();
+};
Index: clang/lib/AST/Interp/ByteCodeEmitter.cpp
===================================================================
--- clang/lib/AST/Interp/ByteCodeEmitter.cpp
+++ clang/lib/AST/Interp/ByteCodeEmitter.cpp
@@ -21,11 +21,6 @@
 
 Expected<Function *>
 ByteCodeEmitter::compileFunc(const FunctionDecl *FuncDecl) {
-  // Function is not defined at all or not yet. We will
-  // create a Function instance but not compile the body. That
-  // will (maybe) happen later.
-  bool HasBody = FuncDecl->hasBody(FuncDecl);
-
   // Create a handle over the emitted code.
   Function *Func = P.getFunction(FuncDecl);
   if (!Func) {
@@ -73,7 +68,9 @@
   }
 
   assert(Func);
-  if (!HasBody)
+  // For not-yet-defined functions, we only create a Function instance and
+  // compile their body later.
+  if (!FuncDecl->isDefined())
     return Func;
 
   // Compile the function body.


Index: clang/test/AST/Interp/records.cpp
===================================================================
--- clang/test/AST/Interp/records.cpp
+++ clang/test/AST/Interp/records.cpp
@@ -325,3 +325,9 @@
                                        // expected-error {{must be initialized by a constant expression}}
                                        // FIXME: Missing reason for rejection.
 };
+
+namespace EmptyCtor {
+  struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
+  constexpr piecewise_construct_t piecewise_construct =
+    piecewise_construct_t();
+};
Index: clang/lib/AST/Interp/ByteCodeEmitter.cpp
===================================================================
--- clang/lib/AST/Interp/ByteCodeEmitter.cpp
+++ clang/lib/AST/Interp/ByteCodeEmitter.cpp
@@ -21,11 +21,6 @@
 
 Expected<Function *>
 ByteCodeEmitter::compileFunc(const FunctionDecl *FuncDecl) {
-  // Function is not defined at all or not yet. We will
-  // create a Function instance but not compile the body. That
-  // will (maybe) happen later.
-  bool HasBody = FuncDecl->hasBody(FuncDecl);
-
   // Create a handle over the emitted code.
   Function *Func = P.getFunction(FuncDecl);
   if (!Func) {
@@ -73,7 +68,9 @@
   }
 
   assert(Func);
-  if (!HasBody)
+  // For not-yet-defined functions, we only create a Function instance and
+  // compile their body later.
+  if (!FuncDecl->isDefined())
     return Func;
 
   // Compile the function body.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to