aboutsummaryrefslogtreecommitdiff
path: root/Driver/clang.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-14 20:49:29 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-14 20:49:29 +0000
commit3573c0c0b44a1ac8f76a00af1bc75e94ca03d704 (patch)
treea73b7dbfd0dad96b6848adaf47fbb6f9a76facf7 /Driver/clang.cpp
parent19891b082be53204ec91da31aee902966508c6d8 (diff)
Add -ffreestanding to suppress the implicit declaration of library builtins like printf and malloc. Fixes PR3586
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64566 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r--Driver/clang.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 1452a61a21..2f7ce69ee3 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -209,6 +209,14 @@ InheritanceViewCls("cxx-inheritance-view",
llvm::cl::desc("View C++ inheritance for a specified class"));
//===----------------------------------------------------------------------===//
+// Builtin Options
+//===----------------------------------------------------------------------===//
+static llvm::cl::opt<bool>
+Freestanding("ffreestanding",
+ llvm::cl::desc("Assert that the compiler takes place in a "
+ "freestanding environment"));
+
+//===----------------------------------------------------------------------===//
// Analyzer Options.
//===----------------------------------------------------------------------===//
@@ -636,6 +644,9 @@ static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
if (EnableBlocks.getPosition())
Options.Blocks = EnableBlocks;
+ if (Freestanding)
+ Options.Freestanding = 1;
+
// Override the default runtime if the user requested it.
if (NeXTRuntime)
Options.NeXTRuntime = 1;