[clang] 8ad9e1e - [Clang] Fix use of deprecated method and missing triple
Stephen Tozer via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 28 05:22:44 PST 2025
Author: Stephen Tozer
Date: 2025-01-28T13:21:41Z
New Revision: 8ad9e1ecb7e565c2f99b4ef67517d1f37d1c80d0
URL: https://github.com/llvm/llvm-project/commit/8ad9e1ecb7e565c2f99b4ef67517d1f37d1c80d0
DIFF: https://github.com/llvm/llvm-project/commit/8ad9e1ecb7e565c2f99b4ef67517d1f37d1c80d0.diff
LOG: [Clang] Fix use of deprecated method and missing triple
Fixes two buildbot errors caused by 4424c44c (#110102):
The first error, seen on some sanitizer bots:
https://lab.llvm.org/buildbot/#/builders/51/builds/9901
The initial commit used the deprecated getDeclaration intrinsic instead
of the non-deprecated getOrInsert- equivalent. This patch trivially
updates the code in question to use the new intrinsic.
The second error, seen on the clang-armv8-quick bot:
https://lab.llvm.org/buildbot/#/builders/154/builds/10983
One of the tests depends on a particular triple to get the exact output
expected by the test, but did not specify this triple; this patch adds
the triple in question.
Added:
Modified:
clang/lib/CodeGen/CGDecl.cpp
clang/test/CodeGen/fake-use-sanitizer.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index ded905cdcc9f44..e0d2048262f8f1 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -2587,9 +2587,10 @@ llvm::Function *CodeGenModule::getLLVMLifetimeEndFn() {
/// Lazily declare the @llvm.fake.use intrinsic.
llvm::Function *CodeGenModule::getLLVMFakeUseFn() {
- if (!FakeUseFn)
- FakeUseFn = llvm::Intrinsic::getDeclaration(&getModule(),
- llvm::Intrinsic::fake_use);
+ if (FakeUseFn)
+ return FakeUseFn;
+ FakeUseFn = llvm::Intrinsic::getOrInsertDeclaration(
+ &getModule(), llvm::Intrinsic::fake_use);
return FakeUseFn;
}
diff --git a/clang/test/CodeGen/fake-use-sanitizer.cpp b/clang/test/CodeGen/fake-use-sanitizer.cpp
index 4d33dcf7c69441..d544bf85d2d9e4 100644
--- a/clang/test/CodeGen/fake-use-sanitizer.cpp
+++ b/clang/test/CodeGen/fake-use-sanitizer.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -emit-llvm -fextend-variable-liveness -fsanitize=null -fsanitize-trap=null -o - | FileCheck --check-prefixes=CHECK,NULL --implicit-check-not=ubsantrap %s
-// RUN: %clang_cc1 %s -emit-llvm -fextend-variable-liveness -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness -fsanitize=null -fsanitize-trap=null -o - | FileCheck --check-prefixes=CHECK,NULL --implicit-check-not=ubsantrap %s
+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness -o - | FileCheck %s
// With -fextend-lifetimes, the compiler previously generated a fake.use of any
// reference variable at the end of the scope in which its alloca exists. This
More information about the cfe-commits
mailing list