tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
As discussed with @aaron.ballman on IRC. This reverts https://reviews.llvm.org/rGa8843643cd75d0e93ebcf3f30b470d2b8e59868d I have ASan enabled locally and with this patch, the test suite now works fine. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D134054 Files: clang/lib/AST/Interp/Program.h clang/test/AST/Interp/references.cpp Index: clang/test/AST/Interp/references.cpp =================================================================== --- clang/test/AST/Interp/references.cpp +++ clang/test/AST/Interp/references.cpp @@ -75,7 +75,6 @@ constexpr const int &MCE = 1; // expected-error{{must be initialized by a constant expression}} -#if 0 struct S { int i, j; }; @@ -89,5 +88,4 @@ return j; } // FIXME: Should be accepted. -static_assert(RefToMemberExpr() == 11, ""); -#endif +static_assert(RefToMemberExpr() == 11, ""); // expected-error {{not an integral constant expression}} Index: clang/lib/AST/Interp/Program.h =================================================================== --- clang/lib/AST/Interp/Program.h +++ clang/lib/AST/Interp/Program.h @@ -41,6 +41,14 @@ public: Program(Context &Ctx) : Ctx(Ctx) {} + ~Program() { + // Records might actually allocate memory themselves, but they + // are allocated using a BumpPtrAllocator. Call their desctructors + // here manually so they are properly freeing their resources. + for (auto It : Records) + It.second->~Record(); + } + /// Marshals a native pointer to an ID for embedding in bytecode. unsigned getOrCreateNativePointer(const void *Ptr);
Index: clang/test/AST/Interp/references.cpp =================================================================== --- clang/test/AST/Interp/references.cpp +++ clang/test/AST/Interp/references.cpp @@ -75,7 +75,6 @@ constexpr const int &MCE = 1; // expected-error{{must be initialized by a constant expression}} -#if 0 struct S { int i, j; }; @@ -89,5 +88,4 @@ return j; } // FIXME: Should be accepted. -static_assert(RefToMemberExpr() == 11, ""); -#endif +static_assert(RefToMemberExpr() == 11, ""); // expected-error {{not an integral constant expression}} Index: clang/lib/AST/Interp/Program.h =================================================================== --- clang/lib/AST/Interp/Program.h +++ clang/lib/AST/Interp/Program.h @@ -41,6 +41,14 @@ public: Program(Context &Ctx) : Ctx(Ctx) {} + ~Program() { + // Records might actually allocate memory themselves, but they + // are allocated using a BumpPtrAllocator. Call their desctructors + // here manually so they are properly freeing their resources. + for (auto It : Records) + It.second->~Record(); + } + /// Marshals a native pointer to an ID for embedding in bytecode. unsigned getOrCreateNativePointer(const void *Ptr);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits