diff options
author | Yaxun (Sam) Liu <yaxun.liu@amd.com> | 2019-10-31 15:47:21 -0400 |
---|---|---|
committer | Yaxun (Sam) Liu <yaxun.liu@amd.com> | 2019-10-31 22:27:35 -0400 |
commit | bb1616ba47261a0767063e85718d546165972120 (patch) | |
tree | 3e498c5561d3d84bd9522dda2654b009ddc51ce6 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 9b06ac98d0818be3534abe6bc031bf8a40361363 (diff) | |
download | bcm5719-llvm-bb1616ba47261a0767063e85718d546165972120.tar.gz bcm5719-llvm-bb1616ba47261a0767063e85718d546165972120.zip |
[CodeGen] Fix invalid llvm.linker.options about pragma detect_mismatch
When a target does not support pragma detect_mismatch, an llvm.linker.options
metadata with an empty entry is created, which causes diagnostic in backend
since backend expects name/value pair in llvm.linker.options entries.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D69678
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 480a33f2728..49df82cea42 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1933,6 +1933,8 @@ void CodeGenModule::AppendLinkerOptions(StringRef Opts) { 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)); } |