diff options
Diffstat (limited to 'compilerplugins/clang/consttobool.cxx')
-rw-r--r-- | compilerplugins/clang/consttobool.cxx | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/compilerplugins/clang/consttobool.cxx b/compilerplugins/clang/consttobool.cxx index 4f4755cd8c3c..124ab4efbaaa 100644 --- a/compilerplugins/clang/consttobool.cxx +++ b/compilerplugins/clang/consttobool.cxx @@ -15,9 +15,8 @@ #include "clang/Basic/Builtins.h" -#include "config_clang.h" - #include "check.hxx" +#include "compat.hxx" #include "plugin.hxx" // Find implicit conversions from non-'bool' constants (e.g., 'sal_False') to 'bool'. @@ -87,10 +86,6 @@ public: return ret; } -#if CLANG_VERSION < 110000 - bool TraverseUnaryLNot(UnaryOperator* expr) { return TraverseUnaryOperator(expr); } -#endif - bool PreTraverseBinaryOperator(BinaryOperator* expr) { if (expr->getOpcode() == BO_LAnd) @@ -121,10 +116,6 @@ public: return ret; } -#if CLANG_VERSION < 110000 - bool TraverseBinLAnd(BinaryOperator* expr) { return TraverseBinaryOperator(expr); } -#endif - bool VisitImplicitCastExpr(ImplicitCastExpr const* expr) { if (ignoreLocation(expr)) @@ -155,7 +146,7 @@ public: { if (auto const e = dyn_cast<clang::StringLiteral>(sub->IgnoreParenImpCasts())) { - if (e->isAscii()) // somewhat randomly restrict to plain literals + if (compat::isOrdinary(e)) // somewhat randomly restrict to plain literals { if (compiler.getSourceManager().isMacroArgExpansion(l) && Lexer::getImmediateMacroName(l, compiler.getSourceManager(), @@ -275,9 +266,10 @@ private: bool isFromCIncludeFile(SourceLocation spellingLocation) const { return !compiler.getSourceManager().isInMainFile(spellingLocation) - && (StringRef( - compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename()) - .endswith(".h")); + && compat::ends_with(StringRef(compiler.getSourceManager() + .getPresumedLoc(spellingLocation) + .getFilename()), + ".h"); } bool isSharedCAndCppCode(SourceLocation location) const |