Adapt compilerplugins to Clang VK_RValue -> VK_PRValue rename
<aef5d8fdc7
>
"[clang] NFC: Rename rvalue to prvalue"
Change-Id: I237e8a491465500e35637f8dae400402bcd9411d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116983
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
a774d3295f
commit
3732bba5e2
@ -17,6 +17,7 @@
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "clang/AST/ExprCXX.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Basic/Specifiers.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
@ -169,6 +170,12 @@ inline bool CPlusPlus17(clang::LangOptions const & opts) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CLANG_VERSION >= 130000
|
||||
constexpr clang::ExprValueKind VK_PRValue = clang::VK_PRValue;
|
||||
#else
|
||||
constexpr clang::ExprValueKind VK_PRValue = clang::VK_RValue;
|
||||
#endif
|
||||
|
||||
inline bool EvaluateAsInt(clang::Expr const * expr, llvm::APSInt& intRes, const clang::ASTContext& ctx) {
|
||||
#if CLANG_VERSION >= 80000
|
||||
clang::Expr::EvalResult res;
|
||||
|
@ -51,12 +51,12 @@ bool canConstCastFromTo(Expr const * from, Expr const * to) {
|
||||
auto const k2 = to->getValueKind();
|
||||
return (k2 == VK_LValue && k1 == VK_LValue)
|
||||
|| (k2 == VK_XValue
|
||||
&& (k1 != VK_RValue || from->getType()->isRecordType()));
|
||||
&& (k1 != compat::VK_PRValue || from->getType()->isRecordType()));
|
||||
}
|
||||
|
||||
char const * printExprValueKind(ExprValueKind k) {
|
||||
switch (k) {
|
||||
case VK_RValue:
|
||||
case compat::VK_PRValue:
|
||||
return "prvalue";
|
||||
case VK_LValue:
|
||||
return "lvalue";
|
||||
@ -539,7 +539,7 @@ bool RedundantCast::VisitCXXStaticCastExpr(CXXStaticCastExpr const * expr) {
|
||||
" written as an explicit construction of a temporary}4"),
|
||||
expr->getExprLoc())
|
||||
<< t1 << printExprValueKind(k1) << t2 << printExprValueKind(k3)
|
||||
<< (k3 == VK_RValue && (k1 != VK_RValue || t1->isRecordType()))
|
||||
<< (k3 == compat::VK_PRValue && (k1 != compat::VK_PRValue || t1->isRecordType()))
|
||||
<< expr->getSourceRange();
|
||||
return true;
|
||||
}
|
||||
@ -726,7 +726,7 @@ bool RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp
|
||||
auto const t1 = expr->getTypeAsWritten();
|
||||
bool const fnptr = t1->isFunctionPointerType() || t1->isMemberFunctionPointerType();
|
||||
auto const sub = fnptr ? stopAtFunctionPointerDecay(expr) : compat::getSubExprAsWritten(expr);
|
||||
if ((sub->getValueKind() != VK_RValue && !fnptr) || expr->getType()->isRecordType()
|
||||
if ((sub->getValueKind() != compat::VK_PRValue && !fnptr) || expr->getType()->isRecordType()
|
||||
|| isa<InitListExpr>(sub) || isa<CXXStdInitializerListExpr>(sub))
|
||||
{
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user