From 6593df241a1d119c84c0d97eec4486d2756c4ea1 Mon Sep 17 00:00:00 2001 From: Elizabeth Andrews Date: Wed, 22 Aug 2018 19:05:19 +0000 Subject: Currently clang does not emit unused static constants. GCC emits these constants by default when there is no optimization. GCC's option -fno-keep-static-consts can be used to not emit unused static constants. In Clang, since default behavior does not keep unused static constants, -fkeep-static-consts can be used to emit these if required. This could be useful for producing identification strings like SVN identifiers inside the object file even though the string isn't used by the program. Differential Revision: https://reviews.llvm.org/D40925 llvm-svn: 340439 --- clang/lib/Frontend/CompilerInvocation.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 8e836b1..78ed8f7 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1145,6 +1145,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, << A->getAsString(Args) << A->getValue(); } + Opts.KeepStaticConsts = Args.hasArg(OPT_fkeep_static_consts); + return Success; } -- cgit v1.1