Silence -Wunused-variable in release builds.
[llvm/stm8.git] / tools / llvmc / examples / mcc16 / Main.cpp
blob5d4992dd9ce725007b6b5fa8ec393009a8ca28f3
1 //===--- Main.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open
6 // Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Usually this file just includes CompilerDriver/Main.inc, but here we apply
11 // some trickery to make the built-in '-save-temps' option hidden and enable
12 // '--temp-dir' by default.
14 //===----------------------------------------------------------------------===//
16 #include "llvm/CompilerDriver/BuiltinOptions.h"
17 #include "llvm/CompilerDriver/Main.h"
19 #include "llvm/Support/Path.h"
20 #include "llvm/Config/config.h"
22 #include <iostream>
24 #include "PIC16.inc"
26 namespace {
28 // Modify the PACKAGE_VERSION to use build number in top level configure file.
29 void PIC16VersionPrinter(void) {
30 std::cout << "MPLAB C16 1.0 " << PACKAGE_VERSION << "\n";
35 int main(int argc, char** argv) {
37 // HACK
38 SaveTemps.setHiddenFlag(llvm::cl::Hidden);
39 TempDirname.setHiddenFlag(llvm::cl::Hidden);
40 Languages.setHiddenFlag(llvm::cl::Hidden);
41 DryRun.setHiddenFlag(llvm::cl::Hidden);
43 llvm::cl::SetVersionPrinter(PIC16VersionPrinter);
45 // Ask for a standard temp dir, but just cache its basename., and delete it.
46 llvm::sys::Path tempDir;
47 tempDir = llvm::sys::Path::GetTemporaryDirectory();
48 TempDirname = tempDir.getBasename();
49 tempDir.eraseFromDisk(true);
51 // We are creating a temp dir in current dir, with the cached name.
52 // But before that remove if one already exists with that name..
53 tempDir = TempDirname;
54 tempDir.eraseFromDisk(true);
56 return llvmc::Main(argc, argv);