[PATCH] D148435: [clang-repl] Do not assert if we have weak references left.

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 15 09:49:29 PDT 2023


v.g.vassilev created this revision.
v.g.vassilev added reviewers: aaron.ballman, rjmccall, rsmith, junaire.
Herald added a project: All.
v.g.vassilev requested review of this revision.

Non-incremental Clang can also exit with the WeakRefReferences not empty upon such example. This patch makes clang-repl consistent to what Clang does.


Repository:
  rC Clang

https://reviews.llvm.org/D148435

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/Interpreter/execute-weak.cpp


Index: clang/test/Interpreter/execute-weak.cpp
===================================================================
--- clang/test/Interpreter/execute-weak.cpp
+++ clang/test/Interpreter/execute-weak.cpp
@@ -9,4 +9,7 @@
 auto r4 = printf("bar() = %d\n", bar());
 // CHECK: bar() = 42
 
+static int a() __attribute__((weakref("a")));
+int b = a();
+
 %quit
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -7232,7 +7232,6 @@
          "Newly created module should not have manglings");
   NewBuilder->Manglings = std::move(Manglings);
 
-  assert(WeakRefReferences.empty() && "Not all WeakRefRefs have been applied");
   NewBuilder->WeakRefReferences = std::move(WeakRefReferences);
 
   NewBuilder->TBAA = std::move(TBAA);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148435.513925.patch
Type: text/x-patch
Size: 867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230415/61aeb552/attachment.bin>


More information about the cfe-commits mailing list