wire up a new -fno-builtin option, make it control things like simplifylibcalls,
etc and make freestanding imply it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66972 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index b33f344..6d9aaa7 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -231,6 +231,11 @@
                             "freestanding environment"));
 
 static llvm::cl::opt<bool>
+NoBuiltin("fno-builtin",
+          llvm::cl::desc("Disable implicit builtin knowledge of functions"));
+
+
+static llvm::cl::opt<bool>
 MathErrno("fmath-errno", 
           llvm::cl::desc("Require math functions to respect errno"),
           llvm::cl::init(true), llvm::cl::AllowInverse);
@@ -650,8 +655,11 @@
   if (EnableBlocks.getPosition())
     Options.Blocks = EnableBlocks;
 
+  if (NoBuiltin)
+    Options.NoBuiltin = 1;
   if (Freestanding)
-    Options.Freestanding = 1;
+    Options.Freestanding = Options.NoBuiltin = 1;
+  
   if (EnableHeinousExtensions)
     Options.HeinousExtensions = 1;
 
@@ -1195,7 +1203,7 @@
   // FIXME: There are llvm-gcc options to control these selectively.
   Opts.InlineFunctions = (Opts.OptimizationLevel > 1);
   Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !OptSize);
-  Opts.SimplifyLibCalls = !Freestanding;
+  Opts.SimplifyLibCalls = !NoBuiltin;
 
 #ifdef NDEBUG
   Opts.VerifyModule = 0;