llvm.org GIT mirror llvm / c30598b
make all llvm tools call llvm_shutdown when they exit, static'ify some stuff. With this change, I can now move -stats to print when llvm_shutdown is called. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32250 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 12 years ago
21 changed file(s) with 94 addition(s) and 59 deletion(s). Raw diff Collapse all Expand all
1717 #include "llvm/LinkAllPasses.h"
1818 #include "llvm/Support/PassNameParser.h"
1919 #include "llvm/Support/CommandLine.h"
20 #include "llvm/Support/ManagedStatic.h"
2021 #include "llvm/Support/PluginLoader.h"
2122 #include "llvm/System/Process.h"
2223 #include "llvm/System/Signals.h"
5859 }
5960
6061 int main(int argc, char **argv) {
62 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
6163 cl::ParseCommandLineOptions(argc, argv,
6264 " LLVM automatic testcase reducer. See\nhttp://"
6365 "llvm.org/docs/CommandGuide/bugpoint.html"
2323 #include "llvm/Transforms/Scalar.h"
2424 #include "llvm/Support/CommandLine.h"
2525 #include "llvm/Support/Streams.h"
26 #include "llvm/Support/ManagedStatic.h"
2627 #include "llvm/System/Signals.h"
2728 #include
2829 #include
132133
133134
134135 int main(int argc, char **argv) {
136 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
135137 try {
136138 cl::ParseCommandLineOptions(argc, argv,
137139 " llvm .s -> .o assembler for GCC\n");
2929 #include "llvm/Transforms/Scalar.h"
3030 #include "llvm/Support/CommandLine.h"
3131 #include "llvm/Support/FileUtilities.h"
32 #include "llvm/Support/ManagedStatic.h"
3233 #include "llvm/Support/Streams.h"
3334 #include "llvm/System/Signals.h"
3435 #include "llvm/Support/SystemUtils.h"
213214 }
214215
215216 int main(int argc, char **argv, char **envp ) {
217 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
216218 cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n");
217219 sys::PrintStackTraceOnErrorSignal();
218220
2323 #include "llvm/PassManager.h"
2424 #include "llvm/Pass.h"
2525 #include "llvm/Support/CommandLine.h"
26 #include "llvm/Support/ManagedStatic.h"
2627 #include "llvm/Support/PluginLoader.h"
2728 #include "llvm/Support/FileUtilities.h"
2829 #include "llvm/Analysis/Verifier.h"
167168 // main - Entry point for the llc compiler.
168169 //
169170 int main(int argc, char **argv) {
171 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
170172 try {
171173 cl::ParseCommandLineOptions(argc, argv, " llvm system compiler\n");
172174 sys::PrintStackTraceOnErrorSignal();
2121 #include "llvm/ExecutionEngine/Interpreter.h"
2222 #include "llvm/ExecutionEngine/GenericValue.h"
2323 #include "llvm/Support/CommandLine.h"
24 #include "llvm/Support/ManagedStatic.h"
2425 #include "llvm/Support/PluginLoader.h"
2526 #include "llvm/System/Process.h"
2627 #include "llvm/System/Signals.h"
5556 // main Driver function
5657 //
5758 int main(int argc, char **argv, char * const *envp) {
59 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
5860 try {
5961 cl::ParseCommandLineOptions(argc, argv,
6062 " llvm interpreter & dynamic compiler\n");
1515 #include "llvm/Bytecode/Archive.h"
1616 #include "llvm/Support/CommandLine.h"
1717 #include "llvm/Support/Compressor.h"
18 #include "llvm/Support/ManagedStatic.h"
1819 #include "llvm/System/Signals.h"
1920 #include
2021 #include
2122 #include
2223 #include
23
2424 using namespace llvm;
2525
2626 // Option for compatibility with ASIX, not used but must allow it to be present.
695695
696696 // main - main program for llvm-ar .. see comments in the code
697697 int main(int argc, char **argv) {
698 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
698699
699700 // Have the command line options parsed and handle things
700701 // like --help and --version.
1919 #include "llvm/Bytecode/Writer.h"
2020 #include "llvm/Analysis/Verifier.h"
2121 #include "llvm/Support/CommandLine.h"
22 #include "llvm/Support/ManagedStatic.h"
2223 #include "llvm/Support/Streams.h"
2324 #include "llvm/Support/SystemUtils.h"
2425 #include "llvm/System/Signals.h"
4950 cl::desc("Do not run verifier on input LLVM (dangerous!)"));
5051
5152 int main(int argc, char **argv) {
53 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
5254 cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n");
5355 sys::PrintStackTraceOnErrorSignal();
5456
3131 #include "llvm/Analysis/Verifier.h"
3232 #include "llvm/Bytecode/Analyzer.h"
3333 #include "llvm/Support/CommandLine.h"
34 #include "llvm/Support/ManagedStatic.h"
3435 #include "llvm/System/Signals.h"
3536 #include
3637 #include
4748 static cl::opt Dump ("dump", cl::desc("Dump low level bytecode trace"));
4849 static cl::opt Verify ("verify", cl::desc("Progressively verify module"));
4950
50 int
51 main(int argc, char **argv) {
51 int main(int argc, char **argv) {
52 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
5253 try {
5354 cl::ParseCommandLineOptions(argc, argv,
5455 " llvm-bcanalyzer Analysis of ByteCode Dumper\n");
1313
1414 #include "CLIDebugger.h"
1515 #include "llvm/Support/CommandLine.h"
16 #include "llvm/Support/ManagedStatic.h"
1617 #include "llvm/System/Signals.h"
1718 #include
18
1919 using namespace llvm;
2020
2121 namespace {
4848 // main Driver function
4949 //
5050 int main(int argc, char **argv, char * const *envp) {
51 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
5152 std::cout << "NOTE: llvm-db is known useless right now.\n";
5253 try {
5354 cl::ParseCommandLineOptions(argc, argv,
2020 #include "llvm/Bytecode/Reader.h"
2121 #include "llvm/Assembly/PrintModulePass.h"
2222 #include "llvm/Support/CommandLine.h"
23 #include "llvm/Support/ManagedStatic.h"
2324 #include "llvm/Support/Streams.h"
2425 #include "llvm/System/Signals.h"
2526 #include
3839 Force("f", cl::desc("Overwrite output files"));
3940
4041 int main(int argc, char **argv) {
42 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
4143 try {
4244 cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
4345 sys::PrintStackTraceOnErrorSignal();
114116 } catch (...) {
115117 llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n";
116118 }
119
117120 return 1;
118121 }
119122
1818 #include "llvm/Transforms/IPO.h"
1919 #include "llvm/Target/TargetData.h"
2020 #include "llvm/Support/CommandLine.h"
21 #include "llvm/Support/ManagedStatic.h"
2122 #include "llvm/Support/Streams.h"
2223 #include "llvm/System/Signals.h"
2324 #include
4647 cl::value_desc("function"));
4748
4849 int main(int argc, char **argv) {
50 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
4951 try {
5052 cl::ParseCommandLineOptions(argc, argv, " llvm extractor\n");
5153 sys::PrintStackTraceOnErrorSignal();
3131 #include "llvm/Target/TargetMachineRegistry.h"
3232 #include "llvm/Support/CommandLine.h"
3333 #include "llvm/Support/FileUtilities.h"
34 #include "llvm/Support/ManagedStatic.h"
3435 #include "llvm/Support/Streams.h"
3536 #include "llvm/Support/SystemUtils.h"
3637 #include "llvm/System/Signals.h"
432433 }
433434
434435 int main(int argc, char **argv, char **envp) {
436 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
435437 try {
436438 // Initial global variable above for convenience printing of program name.
437439 progname = sys::Path(argv[0]).getBasename();
1717 #include "llvm/Bytecode/Reader.h"
1818 #include "llvm/Bytecode/Writer.h"
1919 #include "llvm/Support/CommandLine.h"
20 #include "llvm/Support/ManagedStatic.h"
2021 #include "llvm/Support/Streams.h"
2122 #include "llvm/System/Signals.h"
2223 #include "llvm/System/Path.h"
7475 }
7576
7677 int main(int argc, char **argv) {
78 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
7779 try {
7880 cl::ParseCommandLineOptions(argc, argv, " llvm linker\n");
7981 sys::PrintStackTraceOnErrorSignal();
1919 #include "llvm/Bytecode/Reader.h"
2020 #include "llvm/Bytecode/Archive.h"
2121 #include "llvm/Support/CommandLine.h"
22 #include "llvm/Support/ManagedStatic.h"
2223 #include "llvm/System/Signals.h"
2324 #include
2425 #include
6465 std::string ToolName;
6566 }
6667
67 char TypeCharForSymbol (GlobalValue &GV) {
68 if (GV.isExternal ()) return 'U';
69 if (GV.hasLinkOnceLinkage ()) return 'C';
70 if (GV.hasWeakLinkage ()) return 'W';
71 if (isa (GV) && GV.hasInternalLinkage ()) return 't';
72 if (isa (GV)) return 'T';
73 if (isa (GV) && GV.hasInternalLinkage ()) return 'd';
74 if (isa (GV)) return 'D';
68 static char TypeCharForSymbol(GlobalValue &GV) {
69 if (GV.isExternal()) return 'U';
70 if (GV.hasLinkOnceLinkage()) return 'C';
71 if (GV.hasWeakLinkage()) return 'W';
72 if (isa(GV) && GV.hasInternalLinkage()) return 't';
73 if (isa(GV)) return 'T';
74 if (isa(GV) && GV.hasInternalLinkage()) return 'd';
75 if (isa(GV)) return 'D';
7576 return '?';
7677 }
7778
78 void DumpSymbolNameForGlobalValue (GlobalValue &GV) {
79 static void DumpSymbolNameForGlobalValue(GlobalValue &GV) {
7980 const std::string SymbolAddrStr = " "; // Not used yet...
8081 char TypeChar = TypeCharForSymbol (GV);
8182 if ((TypeChar != 'U') && UndefinedOnly)
100101 }
101102 }
102103
103 void DumpSymbolNamesFromModule (Module *M) {
104 static void DumpSymbolNamesFromModule(Module *M) {
104105 const std::string &Filename = M->getModuleIdentifier ();
105106 if (OutputFormat == posix && MultipleFiles) {
106107 std::cout << Filename << ":\n";
115116 std::for_each (M->global_begin (), M->global_end (), DumpSymbolNameForGlobalValue);
116117 }
117118
118 void DumpSymbolNamesFromFile (std::string &Filename) {
119 static void DumpSymbolNamesFromFile(std::string &Filename) {
119120 std::string ErrorMessage;
120121 sys::Path aPath(Filename);
121122 if (Filename != "-") {
134135 }
135136 } else if (aPath.isArchive()) {
136137 std::string ErrMsg;
137 Archive* archive = Archive::OpenAndLoad(sys::Path(Filename),&ErrorMessage);
138 Archive* archive = Archive::OpenAndLoad(sys::Path(Filename), &ErrorMessage);
138139 if (!archive)
139140 std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
140141 std::vector Modules;
141 if (archive->getAllModules(Modules,&ErrorMessage)) {
142 if (archive->getAllModules(Modules, &ErrorMessage)) {
142143 std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
143144 return;
144145 }
145146 MultipleFiles = true;
146 std::for_each (Modules.begin (), Modules.end (), DumpSymbolNamesFromModule);
147 std::for_each (Modules.begin(), Modules.end(), DumpSymbolNamesFromModule);
147148 } else {
148149 std::cerr << ToolName << ": " << Filename << ": "
149150 << "unrecognizable file type\n";
152153 }
153154
154155 int main(int argc, char **argv) {
156 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
155157 try {
156158 cl::ParseCommandLineOptions(argc, argv, " llvm symbol table dumper\n");
157159 sys::PrintStackTraceOnErrorSignal();
1818 #include "llvm/Analysis/ProfileInfoLoader.h"
1919 #include "llvm/Bytecode/Reader.h"
2020 #include "llvm/Support/CommandLine.h"
21 #include "llvm/Support/ManagedStatic.h"
2122 #include "llvm/System/Signals.h"
2223 #include
2324 #include
106107
107108
108109 int main(int argc, char **argv) {
110 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
109111 try {
110112 cl::ParseCommandLineOptions(argc, argv, " llvm profile dump decoder\n");
111113 sys::PrintStackTraceOnErrorSignal();
1313 #include "llvm/Module.h"
1414 #include "llvm/Bytecode/Archive.h"
1515 #include "llvm/Support/CommandLine.h"
16 #include "llvm/Support/ManagedStatic.h"
1617 #include "llvm/System/Signals.h"
1718 #include
1819 #include
4041 }
4142
4243 int main(int argc, char **argv) {
44 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
4345
4446 // Have the command line options parsed and handle things
4547 // like --help and --version.
2020
2121 #include "ParserInternals.h"
2222 #include "llvm/Support/CommandLine.h"
23 #include "llvm/Support/ManagedStatic.h"
2324 #include "llvm/Support/Streams.h"
2425 #include "llvm/Support/SystemUtils.h"
2526 #include "llvm/System/Signals.h"
4344 cl::init(false));
4445
4546 int main(int argc, char **argv) {
47 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
4648 cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n");
4749 sys::PrintStackTraceOnErrorSignal();
4850
1919 #include "llvm/Instructions.h"
2020 #include "llvm/Module.h"
2121 #include "llvm/SymbolTable.h"
22 #include "llvm/Support/CFG.h"
2322 #include "llvm/ADT/StringExtras.h"
2423 #include "llvm/ADT/STLExtras.h"
24 #include "llvm/Support/CommandLine.h"
25 #include "llvm/Support/CFG.h"
26 #include "llvm/Support/ManagedStatic.h"
2527 #include "llvm/Support/MathExtras.h"
26 #include "llvm/Support/CommandLine.h"
2728 #include "llvm/Config/config.h"
2829 #include
2930 #include
1919 #include "llvm/Bytecode/Reader.h"
2020 #include "llvm/Analysis/Verifier.h"
2121 #include "llvm/Support/CommandLine.h"
22 #include "llvm/Support/ManagedStatic.h"
2223 #include "llvm/Support/SystemUtils.h"
2324 #include "llvm/System/Signals.h"
2425 #include "CppWriter.h"
4041 Force("f", cl::desc("Overwrite output files"));
4142
4243 int main(int argc, char **argv) {
44 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
4345 cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .cpp assembler\n");
4446 sys::PrintStackTraceOnErrorSignal();
4547
1616 #include "CompilerDriver.h"
1717 #include "Configuration.h"
1818 #include "llvm/Pass.h"
19 #include "llvm/Support/CommandLine.h"
20 #include "llvm/Support/ManagedStatic.h"
1921 #include "llvm/System/Signals.h"
20 #include "llvm/Support/CommandLine.h"
2122 #include
22
2323 using namespace llvm;
2424
25 namespace {
2625 //===----------------------------------------------------------------------===//
2726 //=== PHASE OPTIONS
2827 //===----------------------------------------------------------------------===//
29 cl::opt FinalPhase(cl::Optional,
28 static cl::opt FinalPhase(cl::Optional,
3029 cl::desc("Choose final phase of compilation:"),
3130 cl::init(CompilerDriver::LINKING),
3231 cl::values(
4544 //===----------------------------------------------------------------------===//
4645 //=== OPTIMIZATION OPTIONS
4746 //===----------------------------------------------------------------------===//
48 cl::opt OptLevel(cl::ZeroOrMore,
47 static cl::opt OptLevel(cl::ZeroOrMore,
4948 cl::desc("Choose level of optimization to apply:"),
5049 cl::init(CompilerDriver::OPT_FAST_COMPILE),
5150 cl::values(
6968 //=== TOOL OPTIONS
7069 //===----------------------------------------------------------------------===//
7170
72 cl::list PreprocessorToolOpts("Tpre", cl::ZeroOrMore,
71 static cl::list PreprocessorToolOpts("Tpre", cl::ZeroOrMore,
7372 cl::desc("Pass specific options to the pre-processor"),
7473 cl::value_desc("option"));
7574
76 cl::alias PreprocessorToolOptsAlias("Wp,", cl::ZeroOrMore,
75 static cl::alias PreprocessorToolOptsAlias("Wp,", cl::ZeroOrMore,
7776 cl::desc("Alias for -Tpre"), cl::aliasopt(PreprocessorToolOpts));
7877
79 cl::list TranslatorToolOpts("Ttrn", cl::ZeroOrMore,
78 static cl::list TranslatorToolOpts("Ttrn", cl::ZeroOrMore,
8079 cl::desc("Pass specific options to the assembler"),
8180 cl::value_desc("option"));
8281
83 cl::list AssemblerToolOpts("Tasm", cl::ZeroOrMore,
82 static cl::list AssemblerToolOpts("Tasm", cl::ZeroOrMore,
8483 cl::desc("Pass specific options to the assembler"),
8584 cl::value_desc("option"));
8685
87 cl::alias AssemblerToolOptsAlias("Wa,", cl::ZeroOrMore,
86 static cl::alias AssemblerToolOptsAlias("Wa,", cl::ZeroOrMore,
8887 cl::desc("Alias for -Tasm"), cl::aliasopt(AssemblerToolOpts));
8988
90 cl::list OptimizerToolOpts("Topt", cl::ZeroOrMore,
89 static cl::list OptimizerToolOpts("Topt", cl::ZeroOrMore,
9190 cl::desc("Pass specific options to the optimizer"),
9291 cl::value_desc("option"));
9392
94 cl::list LinkerToolOpts("Tlnk", cl::ZeroOrMore,
93 static cl::list LinkerToolOpts("Tlnk", cl::ZeroOrMore,
9594 cl::desc("Pass specific options to the linker"),
9695 cl::value_desc("option"));
9796
98 cl::alias LinkerToolOptsAlias("Wl,", cl::ZeroOrMore,
97 static cl::alias LinkerToolOptsAlias("Wl,", cl::ZeroOrMore,
9998 cl::desc("Alias for -Tlnk"), cl::aliasopt(LinkerToolOpts));
10099
101 cl::list fOpts("f", cl::ZeroOrMore, cl::Prefix,
100 static cl::list fOpts("f", cl::ZeroOrMore, cl::Prefix,
102101 cl::desc("Pass through -f options to compiler tools"),
103102 cl::value_desc("option"));
104103
105 cl::list MOpts("M", cl::ZeroOrMore, cl::Prefix,
104 static cl::list MOpts("M", cl::ZeroOrMore, cl::Prefix,
106105 cl::desc("Pass through -M options to compiler tools"),
107106 cl::value_desc("option"));
108107
109 cl::list WOpts("W", cl::ZeroOrMore, cl::Prefix,
108 static cl::list WOpts("W", cl::ZeroOrMore, cl::Prefix,
110109 cl::desc("Pass through -W options to compiler tools"),
111110 cl::value_desc("option"));
112111
113 cl::list BOpt("B", cl::ZeroOrMore, cl::Prefix,
112 static cl::list BOpt("B", cl::ZeroOrMore, cl::Prefix,
114113 cl::desc("Specify path to find llvmc sub-tools"),
115114 cl::value_desc("dir"));
116115
118117 //=== INPUT OPTIONS
119118 //===----------------------------------------------------------------------===//
120119
121 cl::list LibPaths("L", cl::Prefix,
120 static cl::list LibPaths("L", cl::Prefix,
122121 cl::desc("Specify a library search path"), cl::value_desc("dir"));
123122
124 cl::list Libraries("l", cl::Prefix,
123 static cl::list Libraries("l", cl::Prefix,
125124 cl::desc("Specify base name of libraries to link to"), cl::value_desc("lib"));
126125
127 cl::list Includes("I", cl::Prefix,
126 static cl::list Includes("I", cl::Prefix,
128127 cl::desc("Specify location to search for included source"),
129128 cl::value_desc("dir"));
130129
131 cl::list Defines("D", cl::Prefix,
130 static cl::list Defines("D", cl::Prefix,
132131 cl::desc("Specify a pre-processor symbol to define"),
133132 cl::value_desc("symbol"));
134133
136135 //=== OUTPUT OPTIONS
137136 //===----------------------------------------------------------------------===//
138137
139 cl::opt OutputFilename("o",
138 static cl::opt OutputFilename("o",
140139 cl::desc("Override output filename"), cl::value_desc("file"));
141140
142 cl::opt OutputMachine("m", cl::Prefix,
141 static cl::opt OutputMachine("m", cl::Prefix,
143142 cl::desc("Specify a target machine"), cl::value_desc("machine"));
144143
145 cl::opt Native("native", cl::init(false),
144 static cl::opt Native("native", cl::init(false),
146145 cl::desc("Generative native code instead of bytecode"));
147146
148 cl::opt DebugOutput("g", cl::init(false),
147 static cl::opt DebugOutput("g", cl::init(false),
149148 cl::desc("Generate objects that include debug symbols"));
150149
151 cl::opt StripOutput("strip", cl::init(false),
150 static cl::opt StripOutput("strip", cl::init(false),
152151 cl::desc("Strip all symbols from linked output file"));
153152
154 cl::opt PrintFileName("print-fname", cl::Optional,
153 static cl::opt PrintFileName("print-fname", cl::Optional,
155154 cl::value_desc("file"),
156155 cl::desc("Print the full path for the option's value"));
157156
159158 //=== INFORMATION OPTIONS
160159 //===----------------------------------------------------------------------===//
161160
162 cl::opt DryRun("dry-run", cl::Optional, cl::init(false),
161 static cl::opt DryRun("dry-run", cl::Optional, cl::init(false),
163162 cl::desc("Do everything but perform the compilation actions"));
164163
165 cl::alias DryRunAlias("y", cl::Optional,
164 static cl::alias DryRunAlias("y", cl::Optional,
166165 cl::desc("Alias for -dry-run"), cl::aliasopt(DryRun));
167166
168 cl::opt Verbose("verbose", cl::Optional, cl::init(false),
167 static cl::opt Verbose("verbose", cl::Optional, cl::init(false),
169168 cl::desc("Print out each action taken"));
170169
171 cl::alias VerboseAlias("v", cl::Optional,
170 static cl::alias VerboseAlias("v", cl::Optional,
172171 cl::desc("Alias for -verbose"), cl::aliasopt(Verbose));
173172
174 cl::opt Debug("debug", cl::Optional, cl::init(false),
173 static cl::opt Debug("debug", cl::Optional, cl::init(false),
175174 cl::Hidden, cl::desc("Print out debugging information"));
176175
177 cl::alias DebugAlias("d", cl::Optional,
176 static cl::alias DebugAlias("d", cl::Optional,
178177 cl::desc("Alias for -debug"), cl::aliasopt(Debug));
179178
180 cl::opt TimeActions("time-actions", cl::Optional, cl::init(false),
179 static cl::opt TimeActions("time-actions", cl::Optional, cl::init(false),
181180 cl::desc("Print execution time for each action taken"));
182181
183 cl::opt ShowStats("stats", cl::Optional, cl::init(false),
182 static cl::opt ShowStats("stats", cl::Optional, cl::init(false),
184183 cl::desc("Print statistics accumulated during optimization"));
185184
186185 //===----------------------------------------------------------------------===//
214213 //===----------------------------------------------------------------------===//
215214 //=== GetFileType - determine type of a file
216215 //===----------------------------------------------------------------------===//
217 const std::string GetFileType(const std::string& fname, unsigned pos) {
216 static const std::string GetFileType(const std::string& fname, unsigned pos) {
218217 static std::vector::iterator langIt = Languages.begin();
219218 static std::string CurrLang = "";
220219
235234 return fname.substr(fname.rfind('.', fname.size()) + 1);
236235 }
237236
238 } // end anonymous namespace
239
240 void handleTerminatingOptions(CompilerDriver* CD) {
237 static void handleTerminatingOptions(CompilerDriver* CD) {
241238 if (!PrintFileName.empty()) {
242239 sys::Path path = CD->GetPathForLinkageItem(PrintFileName, false);
243240 std::string p = path.toString();
251248
252249 /// @brief The main program for llvmc
253250 int main(int argc, char **argv) {
251 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
254252 // Make sure we print stack trace if we get bad signals
255253 sys::PrintStackTraceOnErrorSignal();
256254
2121 #include "llvm/Target/TargetMachine.h"
2222 #include "llvm/Support/PassNameParser.h"
2323 #include "llvm/System/Signals.h"
24 #include "llvm/Support/ManagedStatic.h"
2425 #include "llvm/Support/PluginLoader.h"
2526 #include "llvm/Support/Streams.h"
2627 #include "llvm/Support/SystemUtils.h"
155156 // main for opt
156157 //
157158 int main(int argc, char **argv) {
159 llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
158160 try {
159161 cl::ParseCommandLineOptions(argc, argv,
160162 " llvm .bc -> .bc modular optimizer and analysis printer \n");