diff options
author | Adrian Prantl <aprantl@apple.com> | 2015-02-25 01:32:04 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2015-02-25 01:32:04 +0000 |
commit | 5f18daafdc54f1a292c9dae73c93caf05a1e6bdd (patch) | |
tree | 89562a83d48bae9a75e9e312b140a64927d3b7df /pp-trace | |
parent | e7cb6571eaf61970bc0384256143b1a755d13c04 (diff) |
Adapt clang-tools-extra to clang module format changes.
- add clangCodeGen.a to the tools that need it
- tweak pp-trace command line handling to not conflict with clang's.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@230424 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'pp-trace')
-rw-r--r-- | pp-trace/Makefile | 6 | ||||
-rw-r--r-- | pp-trace/PPTrace.cpp | 47 |
2 files changed, 29 insertions, 24 deletions
diff --git a/pp-trace/Makefile b/pp-trace/Makefile index 3467ecb3..81bcb302 100644 --- a/pp-trace/Makefile +++ b/pp-trace/Makefile @@ -14,8 +14,10 @@ TOOLNAME = pp-trace # No plugins, optimize startup time. TOOL_NO_EXPORTS = 1 -LINK_COMPONENTS := mcparser bitreader support mc option TransformUtils -USEDLIBS = clangFrontend.a clangSerialization.a clangDriver.a \ +include $(CLANG_LEVEL)/../../Makefile.config +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader ipo objcarcopts \ + instrumentation bitwriter support mc option +USEDLIBS = clangFrontend.a clangCodeGen.a clangSerialization.a clangDriver.a \ clangTooling.a clangParse.a clangSema.a clangAnalysis.a \ clangEdit.a clangAST.a clangLex.a clangBasic.a diff --git a/pp-trace/PPTrace.cpp b/pp-trace/PPTrace.cpp index aae62151..fa986398 100644 --- a/pp-trace/PPTrace.cpp +++ b/pp-trace/PPTrace.cpp @@ -79,28 +79,6 @@ using namespace clang::tooling; using namespace llvm; using namespace llvm::opt; -// Options: - -// Collect the source files. -cl::list<std::string> SourcePaths(cl::Positional, - cl::desc("<source0> [... <sourceN>]"), - cl::OneOrMore); - -// Option to specify a list or one or more callback names to ignore. -cl::opt<std::string> IgnoreCallbacks( - "ignore", cl::init(""), - cl::desc("Ignore callbacks, i.e. \"Callback1, Callback2...\".")); - -// Option to specify the trace output file name. -cl::opt<std::string> OutputFileName( - "output", cl::init(""), - cl::desc("Output trace to the given file name or '-' for stdout.")); - -// Collect all other arguments, which will be passed to the front end. -cl::list<std::string> -CC1Arguments(cl::ConsumeAfter, - cl::desc("<arguments to be passed to front end>...")); - // Frontend action stuff: // Consumer is responsible for setting up the callbacks. @@ -175,10 +153,35 @@ int outputPPTrace(std::vector<CallbackCall> &CallbackCalls, // Program entry point. int main(int Argc, const char **Argv) { + // Collect the source files. + cl::list<std::string> SourcePaths(cl::Positional, + cl::desc("<source0> [... <sourceN>]"), + cl::OneOrMore); + + // Option to specify a list or one or more callback names to ignore. + cl::opt<std::string> IgnoreCallbacks( + "ignore", cl::init(""), + cl::desc("Ignore callbacks, i.e. \"Callback1, Callback2...\".")); + + // Option to specify the trace output file name. + cl::opt<std::string> OutputFileName( + "output", cl::init(""), + cl::desc("Output trace to the given file name or '-' for stdout.")); + // Collect all other arguments, which will be passed to the front end. + cl::list<std::string> + CC1Arguments(cl::ConsumeAfter, + cl::desc("<arguments to be passed to front end>...")); // Parse command line. cl::ParseCommandLineOptions(Argc, Argv, "pp-trace.\n"); + // Unregister our options so they don't interfere with the command line + // parsing in CodeGen/BackendUtil.cpp. + CC1Arguments.removeArgument(); + OutputFileName.removeArgument(); + IgnoreCallbacks.removeArgument(); + SourcePaths.removeArgument(); + // Parse the IgnoreCallbacks list into strings. SmallVector<StringRef, 32> IgnoreCallbacksStrings; StringRef(IgnoreCallbacks).split(IgnoreCallbacksStrings, ",", |