diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-06-05 14:19:55 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-06-05 19:46:50 +0200 |
commit | 6f33d21fdd85f49cd15b2770c6557e87f05b7dba (patch) | |
tree | 2d493713a3ce3630361998fa75ed7b6c1cf5de7f /compilerplugins/clang/noexceptmove.cxx | |
parent | c2c1e6a27293bba770b07efb0a4d64ba4b6150fb (diff) |
Adapt compilerplugins to Clang 17 trunk "Remove llvm::Optional"
(<https://github.com/llvm/llvm-project/commit/397f2e9ebee8d8e45547e90dd05228d7f965df67>)
Change-Id: I51acda5951f8250d1a1b47e1c2612199ae7338a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152618
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/noexceptmove.cxx')
-rw-r--r-- | compilerplugins/clang/noexceptmove.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/compilerplugins/clang/noexceptmove.cxx b/compilerplugins/clang/noexceptmove.cxx index 24d12f51fa34..04ec58044ce4 100644 --- a/compilerplugins/clang/noexceptmove.cxx +++ b/compilerplugins/clang/noexceptmove.cxx @@ -9,12 +9,11 @@ // versions before 9.0 didn't have getExceptionSpecType #include "check.hxx" +#include "compat.hxx" #include "plugin.hxx" #include "config_clang.h" -#include "llvm/ADT/Optional.h" - #include <string> #include <set> @@ -55,7 +54,7 @@ public: bool VisitVarDecl(const VarDecl*); private: - llvm::Optional<bool> IsCallThrows(const CallExpr* callExpr); + compat::optional<bool> IsCallThrows(const CallExpr* callExpr); std::vector<bool> m_ConstructorThrows; std::vector<std::vector<const Decl*>> m_Exclusions; std::vector<bool> m_CannotFix; @@ -173,7 +172,7 @@ bool NoExceptMove::VisitCallExpr(const CallExpr* callExpr) return true; if (m_ConstructorThrows.empty()) return true; - llvm::Optional<bool> bCallThrows = IsCallThrows(callExpr); + compat::optional<bool> bCallThrows = IsCallThrows(callExpr); if (!bCallThrows) { callExpr->dump(); @@ -252,7 +251,7 @@ bool NoExceptMove::VisitVarDecl(const VarDecl* varDecl) return true; } -llvm::Optional<bool> NoExceptMove::IsCallThrows(const CallExpr* callExpr) +compat::optional<bool> NoExceptMove::IsCallThrows(const CallExpr* callExpr) { const FunctionDecl* calleeFunctionDecl = callExpr->getDirectCallee(); if (calleeFunctionDecl) @@ -302,7 +301,7 @@ llvm::Optional<bool> NoExceptMove::IsCallThrows(const CallExpr* callExpr) else { m_CannotFix.back() = true; - return llvm::Optional<bool>(); + return compat::optional<bool>(); } // allowlist of functions that could be noexcept, but we can't change them because of backwards-compatibility reasons @@ -316,7 +315,7 @@ llvm::Optional<bool> NoExceptMove::IsCallThrows(const CallExpr* callExpr) if (!funcProto) { m_CannotFix.back() = true; - return llvm::Optional<bool>(); + return compat::optional<bool>(); } auto est = funcProto->getExceptionSpecType(); |