aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVassil Vassilev <v.g.vassilev@gmail.com>2023-04-30 17:23:04 +0000
committerVassil Vassilev <v.g.vassilev@gmail.com>2023-05-08 09:13:00 +0000
commit743ff9c8bad375d4cea0c44a89cdcc117ffc9bf3 (patch)
tree45ce42c7a5ad995585434b934ed6aa680c62ed04
parent26ee8947702d79ce2cab8e577f713685a5ca4a55 (diff)
downloadllvm-743ff9c8bad375d4cea0c44a89cdcc117ffc9bf3.zip
llvm-743ff9c8bad375d4cea0c44a89cdcc117ffc9bf3.tar.gz
llvm-743ff9c8bad375d4cea0c44a89cdcc117ffc9bf3.tar.bz2
[clang-repl] Do not assert if we have weak references left.
Non-incremental Clang can also exit with the WeakRefReferences not empty upon such example. This patch makes clang-repl consistent to what Clang does. Differential revision: https://reviews.llvm.org/D148435
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp1
-rw-r--r--clang/test/Interpreter/execute-weak.cpp6
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 367f802..7534304 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -7230,7 +7230,6 @@ void CodeGenModule::moveLazyEmissionStates(CodeGenModule *NewBuilder) {
"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);
diff --git a/clang/test/Interpreter/execute-weak.cpp b/clang/test/Interpreter/execute-weak.cpp
index 5b34351..66f2214 100644
--- a/clang/test/Interpreter/execute-weak.cpp
+++ b/clang/test/Interpreter/execute-weak.cpp
@@ -2,11 +2,17 @@
// RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \
// RUN: 'auto r1 = printf("i = %d\n", i);' | FileCheck --check-prefix=CHECK-DRIVER %s
// CHECK-DRIVER: i = 10
+//
// UNSUPPORTED: system-aix, system-windows
// RUN: cat %s | clang-repl | FileCheck %s
+
extern "C" int printf(const char *, ...);
int __attribute__((weak)) bar() { return 42; }
auto r4 = printf("bar() = %d\n", bar());
// CHECK: bar() = 42
+int a = 12;
+static __typeof(a) b __attribute__((__weakref__("a")));
+int c = b;
+
%quit