[clang] [clang-repl] Refactor locking of runtime PTU stack (NFC) (PR #84176)

Stefan Gränitz via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 14:51:10 PST 2024


================
@@ -136,6 +136,24 @@ TEST(InterpreterTest, DeclsAndStatements) {
   EXPECT_TRUE(!!R2);
 }
 
+TEST(InterpreterTest, PTUStack) {
+  clang::IncrementalCompilerBuilder CB;
+  auto CI = cantFail(CB.CreateCpp());
+
+  llvm::Error Err = llvm::Error::success();
+  auto Interp = std::make_unique<Interpreter>(std::move(CI), Err);
+  cantFail(std::move(Err));
+
+  auto NumBuiltinPTUs = Interp->getEffectivePTUSize();
+  cantFail(Interp->Parse("void firstRuntimePTU() {}"));
+  EXPECT_EQ(NumBuiltinPTUs + 1, Interp->getEffectivePTUSize());
----------------
weliveindetail wrote:

Yes, that's right. In fact, we could just not expose it right now and instead keep this a NFC. Then we don't need a new test either.

https://github.com/llvm/llvm-project/pull/84176


More information about the cfe-commits mailing list