summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-11-24 11:24:50 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-11-24 15:54:48 +0100
commit832584eae514ea9cd4b3b42f1a2e9d69a17c5160 (patch)
tree98d56079c09df88b143fa3054b4797fb38fed051 /compilerplugins
parent4bae4ebd527e9deed9e1bd1be0e4bc4506d05e6f (diff)
Clean up loplugin:unnecessaryparen blacklist
* rsc/source/parser/rscyacc.cxx no longer exists * writerfilter/source/rtftok/rtftokenizer.cxx appears to be just fine nowadays? * sw/source/filter/html/htmltab.cxx used redundant parentheses around a comma operator in a while condition, and I see no reason not to remove them (the result requires a---reasonable---tweak to loplugin:commaoperator, though) Change-Id: I451132c700b0ae5a43b03d704156484df897ad5c Reviewed-on: https://gerrit.libreoffice.org/45213 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/commaoperator.cxx8
-rw-r--r--compilerplugins/clang/test/commaoperator.cxx1
-rw-r--r--compilerplugins/clang/unnecessaryparen.cxx8
3 files changed, 9 insertions, 8 deletions
diff --git a/compilerplugins/clang/commaoperator.cxx b/compilerplugins/clang/commaoperator.cxx
index 4e8ea6153e12..0693fc83a07b 100644
--- a/compilerplugins/clang/commaoperator.cxx
+++ b/compilerplugins/clang/commaoperator.cxx
@@ -50,6 +50,14 @@ public:
return ret;
}
+ bool TraverseWhileStmt(WhileStmt * stmt) {
+ auto const saved1 = ignore1_;
+ ignore1_ = lookThroughExprWithCleanups(stmt->getCond());
+ auto const ret = RecursiveASTVisitor::TraverseWhileStmt(stmt);
+ ignore1_ = saved1;
+ return ret;
+ }
+
bool TraverseParenExpr(ParenExpr * expr) {
auto const saved1 = ignore1_;
ignore1_ = expr->getSubExpr();
diff --git a/compilerplugins/clang/test/commaoperator.cxx b/compilerplugins/clang/test/commaoperator.cxx
index 199dcf41c243..6abe963ae7a9 100644
--- a/compilerplugins/clang/test/commaoperator.cxx
+++ b/compilerplugins/clang/test/commaoperator.cxx
@@ -22,6 +22,7 @@ int main() {
S s;
(s = S(), s = S(), s = S());
for (s = S(), f(); f(); s = S(), f()) {}
+ while (s = S(), f()) {}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unnecessaryparen.cxx b/compilerplugins/clang/unnecessaryparen.cxx
index a7d3d26e6591..3a97c0d39456 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -67,14 +67,6 @@ public:
return;
if (loplugin::isSamePathname(fn, WORKDIR "/YaccTarget/idlc/source/parser.cxx"))
return;
- if (loplugin::isSamePathname(fn, WORKDIR "/YaccTarget/rsc/source/parser/rscyacc.cxx"))
- return;
-
- // TODO yuck, comma operator at work
- if (loplugin::isSamePathname(fn, SRCDIR "/writerfilter/source/rtftok/rtftokenizer.cxx"))
- return;
- if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/html/htmltab.cxx"))
- return;
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}