summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/ArgumentsAdjusters.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2013-06-06 11:52:19 +0000
committerPavel Labath <labath@google.com>2013-06-06 11:52:19 +0000
commitdee20c105b392d207d02871994f9fafd72fdf91b (patch)
tree8d2c9fd480593ac8ca9062afc45b9320ca62d19a /clang/lib/Tooling/ArgumentsAdjusters.cpp
parentde229235b979e030b2d9dd1402f40d29e21571ad (diff)
downloadbcm5719-llvm-dee20c105b392d207d02871994f9fafd72fdf91b.tar.gz
bcm5719-llvm-dee20c105b392d207d02871994f9fafd72fdf91b.zip
ClangTool: strip -o from the command line
Summary: This patch creates a new ArgumentsAdjuster, which removes all -o parameters from the command line. This adjuster is inserted by default into the ClangTool pipeline. Reviewers: klimek CC: cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D925 llvm-svn: 183398
Diffstat (limited to 'clang/lib/Tooling/ArgumentsAdjusters.cpp')
-rw-r--r--clang/lib/Tooling/ArgumentsAdjusters.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/Tooling/ArgumentsAdjusters.cpp b/clang/lib/Tooling/ArgumentsAdjusters.cpp
index c44b20dd5a8..a69971e006e 100644
--- a/clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ b/clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -37,6 +37,23 @@ ClangSyntaxOnlyAdjuster::Adjust(const CommandLineArguments &Args) {
return AdjustedArgs;
}
+CommandLineArguments
+ClangStripOutputAdjuster::Adjust(const CommandLineArguments &Args) {
+ CommandLineArguments AdjustedArgs;
+ for (size_t i = 0, e = Args.size(); i < e; ++i) {
+ StringRef Arg = Args[i];
+ if(!Arg.startswith("-o"))
+ AdjustedArgs.push_back(Args[i]);
+
+ if(Arg == "-o") {
+ // Output is specified as -o foo. Skip the next argument also.
+ ++i;
+ }
+ // Else, the output is specified as -ofoo. Just do nothing.
+ }
+ return AdjustedArgs;
+}
+
} // end namespace tooling
} // end namespace clang
OpenPOWER on IntegriCloud