summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/literaltoboolconversion.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-25 15:37:53 +0200
committerNoel Grandin <noel@peralex.com>2015-03-27 10:51:08 +0200
commitc4a9241f72e3b7bf84eaadc51dbaa2accc7b920c (patch)
treec3037d10c40adf45ea32138783c476fce2459abd /compilerplugins/clang/literaltoboolconversion.cxx
parent17551216cc6843e8dcdf84bd8f9735d1c7fb145c (diff)
new clang plugin: staticmethods
Genius suggestion from Tor Lillqvist, write a clang plugin that finds methods that can be static. Change-Id: Ie6684cc95d088e8750b300a028b49f763da00345
Diffstat (limited to 'compilerplugins/clang/literaltoboolconversion.cxx')
-rw-r--r--compilerplugins/clang/literaltoboolconversion.cxx15
1 files changed, 1 insertions, 14 deletions
diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx
index 65fe53cdcfba..00ecdd8045c1 100644
--- a/compilerplugins/clang/literaltoboolconversion.cxx
+++ b/compilerplugins/clang/literaltoboolconversion.cxx
@@ -29,8 +29,6 @@ public:
private:
bool isFromCIncludeFile(SourceLocation spellingLocation) const;
-
- bool isMacroBodyExpansion(SourceLocation location) const;
};
bool LiteralToBoolConversion::VisitImplicitCastExpr(
@@ -64,7 +62,7 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr(
while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
}
- if (isMacroBodyExpansion(loc)) {
+ if (isMacroBodyExpansion(compiler, loc)) {
StringRef name { Lexer::getImmediateMacroName(
loc, compiler.getSourceManager(), compiler.getLangOpts()) };
if (name == "sal_False" || name == "sal_True") {
@@ -166,17 +164,6 @@ bool LiteralToBoolConversion::isFromCIncludeFile(
.endswith(".h"));
}
-bool LiteralToBoolConversion::isMacroBodyExpansion(SourceLocation location)
- const
-{
-#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3
- return compiler.getSourceManager().isMacroBodyExpansion(location);
-#else
- return location.isMacroID()
- && !compiler.getSourceManager().isMacroArgExpansion(location);
-#endif
-}
-
loplugin::Plugin::Registration<LiteralToBoolConversion> X(
"literaltoboolconversion", true);