diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-08-31 22:01:15 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-09-02 10:15:57 +0200 |
commit | 70a39252a8bd1dd12da0aaa7d3619d8628d376c0 (patch) | |
tree | c679e4518b78d000c0f175d40a60a4fcbd30c273 /compilerplugins/clang/compat.hxx | |
parent | 0d2340998415fb4b2f794054c62ef61c83e32155 (diff) |
<http://reviews.llvm.org/D22128> has been fixed since LLVM 5
...so compat::getSubExprAsWritten is now only needed for the ConstantExpr issue
that cannot hit for LLVM < 8 (see TODO "Turn OStringLiteral into a consteval'ed,
static-refcound rtl_String")
Change-Id: I12ad4624d353b1d801136e9988b261290e2f94d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101905
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r-- | compilerplugins/clang/compat.hxx | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx index 70b462e54e4b..51f13d39f332 100644 --- a/compilerplugins/clang/compat.hxx +++ b/compilerplugins/clang/compat.hxx @@ -187,35 +187,11 @@ inline clang::Expr * getSubExpr(clang::MaterializeTemporaryExpr const * expr) { #endif } -// Work around <http://reviews.llvm.org/D22128>: -// -// SfxErrorHandler::GetClassString (svtools/source/misc/ehdl.cxx): -// -// ErrorResource_Impl aEr(aId, (sal_uInt16)lClassId); -// if(aEr) -// { -// rStr = static_cast<ResString>(aEr).GetString(); -// } -// -// expr->dump(): -// CXXStaticCastExpr 0x2b74e8e657b8 'class ResString' static_cast<class ResString> <ConstructorConversion> -// `-CXXBindTemporaryExpr 0x2b74e8e65798 'class ResString' (CXXTemporary 0x2b74e8e65790) -// `-CXXConstructExpr 0x2b74e8e65758 'class ResString' 'void (class ResString &&) noexcept(false)' elidable -// `-MaterializeTemporaryExpr 0x2b74e8e65740 'class ResString' xvalue -// `-CXXBindTemporaryExpr 0x2b74e8e65720 'class ResString' (CXXTemporary 0x2b74e8e65718) -// `-ImplicitCastExpr 0x2b74e8e65700 'class ResString' <UserDefinedConversion> -// `-CXXMemberCallExpr 0x2b74e8e656d8 'class ResString' -// `-MemberExpr 0x2b74e8e656a0 '<bound member function type>' .operator ResString 0x2b74e8dc1f00 -// `-DeclRefExpr 0x2b74e8e65648 'struct ErrorResource_Impl' lvalue Var 0x2b74e8e653b0 'aEr' 'struct ErrorResource_Impl' -// expr->getSubExprAsWritten()->dump(): -// MaterializeTemporaryExpr 0x2b74e8e65740 'class ResString' xvalue -// `-CXXBindTemporaryExpr 0x2b74e8e65720 'class ResString' (CXXTemporary 0x2b74e8e65718) -// `-ImplicitCastExpr 0x2b74e8e65700 'class ResString' <UserDefinedConversion> -// `-CXXMemberCallExpr 0x2b74e8e656d8 'class ResString' -// `-MemberExpr 0x2b74e8e656a0 '<bound member function type>' .operator ResString 0x2b74e8dc1f00 -// `-DeclRefExpr 0x2b74e8e65648 'struct ErrorResource_Impl' lvalue Var 0x2b74e8e653b0 'aEr' 'struct ErrorResource_Impl' -// -// Also work around CastExpr::getSubExprAsWritten firing +#if CLANG_VERSION < 80000 +inline clang::Expr const * getSubExprAsWritten(clang::CastExpr const * expr) +{ return expr->getSubExprAsWritten(); } +#else +// Work around CastExpr::getSubExprAsWritten firing // // include/llvm/Support/Casting.h:269: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) // [with X = clang::CXXConstructExpr; Y = clang::Expr; @@ -280,6 +256,7 @@ inline clang::Expr *getSubExprAsWritten(clang::CastExpr *This) { inline const clang::Expr *getSubExprAsWritten(const clang::CastExpr *This) { return getSubExprAsWritten(const_cast<clang::CastExpr *>(This)); } +#endif inline clang::QualType getObjectType(clang::CXXMemberCallExpr const * expr) { #if CLANG_VERSION >= 100000 |