aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Lohnau <alexander.lohnau@gmx.de>2024-02-05 15:30:40 +0100
committerAlexander Lohnau <alexander.lohnau@gmx.de>2024-02-11 14:34:36 +0100
commitc352885a9b9a40f10d862e5f0e440313f3d79545 (patch)
tree2a01cdf4c461ae3f727588cf2f702cd715dd8952
parent9bb509f401bd4e4c50c449896f05d0c733f0d603 (diff)
Do not include SourceCompatibilityHelpers in checkbase.h file
Instead, force all clients to import this if they have a need for it. This forces us to move the FileEntry compat tye to the checkbase, but for everything else we can make a clear cut.
-rw-r--r--src/SourceCompatibilityHelpers.h8
-rw-r--r--src/checkbase.h12
-rw-r--r--src/checks/manuallevel/unexpected-flag-enumerator-value.cpp1
3 files changed, 12 insertions, 9 deletions
diff --git a/src/SourceCompatibilityHelpers.h b/src/SourceCompatibilityHelpers.h
index fc581ac1..5eec9f6c 100644
--- a/src/SourceCompatibilityHelpers.h
+++ b/src/SourceCompatibilityHelpers.h
@@ -52,14 +52,6 @@ inline bool contains_lower(clang::StringRef haystack, clang::StringRef needle)
#endif
}
-#if LLVM_VERSION_MAJOR >= 16
-using OptionalFileEntryRef = clang::CustomizableOptional<clang::FileEntryRef>;
-#elif LLVM_VERSION_MAJOR >= 15
-using OptionalFileEntryRef = clang::Optional<clang::FileEntryRef>;
-#else
-using OptionalFileEntryRef = const clang::FileEntry *;
-#endif
-
inline bool isAscii(clang::StringLiteral *lt)
{
#if LLVM_VERSION_MAJOR >= 15
diff --git a/src/checkbase.h b/src/checkbase.h
index e3dea56e..e6e24e5b 100644
--- a/src/checkbase.h
+++ b/src/checkbase.h
@@ -10,7 +10,6 @@
#ifndef CHECK_BASE_H
#define CHECK_BASE_H
-#include "SourceCompatibilityHelpers.h"
#include "clazy_stl.h" // IWYU pragma: keep
#include <clang/AST/ASTContext.h>
@@ -27,6 +26,17 @@
#include <utility>
#include <vector>
+namespace clazy
+{
+#if LLVM_VERSION_MAJOR >= 16
+using OptionalFileEntryRef = clang::CustomizableOptional<clang::FileEntryRef>;
+#elif LLVM_VERSION_MAJOR >= 15
+using OptionalFileEntryRef = clang::Optional<clang::FileEntryRef>;
+#else
+using OptionalFileEntryRef = const clang::FileEntry *;
+#endif
+}
+
namespace clang
{
class CXXMethodDecl;
diff --git a/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp b/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp
index 5e78ae3c..9185860d 100644
--- a/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp
+++ b/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp
@@ -7,6 +7,7 @@
#include "unexpected-flag-enumerator-value.h"
#include "HierarchyUtils.h"
+#include "SourceCompatibilityHelpers.h"
#include <clang/AST/AST.h>