[PATCH] D69678: [CodeGen] Fix invalid llvm.linker.options about pragma detect_mismatch
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 31 19:29:33 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb1616ba4726: [CodeGen] Fix invalid llvm.linker.options about pragma detect_mismatch (authored by yaxunl).
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69678/new/
https://reviews.llvm.org/D69678
Files:
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGen/pragma-detect_mismatch.c
Index: clang/test/CodeGen/pragma-detect_mismatch.c
===================================================================
--- clang/test/CodeGen/pragma-detect_mismatch.c
+++ clang/test/CodeGen/pragma-detect_mismatch.c
@@ -1,5 +1,9 @@
-// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s
-// RUN: %clang_cc1 %s -triple thumbv7-windows -fms-extensions -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - \
+// RUN: | FileCheck %s
+// RUN: %clang_cc1 %s -triple thumbv7-windows -fms-extensions -emit-llvm -o - \
+// RUN: | FileCheck %s
+// RUN: %clang_cc1 %s -triple amdgcn-amd-amdhsa -fms-extensions -emit-llvm -o \
+// RUN: - | FileCheck -check-prefix=AMD %s
#pragma detect_mismatch("test", "1")
@@ -9,3 +13,4 @@
// CHECK: !llvm.linker.options = !{![[test:[0-9]+]], ![[test2:[0-9]+]]}
// CHECK: ![[test]] = !{!"/FAILIFMISMATCH:\22test=1\22"}
// CHECK: ![[test2]] = !{!"/FAILIFMISMATCH:\22test2=2\22"}
+// AMD-NOT: !llvm.linker.options
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -1933,6 +1933,8 @@
void CodeGenModule::AddDetectMismatch(StringRef Name, StringRef Value) {
llvm::SmallString<32> Opt;
getTargetCodeGenInfo().getDetectMismatchOption(Name, Value, Opt);
+ if (Opt.empty())
+ return;
auto *MDOpts = llvm::MDString::get(getLLVMContext(), Opt);
LinkerOptionsMetadata.push_back(llvm::MDNode::get(getLLVMContext(), MDOpts));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69678.227388.patch
Type: text/x-patch
Size: 1605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191101/eb1745c7/attachment-0001.bin>
More information about the cfe-commits
mailing list