diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-07-28 08:14:49 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-07-28 09:56:46 +0200 |
commit | 292a5e719543ec9e6f5fe18fec371302983be038 (patch) | |
tree | 9d9d65aa5b6cdc57fb32e669b81cc07b28b8468b /compilerplugins/clang/compat.hxx | |
parent | d668c9a04d04d256fcbbd2165fe226f1db88256b (diff) |
Adapt to Clang 12 trunk Expr::getIntegerConstantExpression
<https://github.com/llvm/llvm-project/commit/
36036aa70ec1df7b51b5d30b2dd8090ad2b6e783> "Reapply 'Rename/refactor
isIntegerConstantExpression to getIntegerConstantExpression'"
Change-Id: I99277601fe7ffa3e0e5d22a4b3aaca4f51551ab3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99570
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r-- | compilerplugins/clang/compat.hxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx index 76f076621394..8a1a728bd95b 100644 --- a/compilerplugins/clang/compat.hxx +++ b/compilerplugins/clang/compat.hxx @@ -174,6 +174,17 @@ inline bool EvaluateAsInt(clang::Expr const * expr, llvm::APSInt& intRes, const #endif } +inline llvm::Optional<llvm::APSInt> getIntegerConstantExpr( + clang::Expr const * expr, clang::ASTContext const & context) +{ +#if CLANG_VERSION >= 120000 + return expr->getIntegerConstantExpr(context); +#else + llvm::APSInt res; + return expr->isIntegerConstantExpr(res, context) ? res : llvm::Optional<llvm::APSInt>(); +#endif +} + inline clang::Expr * getSubExpr(clang::MaterializeTemporaryExpr const * expr) { #if CLANG_VERSION >= 100000 return expr->getSubExpr(); |