[llvm-commits] [llvm] r74912 - /llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp

Mikhail Glushenkov foldr at codedgers.com
Tue Jul 7 09:39:35 PDT 2009


Author: foldr
Date: Tue Jul  7 11:39:33 2009
New Revision: 74912

URL: http://llvm.org/viewvc/llvm-project?rev=74912&view=rev
Log:
Show how to modify built-in options.

Sanjiv complained about the need to maintain local changes to
lib/CompilerDriver.

Modified:
    llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp

Modified: llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp?rev=74912&r1=74911&r2=74912&view=diff

==============================================================================
--- llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp (original)
+++ llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp Tue Jul  7 11:39:33 2009
@@ -7,8 +7,25 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  Just include CompilerDriver/Main.inc.
+//  Usually this file just includes CompilerDriver/Main.inc, but here we apply
+//  some trickery to make the built-in '-save-temps' option hidden and enabled
+//  by default.
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/CompilerDriver/Main.inc"
+#include "llvm/CompilerDriver/BuiltinOptions.h"
+#include "llvm/CompilerDriver/ForceLinkage.h"
+
+namespace llvmc {
+  int Main(int argc, char** argv);
+}
+
+int main(int argc, char** argv) {
+
+  // HACK
+  SaveTemps = SaveTempsEnum::Obj;
+  SaveTemps.setHiddenFlag(llvm::cl::Hidden);
+
+  llvmc::ForceLinkage();
+  return llvmc::Main(argc, argv);
+}





More information about the llvm-commits mailing list