summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorMikhail Maltsev <mikhail.maltsev@arm.com>2018-04-20 16:29:03 +0000
committerMikhail Maltsev <mikhail.maltsev@arm.com>2018-04-20 16:29:03 +0000
commit6550c139126ed0a0a6b5fce8f09bde81e60c7abf (patch)
tree3a5e01b1c4a418f9570d87ea3b80d3d8ba46f8cf /clang/lib/CodeGen
parenta417362c28fc695aa9a86807e0a37e0658a7724c (diff)
downloadbcm5719-llvm-6550c139126ed0a0a6b5fce8f09bde81e60c7abf.tar.gz
bcm5719-llvm-6550c139126ed0a0a6b5fce8f09bde81e60c7abf.zip
[CodeGen] Add an option to suppress output of llvm.ident
Summary: By default Clang outputs its version (including git commit hash, in case of trunk builds) into object and assembly files. It might be useful to have an option to disable this, especially for debugging purposes. This patch implements new command line flags -Qn and -Qy (the names are chosen for compatibility with GCC). -Qn disables output of the 'llvm.ident' metadata string and the 'producer' debug info. -Qy (enabled by default) does the opposite. Reviewers: faisalv, echristo, aprantl Reviewed By: aprantl Subscribers: aprantl, cfe-commits, JDevlieghere, rogfer01 Differential Revision: https://reviews.llvm.org/D45255 llvm-svn: 330442
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp3
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index bdd326d70e4..474018c065e 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -577,7 +577,8 @@ void CGDebugInfo::CreateCompileUnit() {
remapDIPath(getCurrentDirname()),
CSInfo,
getSource(SM, SM.getMainFileID())),
- Producer, LO.Optimize || CGOpts.PrepareForLTO || CGOpts.EmitSummaryIndex,
+ CGOpts.EmitVersionIdentMetadata ? Producer : "",
+ LO.Optimize || CGOpts.PrepareForLTO || CGOpts.EmitSummaryIndex,
CGOpts.DwarfDebugFlags, RuntimeVers,
CGOpts.EnableSplitDwarf ? "" : CGOpts.SplitDwarfFile, EmissionKind,
0 /* DWOid */, CGOpts.SplitDwarfInlining, CGOpts.DebugInfoForProfiling,
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 17d9db3399f..707b826418a 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -571,7 +571,8 @@ void CodeGenModule::Release() {
if (DebugInfo)
DebugInfo->finalize();
- EmitVersionIdentMetadata();
+ if (getCodeGenOpts().EmitVersionIdentMetadata)
+ EmitVersionIdentMetadata();
EmitTargetMetadata();
}
OpenPOWER on IntegriCloud