summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-11-01 16:46:43 +0100
committerStephan Bergmann <sbergman@redhat.com>2023-11-02 07:46:28 +0100
commit5f0e243159cae738dee65303f61b5a5f1b3bdf28 (patch)
tree0b461299064e5cc4e8e4bc15b7baebd5108ef9b0 /compilerplugins
parent9071fa5f5f103808234102dc7552266ccda7bb22 (diff)
Adapt to Clang 18 trunk ElaboratedTypeKeyword rework
<https://github.com/llvm/llvm-project/commit/4ad2ada5216ee2bb3c334a3233a9ab51f2521b82> "[clang][NFC] Refactor ElaboratedTypeKeyword" Change-Id: I1ee6592fe76bb484441ca859986e7217eaba58f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158764 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/compat.hxx9
-rw-r--r--compilerplugins/clang/cstylecast.cxx2
2 files changed, 10 insertions, 1 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index a836aa0af1ed..650d187070e0 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -82,6 +82,15 @@ constexpr clang::ExprValueKind VK_PRValue = clang::VK_PRValue;
constexpr clang::ExprValueKind VK_PRValue = clang::VK_RValue;
#endif
+namespace ElabortatedTypeKeyword
+{
+#if CLANG_VERSION >= 180000
+constexpr clang::ElaboratedTypeKeyword None = clang::ElaboratedTypeKeyword::None;
+#else
+constexpr clang::ElaboratedTypeKeyword None = clang::ETK_None;
+#endif
+}
+
inline bool EvaluateAsInt(clang::Expr const * expr, llvm::APSInt& intRes, const clang::ASTContext& ctx) {
clang::Expr::EvalResult res;
bool b = expr->EvaluateAsInt(res, ctx);
diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index 35292ecd8fb6..2360606aff55 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -161,7 +161,7 @@ bool canBeUsedForFunctionalCast(TypeSourceInfo const * info) {
return true;
}
if (auto const t = dyn_cast<ElaboratedType>(type)) {
- return t->getKeyword() == ETK_None;
+ return t->getKeyword() == compat::ElabortatedTypeKeyword::None;
}
return false;
}