diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-04-29 04:37:03 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-04-29 04:37:03 +0000 |
| commit | d796c18d7b7591e8377094cb247c68f44ad7f2d2 (patch) | |
| tree | f7b366be889e10b1755326805aa7aa00fcba895f /clang/Driver/clang.cpp | |
| parent | f9a49c4322d6a3371cc28c954aabfc6c2b2c0028 (diff) | |
| download | bcm5719-llvm-d796c18d7b7591e8377094cb247c68f44ad7f2d2.tar.gz bcm5719-llvm-d796c18d7b7591e8377094cb247c68f44ad7f2d2.zip | |
Add -fobjc-gc and -fobjc-gc-only options to the driver.
Add corresponding enum in LangOptions.
llvm-svn: 50387
Diffstat (limited to 'clang/Driver/clang.cpp')
| -rw-r--r-- | clang/Driver/clang.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/clang/Driver/clang.cpp b/clang/Driver/clang.cpp index f077952ea21..0b9841687b6 100644 --- a/clang/Driver/clang.cpp +++ b/clang/Driver/clang.cpp @@ -283,7 +283,7 @@ static void InitializeLangOptions(LangOptions &Options, LangKind LK) { NoPreprocess = true; // FALLTHROUGH case langkind_objc: - Options.ObjC1 = Options.ObjC2 = 1; + Options.ObjC1 = Options.ObjC2 = 1; break; case langkind_objcxx_cpp: NoPreprocess = true; @@ -358,6 +358,7 @@ LaxVectorConversions("flax-vector-conversions", llvm::cl::desc("Allow implicit conversions between vectors" " with a different number of elements or " "different element types.")); + // FIXME: add: // -ansi // -trigraphs @@ -425,6 +426,23 @@ static void InitializeLanguageStandard(LangOptions &Options, LangKind LK) { Options.LaxVectorConversions = LaxVectorConversions; } +static llvm::cl::opt<bool> +ObjCExclusiveGC("fobjc-gc-only", + llvm::cl::desc("Use GC exclusively for Objective-C related " + "memory management.")); + +static llvm::cl::opt<bool> +ObjCEnableGC("fobjc-gc", + llvm::cl::desc("Enable Objective-C garbage collection.")); + +void InitializeGCMode(LangOptions &Options) { + if (ObjCExclusiveGC) + Options.setGCMode(LangOptions::GCOnly); + else if (ObjCEnableGC) + Options.setGCMode(LangOptions::HybridGC); +} + + //===----------------------------------------------------------------------===// // Our DiagnosticClient implementation //===----------------------------------------------------------------------===// @@ -1399,6 +1417,7 @@ int main(int argc, char **argv) { LangKind LK = GetLanguage(InFile); InitializeLangOptions(LangInfo, LK); InitializeLanguageStandard(LangInfo, LK); + InitializeGCMode(LangInfo); // Process the -I options and set them in the HeaderInfo. HeaderSearch HeaderInfo(FileMgr); |

