summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/pp-trace/PPTrace.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/pp-trace/PPTrace.cpp')
-rw-r--r--clang-tools-extra/pp-trace/PPTrace.cpp47
1 files changed, 22 insertions, 25 deletions
diff --git a/clang-tools-extra/pp-trace/PPTrace.cpp b/clang-tools-extra/pp-trace/PPTrace.cpp
index fa9863986a8..aae6215151f 100644
--- a/clang-tools-extra/pp-trace/PPTrace.cpp
+++ b/clang-tools-extra/pp-trace/PPTrace.cpp
@@ -79,6 +79,28 @@ 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.
@@ -153,35 +175,10 @@ 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, ",",
OpenPOWER on IntegriCloud