Switch -f{builtin,math-errno,rtti} and -analyzer-purge-dead to -...no... variants instead of using llvm::cl::init(true) arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89315 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index e7dcc20..5f0551b 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -779,12 +779,11 @@
break;
}
- if (Args.hasFlag(options::OPT_fmath_errno,
+ // -fmath-errno is default.
+ if (!Args.hasFlag(options::OPT_fmath_errno,
options::OPT_fno_math_errno,
getToolChain().IsMathErrnoDefault()))
- CmdArgs.push_back("--fmath-errno=1");
- else
- CmdArgs.push_back("--fmath-errno=0");
+ CmdArgs.push_back("-fno-math-errno");
if (Arg *A = Args.getLastArg(options::OPT_flimited_precision_EQ)) {
CmdArgs.push_back("--limit-float-precision");
@@ -923,7 +922,7 @@
// -fbuiltin is default.
if (!Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin))
- CmdArgs.push_back("-fbuiltin=0");
+ CmdArgs.push_back("-fno-builtin");
// -fblocks=0 is default.
if (Args.hasFlag(options::OPT_fblocks, options::OPT_fno_blocks,
@@ -939,7 +938,7 @@
// -frtti is default.
if (!Args.hasFlag(options::OPT_frtti, options::OPT_fno_rtti))
- CmdArgs.push_back("-frtti=0");
+ CmdArgs.push_back("-fno-rtti");
// -fsigned-char is default.
if (!Args.hasFlag(options::OPT_fsigned_char,
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index 4604db5..f5c6a10 100644
--- a/test/Analysis/null-deref-ps.c
+++ b/test/Analysis/null-deref-ps.c
@@ -1,6 +1,6 @@
// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic
// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic
-// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-purge-dead=false -verify %s
+// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s
// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
typedef unsigned uintptr_t;
diff --git a/test/CodeGen/libcalls.c b/test/CodeGen/libcalls.c
index cbbde8a..32fc59f 100644
--- a/test/CodeGen/libcalls.c
+++ b/test/CodeGen/libcalls.c
@@ -1,7 +1,7 @@
-// RUN: clang-cc -fmath-errno=1 -emit-llvm -o %t %s -triple i386-unknown-unknown
+// RUN: clang-cc -emit-llvm -o %t %s -triple i386-unknown-unknown
// RUN: grep "declare " %t | count 6
// RUN: grep "declare " %t | grep "@llvm." | count 1
-// RUN: clang-cc -fmath-errno=0 -emit-llvm -o %t %s -triple i386-unknown-unknown
+// RUN: clang-cc -fno-math-errno -emit-llvm -o %t %s -triple i386-unknown-unknown
// RUN: grep "declare " %t | count 6
// RUN: grep "declare " %t | grep -v "@llvm." | count 0
diff --git a/test/Driver/analyze.c b/test/Driver/analyze.c
index ff35cc5..bdbfbbf 100644
--- a/test/Driver/analyze.c
+++ b/test/Driver/analyze.c
@@ -6,4 +6,4 @@
// CHECK: "-analyze"
// CHECK: "-target-feature" "+sse"
-// CHECK: "--fmath-errno=0"
+// CHECK: "-fno-math-errno"
diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c
index c57a2b7..fe35184 100644
--- a/test/Driver/clang-translation.c
+++ b/test/Driver/clang-translation.c
@@ -5,7 +5,6 @@
// RUN: grep '"--relocation-model" "static"' %t.log
// RUN: grep '"--disable-fp-elim"' %t.log
// RUN: grep '"--unwind-tables=0"' %t.log
-// RUN: grep '"--fmath-errno=1"' %t.log
// RUN: grep '"-Os"' %t.log
// RUN: grep '"-o" .*clang-translation.*' %t.log
// RUN: grep '"--asm-verbose"' %t.log
diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c
index b18f147..3756a2f 100644
--- a/test/Driver/clang_f_opts.c
+++ b/test/Driver/clang_f_opts.c
@@ -1,10 +1,9 @@
// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2> %t
// RUN: grep -F '"-fblocks"' %t
-// RUN: grep -F '"--fmath-errno=1"' %t
// RUN: grep -F '"-fpascal-strings"' %t
// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2> %t
-// RUN: grep -F '"-fbuiltin=0"' %t
+// RUN: grep -F '"-fno-builtin"' %t
// RUN: grep -F '"-fno-common"' %t
-// RUN: grep -F '"--fmath-errno=0"' %t
+// RUN: grep -F '"-fno-math-errno"' %t
// RUN: grep -F '"-fno-show-source-location"' %t
// RUN: grep -F '"-fshort-wchar"' %t
diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c
index acf4887..522fda4 100644
--- a/test/Sema/unused-expr.c
+++ b/test/Sema/unused-expr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fmath-errno=0 %s
+// RUN: clang-cc -fsyntax-only -verify -fno-math-errno %s
int foo(int X, int Y);
diff --git a/tools/clang-cc/Options.cpp b/tools/clang-cc/Options.cpp
index 8d3caf8..34f9c4a 100644
--- a/tools/clang-cc/Options.cpp
+++ b/tools/clang-cc/Options.cpp
@@ -104,8 +104,7 @@
"symbolic constraints"));
static llvm::cl::opt<bool>
-PurgeDead("analyzer-purge-dead",
- llvm::cl::init(true),
+NoPurgeDead("analyzer-no-purge-dead",
llvm::cl::desc("Remove dead symbols, bindings, and constraints before"
" processing a statement"));
@@ -440,8 +439,8 @@
namespace langoptions {
static llvm::cl::opt<bool>
-AllowBuiltins("fbuiltin", llvm::cl::init(true),
- llvm::cl::desc("Disable implicit builtin knowledge of functions"));
+NoBuiltin("fno-builtin",
+ llvm::cl::desc("Disable implicit builtin knowledge of functions"));
static llvm::cl::opt<bool>
AltiVec("faltivec", llvm::cl::desc("Enable AltiVec vector initializer syntax"));
@@ -532,7 +531,7 @@
llvm::cl::desc("Main file name to use for debug info"));
static llvm::cl::opt<bool>
-MathErrno("fmath-errno", llvm::cl::init(true),
+NoMathErrno("fno-math-errno",
llvm::cl::desc("Require math functions to respect errno"));
static llvm::cl::opt<bool>
@@ -590,7 +589,7 @@
"string literals"));
static llvm::cl::opt<bool>
-Rtti("frtti", llvm::cl::init(true),
+NoRtti("fno-rtti",
llvm::cl::desc("Enable generation of rtti information"));
static llvm::cl::opt<bool>
@@ -786,7 +785,7 @@
Opts.VisualizeEGUbi = VisualizeEGUbi;
Opts.AnalyzeAll = AnalyzeAll;
Opts.AnalyzerDisplayProgress = AnalyzerDisplayProgress;
- Opts.PurgeDead = PurgeDead;
+ Opts.PurgeDead = !NoPurgeDead;
Opts.EagerlyAssume = EagerlyAssume;
Opts.AnalyzeSpecificFunction = AnalyzeSpecificFunction;
Opts.EnableExperimentalChecks = AnalyzerExperimentalChecks;
@@ -1224,7 +1223,7 @@
if (NoLaxVectorConversions.getPosition())
Options.LaxVectorConversions = 0;
Options.Exceptions = Exceptions;
- Options.Rtti = Rtti;
+ Options.Rtti = !NoRtti;
if (EnableBlocks.getPosition())
Options.Blocks = EnableBlocks;
if (CharIsSigned.getPosition())
@@ -1232,8 +1231,7 @@
if (ShortWChar.getPosition())
Options.ShortWChar = ShortWChar;
- if (!AllowBuiltins)
- Options.NoBuiltin = 1;
+ Options.NoBuiltin = NoBuiltin;
if (Freestanding)
Options.Freestanding = Options.NoBuiltin = 1;
@@ -1248,7 +1246,7 @@
// OpenCL and C++ both have bool, true, false keywords.
Options.Bool = Options.OpenCL | Options.CPlusPlus;
- Options.MathErrno = MathErrno;
+ Options.MathErrno = !NoMathErrno;
Options.InstantiationDepth = TemplateDepth;