summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-17 10:34:58 +0200
committerNoel Grandin <noel@peralex.com>2015-07-17 10:36:50 +0200
commit89ef4dea325a11c706ff9619ff4717124260f864 (patch)
treee174f40d127b6e334b3c24d331f31c7c30fb1876 /compilerplugins
parent956cb1f777db6eb4cec6fc4c4ed3b2fc87ee1672 (diff)
loplugin:unusedmethods cui
Change-Id: I8a4cb855054c487d7a8307ad219f10b06db3248b
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedmethodsremove.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/compilerplugins/clang/unusedmethodsremove.cxx b/compilerplugins/clang/unusedmethodsremove.cxx
index 01b71b1cbad3..758b8a107c14 100644
--- a/compilerplugins/clang/unusedmethodsremove.cxx
+++ b/compilerplugins/clang/unusedmethodsremove.cxx
@@ -121,11 +121,16 @@ bool UnusedMethodsRemove::VisitCXXMethodDecl( const CXXMethodDecl* functionDecl
if(!(found < mmappedData + mmapFilesize)) {
return true;
}
- // sometimes the declaration has a semicolon just after it, and it's much neater to remove that too.
SourceRange replaceRange(functionDecl->getSourceRange());
+ // sometimes the declaration has a semicolon just after it, and it's much neater to remove that too.
if (rewriter->getRewrittenText(SourceRange(replaceRange.getEnd(), replaceRange.getEnd().getLocWithOffset(1))) == ";") {
replaceRange.setEnd(replaceRange.getEnd().getLocWithOffset(1));
}
+ // remove leading spaces
+ while (rewriter->getRewrittenText(SourceRange(replaceRange.getBegin().getLocWithOffset(-1), replaceRange.getBegin())) == " ")
+ {
+ replaceRange.setBegin(replaceRange.getBegin().getLocWithOffset(-1));
+ }
if (!replaceText(replaceRange, "")) {
report(
DiagnosticsEngine::Warning,