summaryrefslogtreecommitdiffstats
path: root/compilerplugins/clang/literaltoboolconversion.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/literaltoboolconversion.cxx')
-rw-r--r--compilerplugins/clang/literaltoboolconversion.cxx16
1 files changed, 5 insertions, 11 deletions
diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx
index c94e0d1b014b..4c3c3a4cee8f 100644
--- a/compilerplugins/clang/literaltoboolconversion.cxx
+++ b/compilerplugins/clang/literaltoboolconversion.cxx
@@ -151,17 +151,11 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr(
bool LiteralToBoolConversion::isFromCIncludeFile(
SourceLocation spellingLocation) const
{
-#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3
- if (compiler.getSourceManager().isInMainFile(spellingLocation)) {
- return false;
- }
-#else
- if (compiler.getSourceManager().isFromMainFile(spellingLocation)) {
- return false;
- }
-#endif
- return StringRef(compiler.getSourceManager().getPresumedLoc(spellingLocation)
- .getFilename()).endswith(".h");
+ return !compat::isInMainFile(compiler.getSourceManager(), spellingLocation)
+ && (StringRef(
+ compiler.getSourceManager().getPresumedLoc(spellingLocation)
+ .getFilename())
+ .endswith(".h"));
}
bool LiteralToBoolConversion::isMacroBodyExpansion(SourceLocation location)