mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 14:20:17 +00:00
C++2a -> C++20 in some identifiers; NFC.
This commit is contained in:
parent
1e1f5eb7c9
commit
6a30894391
@ -456,7 +456,7 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
|
|||||||
// Don't suggest fixes for bitfields because in-class initialization is not
|
// Don't suggest fixes for bitfields because in-class initialization is not
|
||||||
// possible until C++2a.
|
// possible until C++2a.
|
||||||
if (F->getType()->isEnumeralType() ||
|
if (F->getType()->isEnumeralType() ||
|
||||||
(!getLangOpts().CPlusPlus2a && F->isBitField()))
|
(!getLangOpts().CPlusPlus20 && F->isBitField()))
|
||||||
return;
|
return;
|
||||||
if (!F->getParent()->isUnion() || UnionsSeen.insert(F->getParent()).second)
|
if (!F->getParent()->isUnion() || UnionsSeen.insert(F->getParent()).second)
|
||||||
FieldsToFix.insert(F);
|
FieldsToFix.insert(F);
|
||||||
|
@ -217,7 +217,7 @@ void UseDefaultMemberInitCheck::registerMatchers(MatchFinder *Finder) {
|
|||||||
isDefaultConstructor(), unless(isInstantiated()),
|
isDefaultConstructor(), unless(isInstantiated()),
|
||||||
forEachConstructorInitializer(
|
forEachConstructorInitializer(
|
||||||
cxxCtorInitializer(
|
cxxCtorInitializer(
|
||||||
forField(unless(anyOf(getLangOpts().CPlusPlus2a
|
forField(unless(anyOf(getLangOpts().CPlusPlus20
|
||||||
? unless(anything())
|
? unless(anything())
|
||||||
: isBitField(),
|
: isBitField(),
|
||||||
hasInClassInitializer(anything()),
|
hasInClassInitializer(anything()),
|
||||||
|
@ -96,7 +96,7 @@ void SIMDIntrinsicsCheck::registerMatchers(MatchFinder *Finder) {
|
|||||||
// If Std is not specified, infer it from the language options.
|
// If Std is not specified, infer it from the language options.
|
||||||
// libcxx implementation backports it to C++11 std::experimental::simd.
|
// libcxx implementation backports it to C++11 std::experimental::simd.
|
||||||
if (Std.empty())
|
if (Std.empty())
|
||||||
Std = getLangOpts().CPlusPlus2a ? "std" : "std::experimental";
|
Std = getLangOpts().CPlusPlus20 ? "std" : "std::experimental";
|
||||||
|
|
||||||
Finder->addMatcher(callExpr(callee(functionDecl(
|
Finder->addMatcher(callExpr(callee(functionDecl(
|
||||||
matchesName("^::(_mm_|_mm256_|_mm512_|vec_)"),
|
matchesName("^::(_mm_|_mm256_|_mm512_|vec_)"),
|
||||||
|
@ -1167,7 +1167,7 @@ public:
|
|||||||
bool defaultedDefaultConstructorIsConstexpr() const {
|
bool defaultedDefaultConstructorIsConstexpr() const {
|
||||||
return data().DefaultedDefaultConstructorIsConstexpr &&
|
return data().DefaultedDefaultConstructorIsConstexpr &&
|
||||||
(!isUnion() || hasInClassInitializer() || !hasVariantMembers() ||
|
(!isUnion() || hasInClassInitializer() || !hasVariantMembers() ||
|
||||||
getLangOpts().CPlusPlus2a);
|
getLangOpts().CPlusPlus20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determine whether this class has a constexpr default constructor.
|
/// Determine whether this class has a constexpr default constructor.
|
||||||
@ -1259,7 +1259,7 @@ public:
|
|||||||
/// would be constexpr.
|
/// would be constexpr.
|
||||||
bool defaultedDestructorIsConstexpr() const {
|
bool defaultedDestructorIsConstexpr() const {
|
||||||
return data().DefaultedDestructorIsConstexpr &&
|
return data().DefaultedDestructorIsConstexpr &&
|
||||||
getLangOpts().CPlusPlus2a;
|
getLangOpts().CPlusPlus20;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determine whether this class has a constexpr destructor.
|
/// Determine whether this class has a constexpr destructor.
|
||||||
@ -1357,7 +1357,7 @@ public:
|
|||||||
/// Only in C++17 and beyond, are lambdas literal types.
|
/// Only in C++17 and beyond, are lambdas literal types.
|
||||||
bool isLiteral() const {
|
bool isLiteral() const {
|
||||||
const LangOptions &LangOpts = getLangOpts();
|
const LangOptions &LangOpts = getLangOpts();
|
||||||
return (LangOpts.CPlusPlus2a ? hasConstexprDestructor()
|
return (LangOpts.CPlusPlus20 ? hasConstexprDestructor()
|
||||||
: hasTrivialDestructor()) &&
|
: hasTrivialDestructor()) &&
|
||||||
(!isLambda() || LangOpts.CPlusPlus17) &&
|
(!isLambda() || LangOpts.CPlusPlus17) &&
|
||||||
!hasNonLiteralTypeFieldsOrBases() &&
|
!hasNonLiteralTypeFieldsOrBases() &&
|
||||||
|
@ -91,7 +91,7 @@ LANGOPT(CPlusPlus , 1, 0, "C++")
|
|||||||
LANGOPT(CPlusPlus11 , 1, 0, "C++11")
|
LANGOPT(CPlusPlus11 , 1, 0, "C++11")
|
||||||
LANGOPT(CPlusPlus14 , 1, 0, "C++14")
|
LANGOPT(CPlusPlus14 , 1, 0, "C++14")
|
||||||
LANGOPT(CPlusPlus17 , 1, 0, "C++17")
|
LANGOPT(CPlusPlus17 , 1, 0, "C++17")
|
||||||
LANGOPT(CPlusPlus2a , 1, 0, "C++2a")
|
LANGOPT(CPlusPlus20 , 1, 0, "C++20")
|
||||||
LANGOPT(ObjC , 1, 0, "Objective-C")
|
LANGOPT(ObjC , 1, 0, "Objective-C")
|
||||||
BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0,
|
BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0,
|
||||||
"Objective-C auto-synthesized properties")
|
"Objective-C auto-synthesized properties")
|
||||||
@ -243,7 +243,7 @@ LANGOPT(SizedDeallocation , 1, 0, "sized deallocation")
|
|||||||
LANGOPT(AlignedAllocation , 1, 0, "aligned allocation")
|
LANGOPT(AlignedAllocation , 1, 0, "aligned allocation")
|
||||||
LANGOPT(AlignedAllocationUnavailable, 1, 0, "aligned allocation functions are unavailable")
|
LANGOPT(AlignedAllocationUnavailable, 1, 0, "aligned allocation functions are unavailable")
|
||||||
LANGOPT(NewAlignOverride , 32, 0, "maximum alignment guaranteed by '::operator new(size_t)'")
|
LANGOPT(NewAlignOverride , 32, 0, "maximum alignment guaranteed by '::operator new(size_t)'")
|
||||||
LANGOPT(ConceptSatisfactionCaching , 1, 1, "enable satisfaction caching for C++2a Concepts")
|
LANGOPT(ConceptSatisfactionCaching , 1, 1, "enable satisfaction caching for C++20 Concepts")
|
||||||
BENIGN_LANGOPT(ModulesCodegen , 1, 0, "Modules code generation")
|
BENIGN_LANGOPT(ModulesCodegen , 1, 0, "Modules code generation")
|
||||||
BENIGN_LANGOPT(ModulesDebugInfo , 1, 0, "Modules debug info")
|
BENIGN_LANGOPT(ModulesDebugInfo , 1, 0, "Modules debug info")
|
||||||
BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
|
BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
|
||||||
|
@ -48,7 +48,7 @@ enum LangFeatures {
|
|||||||
CPlusPlus11 = (1 << 6),
|
CPlusPlus11 = (1 << 6),
|
||||||
CPlusPlus14 = (1 << 7),
|
CPlusPlus14 = (1 << 7),
|
||||||
CPlusPlus17 = (1 << 8),
|
CPlusPlus17 = (1 << 8),
|
||||||
CPlusPlus2a = (1 << 9),
|
CPlusPlus20 = (1 << 9),
|
||||||
Digraphs = (1 << 10),
|
Digraphs = (1 << 10),
|
||||||
GNUMode = (1 << 11),
|
GNUMode = (1 << 11),
|
||||||
HexFloat = (1 << 12),
|
HexFloat = (1 << 12),
|
||||||
@ -108,8 +108,8 @@ public:
|
|||||||
/// isCPlusPlus17 - Language is a C++17 variant (or later).
|
/// isCPlusPlus17 - Language is a C++17 variant (or later).
|
||||||
bool isCPlusPlus17() const { return Flags & CPlusPlus17; }
|
bool isCPlusPlus17() const { return Flags & CPlusPlus17; }
|
||||||
|
|
||||||
/// isCPlusPlus2a - Language is a post-C++17 variant (or later).
|
/// isCPlusPlus20 - Language is a C++20 variant (or later).
|
||||||
bool isCPlusPlus2a() const { return Flags & CPlusPlus2a; }
|
bool isCPlusPlus20() const { return Flags & CPlusPlus20; }
|
||||||
|
|
||||||
/// hasDigraphs - Language supports digraphs.
|
/// hasDigraphs - Language supports digraphs.
|
||||||
bool hasDigraphs() const { return Flags & Digraphs; }
|
bool hasDigraphs() const { return Flags & Digraphs; }
|
||||||
|
@ -143,13 +143,13 @@ LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z")
|
|||||||
LANGSTANDARD(cxx20, "c++20",
|
LANGSTANDARD(cxx20, "c++20",
|
||||||
CXX, "ISO C++ 2020 DIS",
|
CXX, "ISO C++ 2020 DIS",
|
||||||
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
|
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
|
||||||
CPlusPlus2a | Digraphs | HexFloat)
|
CPlusPlus20 | Digraphs | HexFloat)
|
||||||
LANGSTANDARD_ALIAS_DEPR(cxx20, "c++2a")
|
LANGSTANDARD_ALIAS_DEPR(cxx20, "c++2a")
|
||||||
|
|
||||||
LANGSTANDARD(gnucxx20, "gnu++20",
|
LANGSTANDARD(gnucxx20, "gnu++20",
|
||||||
CXX, "ISO C++ 2020 DIS with GNU extensions",
|
CXX, "ISO C++ 2020 DIS with GNU extensions",
|
||||||
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
|
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
|
||||||
CPlusPlus2a | Digraphs | HexFloat | GNUMode)
|
CPlusPlus20 | Digraphs | HexFloat | GNUMode)
|
||||||
LANGSTANDARD_ALIAS_DEPR(gnucxx20, "gnu++2a")
|
LANGSTANDARD_ALIAS_DEPR(gnucxx20, "gnu++2a")
|
||||||
|
|
||||||
// OpenCL
|
// OpenCL
|
||||||
|
@ -26,14 +26,14 @@
|
|||||||
#ifndef CXX11_KEYWORD
|
#ifndef CXX11_KEYWORD
|
||||||
#define CXX11_KEYWORD(X,Y) KEYWORD(X,KEYCXX11|(Y))
|
#define CXX11_KEYWORD(X,Y) KEYWORD(X,KEYCXX11|(Y))
|
||||||
#endif
|
#endif
|
||||||
#ifndef CXX2A_KEYWORD
|
#ifndef CXX20_KEYWORD
|
||||||
#define CXX2A_KEYWORD(X,Y) KEYWORD(X,KEYCXX2A|(Y))
|
#define CXX20_KEYWORD(X,Y) KEYWORD(X,KEYCXX20|(Y))
|
||||||
#endif
|
#endif
|
||||||
#ifndef CONCEPTS_KEYWORD
|
#ifndef CONCEPTS_KEYWORD
|
||||||
#define CONCEPTS_KEYWORD(X) CXX2A_KEYWORD(X,KEYCONCEPTS)
|
#define CONCEPTS_KEYWORD(X) CXX20_KEYWORD(X,KEYCONCEPTS)
|
||||||
#endif
|
#endif
|
||||||
#ifndef COROUTINES_KEYWORD
|
#ifndef COROUTINES_KEYWORD
|
||||||
#define COROUTINES_KEYWORD(X) CXX2A_KEYWORD(X,KEYCOROUTINES)
|
#define COROUTINES_KEYWORD(X) CXX20_KEYWORD(X,KEYCOROUTINES)
|
||||||
#endif
|
#endif
|
||||||
#ifndef MODULES_KEYWORD
|
#ifndef MODULES_KEYWORD
|
||||||
#define MODULES_KEYWORD(X) KEYWORD(X,KEYMODULES)
|
#define MODULES_KEYWORD(X) KEYWORD(X,KEYMODULES)
|
||||||
@ -244,7 +244,7 @@ PUNCTUATOR(caretcaret, "^^")
|
|||||||
// implementation namespace
|
// implementation namespace
|
||||||
// KEYNOCXX - This is a keyword in every non-C++ dialect.
|
// KEYNOCXX - This is a keyword in every non-C++ dialect.
|
||||||
// KEYCXX11 - This is a C++ keyword introduced to C++ in C++11
|
// KEYCXX11 - This is a C++ keyword introduced to C++ in C++11
|
||||||
// KEYCXX2A - This is a C++ keyword introduced to C++ in C++2a
|
// KEYCXX20 - This is a C++ keyword introduced to C++ in C++20
|
||||||
// KEYCONCEPTS - This is a keyword if the C++ extensions for concepts
|
// KEYCONCEPTS - This is a keyword if the C++ extensions for concepts
|
||||||
// are enabled.
|
// are enabled.
|
||||||
// KEYMODULES - This is a keyword if the C++ extensions for modules
|
// KEYMODULES - This is a keyword if the C++ extensions for modules
|
||||||
@ -374,11 +374,11 @@ CXX11_KEYWORD(nullptr , 0)
|
|||||||
CXX11_KEYWORD(static_assert , KEYMSCOMPAT)
|
CXX11_KEYWORD(static_assert , KEYMSCOMPAT)
|
||||||
CXX11_KEYWORD(thread_local , 0)
|
CXX11_KEYWORD(thread_local , 0)
|
||||||
|
|
||||||
// C++2a keywords
|
// C++20 keywords
|
||||||
CONCEPTS_KEYWORD(concept)
|
CONCEPTS_KEYWORD(concept)
|
||||||
CONCEPTS_KEYWORD(requires)
|
CONCEPTS_KEYWORD(requires)
|
||||||
|
|
||||||
// C++2a / coroutines TS keywords
|
// C++20 / coroutines TS keywords
|
||||||
COROUTINES_KEYWORD(co_await)
|
COROUTINES_KEYWORD(co_await)
|
||||||
COROUTINES_KEYWORD(co_return)
|
COROUTINES_KEYWORD(co_return)
|
||||||
COROUTINES_KEYWORD(co_yield)
|
COROUTINES_KEYWORD(co_yield)
|
||||||
@ -388,9 +388,9 @@ MODULES_KEYWORD(module)
|
|||||||
MODULES_KEYWORD(import)
|
MODULES_KEYWORD(import)
|
||||||
|
|
||||||
// C++20 keywords.
|
// C++20 keywords.
|
||||||
CXX2A_KEYWORD(char8_t , CHAR8SUPPORT)
|
CXX20_KEYWORD(char8_t , CHAR8SUPPORT)
|
||||||
CXX2A_KEYWORD(consteval , 0)
|
CXX20_KEYWORD(consteval , 0)
|
||||||
CXX2A_KEYWORD(constinit , 0)
|
CXX20_KEYWORD(constinit , 0)
|
||||||
|
|
||||||
// C11 Extension
|
// C11 Extension
|
||||||
KEYWORD(_Float16 , KEYALL)
|
KEYWORD(_Float16 , KEYALL)
|
||||||
@ -865,7 +865,7 @@ ANNOTATION(header_unit)
|
|||||||
#undef TYPE_TRAIT_1
|
#undef TYPE_TRAIT_1
|
||||||
#undef TYPE_TRAIT
|
#undef TYPE_TRAIT
|
||||||
#undef CONCEPTS_KEYWORD
|
#undef CONCEPTS_KEYWORD
|
||||||
#undef CXX2A_KEYWORD
|
#undef CXX20_KEYWORD
|
||||||
#undef CXX11_KEYWORD
|
#undef CXX11_KEYWORD
|
||||||
#undef KEYWORD
|
#undef KEYWORD
|
||||||
#undef PUNCTUATOR
|
#undef PUNCTUATOR
|
||||||
|
@ -667,7 +667,7 @@ bool CXXRecordDecl::lambdaIsDefaultConstructibleAndAssignable() const {
|
|||||||
if (getLambdaCaptureDefault() != LCD_None ||
|
if (getLambdaCaptureDefault() != LCD_None ||
|
||||||
getLambdaData().NumCaptures != 0)
|
getLambdaData().NumCaptures != 0)
|
||||||
return false;
|
return false;
|
||||||
return getASTContext().getLangOpts().CPlusPlus2a;
|
return getASTContext().getLangOpts().CPlusPlus20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXXRecordDecl::addedMember(Decl *D) {
|
void CXXRecordDecl::addedMember(Decl *D) {
|
||||||
@ -783,7 +783,7 @@ void CXXRecordDecl::addedMember(Decl *D) {
|
|||||||
// C++20 [dcl.init.aggr]p1:
|
// C++20 [dcl.init.aggr]p1:
|
||||||
// An aggregate is an array or a class with no user-declared [...]
|
// An aggregate is an array or a class with no user-declared [...]
|
||||||
// constructors
|
// constructors
|
||||||
if (getASTContext().getLangOpts().CPlusPlus2a
|
if (getASTContext().getLangOpts().CPlusPlus20
|
||||||
? !Constructor->isImplicit()
|
? !Constructor->isImplicit()
|
||||||
: (Constructor->isUserProvided() || Constructor->isExplicit()))
|
: (Constructor->isUserProvided() || Constructor->isExplicit()))
|
||||||
data().Aggregate = false;
|
data().Aggregate = false;
|
||||||
@ -1289,7 +1289,7 @@ void CXXRecordDecl::addedMember(Decl *D) {
|
|||||||
// Base element type of field is a non-class type.
|
// Base element type of field is a non-class type.
|
||||||
if (!T->isLiteralType(Context) ||
|
if (!T->isLiteralType(Context) ||
|
||||||
(!Field->hasInClassInitializer() && !isUnion() &&
|
(!Field->hasInClassInitializer() && !isUnion() &&
|
||||||
!Context.getLangOpts().CPlusPlus2a))
|
!Context.getLangOpts().CPlusPlus20))
|
||||||
data().DefaultedDefaultConstructorIsConstexpr = false;
|
data().DefaultedDefaultConstructorIsConstexpr = false;
|
||||||
|
|
||||||
// C++11 [class.copy]p23:
|
// C++11 [class.copy]p23:
|
||||||
|
@ -693,7 +693,7 @@ NonTypeTemplateParmDecl::Create(const ASTContext &C, DeclContext *DC,
|
|||||||
QualType T, bool ParameterPack,
|
QualType T, bool ParameterPack,
|
||||||
TypeSourceInfo *TInfo) {
|
TypeSourceInfo *TInfo) {
|
||||||
AutoType *AT =
|
AutoType *AT =
|
||||||
C.getLangOpts().CPlusPlus2a ? T->getContainedAutoType() : nullptr;
|
C.getLangOpts().CPlusPlus20 ? T->getContainedAutoType() : nullptr;
|
||||||
return new (C, DC,
|
return new (C, DC,
|
||||||
additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
|
additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
|
||||||
Expr *>(0,
|
Expr *>(0,
|
||||||
|
@ -2579,7 +2579,7 @@ static bool handleIntIntBinOp(EvalInfo &Info, const Expr *E, const APSInt &LHS,
|
|||||||
if (SA != RHS) {
|
if (SA != RHS) {
|
||||||
Info.CCEDiag(E, diag::note_constexpr_large_shift)
|
Info.CCEDiag(E, diag::note_constexpr_large_shift)
|
||||||
<< RHS << E->getType() << LHS.getBitWidth();
|
<< RHS << E->getType() << LHS.getBitWidth();
|
||||||
} else if (LHS.isSigned() && !Info.getLangOpts().CPlusPlus2a) {
|
} else if (LHS.isSigned() && !Info.getLangOpts().CPlusPlus20) {
|
||||||
// C++11 [expr.shift]p2: A signed left shift must have a non-negative
|
// C++11 [expr.shift]p2: A signed left shift must have a non-negative
|
||||||
// operand, and must not overflow the corresponding unsigned type.
|
// operand, and must not overflow the corresponding unsigned type.
|
||||||
// C++2a [expr.shift]p2: E1 << E2 is the unique value congruent to
|
// C++2a [expr.shift]p2: E1 << E2 is the unique value congruent to
|
||||||
@ -4983,7 +4983,7 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc,
|
|||||||
// DR1872: An instantiated virtual constexpr function can't be called in a
|
// DR1872: An instantiated virtual constexpr function can't be called in a
|
||||||
// constant expression (prior to C++20). We can still constant-fold such a
|
// constant expression (prior to C++20). We can still constant-fold such a
|
||||||
// call.
|
// call.
|
||||||
if (!Info.Ctx.getLangOpts().CPlusPlus2a && isa<CXXMethodDecl>(Declaration) &&
|
if (!Info.Ctx.getLangOpts().CPlusPlus20 && isa<CXXMethodDecl>(Declaration) &&
|
||||||
cast<CXXMethodDecl>(Declaration)->isVirtual())
|
cast<CXXMethodDecl>(Declaration)->isVirtual())
|
||||||
Info.CCEDiag(CallLoc, diag::note_constexpr_virtual_call);
|
Info.CCEDiag(CallLoc, diag::note_constexpr_virtual_call);
|
||||||
|
|
||||||
@ -5595,7 +5595,7 @@ static bool HandleFunctionCall(SourceLocation CallLoc,
|
|||||||
if (!handleLValueToRValueConversion(Info, Args[0], Args[0]->getType(), RHS,
|
if (!handleLValueToRValueConversion(Info, Args[0], Args[0]->getType(), RHS,
|
||||||
RHSValue, MD->getParent()->isUnion()))
|
RHSValue, MD->getParent()->isUnion()))
|
||||||
return false;
|
return false;
|
||||||
if (Info.getLangOpts().CPlusPlus2a && MD->isTrivial() &&
|
if (Info.getLangOpts().CPlusPlus20 && MD->isTrivial() &&
|
||||||
!HandleUnionActiveMemberChange(Info, Args[0], *This))
|
!HandleUnionActiveMemberChange(Info, Args[0], *This))
|
||||||
return false;
|
return false;
|
||||||
if (!handleAssignment(Info, Args[0], *This, MD->getThisType(),
|
if (!handleAssignment(Info, Args[0], *This, MD->getThisType(),
|
||||||
@ -6067,7 +6067,7 @@ static bool HandleOperatorNewCall(EvalInfo &Info, const CallExpr *E,
|
|||||||
// This is permitted only within a call to std::allocator<T>::allocate.
|
// This is permitted only within a call to std::allocator<T>::allocate.
|
||||||
auto Caller = Info.getStdAllocatorCaller("allocate");
|
auto Caller = Info.getStdAllocatorCaller("allocate");
|
||||||
if (!Caller) {
|
if (!Caller) {
|
||||||
Info.FFDiag(E->getExprLoc(), Info.getLangOpts().CPlusPlus2a
|
Info.FFDiag(E->getExprLoc(), Info.getLangOpts().CPlusPlus20
|
||||||
? diag::note_constexpr_new_untyped
|
? diag::note_constexpr_new_untyped
|
||||||
: diag::note_constexpr_new);
|
: diag::note_constexpr_new);
|
||||||
return false;
|
return false;
|
||||||
@ -6849,7 +6849,7 @@ public:
|
|||||||
return static_cast<Derived*>(this)->VisitCastExpr(E);
|
return static_cast<Derived*>(this)->VisitCastExpr(E);
|
||||||
}
|
}
|
||||||
bool VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *E) {
|
bool VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *E) {
|
||||||
if (!Info.Ctx.getLangOpts().CPlusPlus2a)
|
if (!Info.Ctx.getLangOpts().CPlusPlus20)
|
||||||
CCEDiag(E, diag::note_constexpr_invalid_cast) << 1;
|
CCEDiag(E, diag::note_constexpr_invalid_cast) << 1;
|
||||||
return static_cast<Derived*>(this)->VisitCastExpr(E);
|
return static_cast<Derived*>(this)->VisitCastExpr(E);
|
||||||
}
|
}
|
||||||
@ -7008,7 +7008,7 @@ public:
|
|||||||
return Error(Callee);
|
return Error(Callee);
|
||||||
This = &ThisVal;
|
This = &ThisVal;
|
||||||
} else if (const auto *PDE = dyn_cast<CXXPseudoDestructorExpr>(Callee)) {
|
} else if (const auto *PDE = dyn_cast<CXXPseudoDestructorExpr>(Callee)) {
|
||||||
if (!Info.getLangOpts().CPlusPlus2a)
|
if (!Info.getLangOpts().CPlusPlus20)
|
||||||
Info.CCEDiag(PDE, diag::note_constexpr_pseudo_destructor);
|
Info.CCEDiag(PDE, diag::note_constexpr_pseudo_destructor);
|
||||||
return EvaluateObjectArgument(Info, PDE->getBase(), ThisVal) &&
|
return EvaluateObjectArgument(Info, PDE->getBase(), ThisVal) &&
|
||||||
HandleDestruction(Info, PDE, ThisVal, PDE->getDestroyedType());
|
HandleDestruction(Info, PDE, ThisVal, PDE->getDestroyedType());
|
||||||
@ -7714,7 +7714,7 @@ bool LValueExprEvaluator::VisitCXXTypeidExpr(const CXXTypeidExpr *E) {
|
|||||||
else
|
else
|
||||||
TypeInfo = TypeInfoLValue(E->getExprOperand()->getType().getTypePtr());
|
TypeInfo = TypeInfoLValue(E->getExprOperand()->getType().getTypePtr());
|
||||||
} else {
|
} else {
|
||||||
if (!Info.Ctx.getLangOpts().CPlusPlus2a) {
|
if (!Info.Ctx.getLangOpts().CPlusPlus20) {
|
||||||
Info.CCEDiag(E, diag::note_constexpr_typeid_polymorphic)
|
Info.CCEDiag(E, diag::note_constexpr_typeid_polymorphic)
|
||||||
<< E->getExprOperand()->getType()
|
<< E->getExprOperand()->getType()
|
||||||
<< E->getExprOperand()->getSourceRange();
|
<< E->getExprOperand()->getSourceRange();
|
||||||
@ -7850,7 +7850,7 @@ bool LValueExprEvaluator::VisitBinAssign(const BinaryOperator *E) {
|
|||||||
if (!Evaluate(NewVal, this->Info, E->getRHS()))
|
if (!Evaluate(NewVal, this->Info, E->getRHS()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Info.getLangOpts().CPlusPlus2a &&
|
if (Info.getLangOpts().CPlusPlus20 &&
|
||||||
!HandleUnionActiveMemberChange(Info, E->getLHS(), Result))
|
!HandleUnionActiveMemberChange(Info, E->getLHS(), Result))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -8720,7 +8720,7 @@ static bool EvaluateArrayNewConstructExpr(EvalInfo &Info, LValue &This,
|
|||||||
QualType AllocType);
|
QualType AllocType);
|
||||||
|
|
||||||
bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
|
bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
|
||||||
if (!Info.getLangOpts().CPlusPlus2a)
|
if (!Info.getLangOpts().CPlusPlus20)
|
||||||
Info.CCEDiag(E, diag::note_constexpr_new);
|
Info.CCEDiag(E, diag::note_constexpr_new);
|
||||||
|
|
||||||
// We cannot speculatively evaluate a delete expression.
|
// We cannot speculatively evaluate a delete expression.
|
||||||
@ -13585,7 +13585,7 @@ bool VoidExprEvaluator::VisitCXXDeleteExpr(const CXXDeleteExpr *E) {
|
|||||||
// This is the only case where we need to produce an extension warning:
|
// This is the only case where we need to produce an extension warning:
|
||||||
// the only other way we can succeed is if we find a dynamic allocation,
|
// the only other way we can succeed is if we find a dynamic allocation,
|
||||||
// and we will have warned when we allocated it in that case.
|
// and we will have warned when we allocated it in that case.
|
||||||
if (!Info.getLangOpts().CPlusPlus2a)
|
if (!Info.getLangOpts().CPlusPlus20)
|
||||||
Info.CCEDiag(E, diag::note_constexpr_new);
|
Info.CCEDiag(E, diag::note_constexpr_new);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, Function *F) {
|
|||||||
const SourceLocation &Loc = S.Current->getLocation(OpPC);
|
const SourceLocation &Loc = S.Current->getLocation(OpPC);
|
||||||
|
|
||||||
if (F->isVirtual()) {
|
if (F->isVirtual()) {
|
||||||
if (!S.getLangOpts().CPlusPlus2a) {
|
if (!S.getLangOpts().CPlusPlus20) {
|
||||||
S.CCEDiag(Loc, diag::note_constexpr_virtual_call);
|
S.CCEDiag(Loc, diag::note_constexpr_virtual_call);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -869,7 +869,7 @@ inline bool ShiftRight(InterpState &S, CodePtr OpPC, const T &V, unsigned RHS) {
|
|||||||
|
|
||||||
template <PrimType TL, PrimType TR, typename T = typename PrimConv<TL>::T>
|
template <PrimType TL, PrimType TR, typename T = typename PrimConv<TL>::T>
|
||||||
inline bool ShiftLeft(InterpState &S, CodePtr OpPC, const T &V, unsigned RHS) {
|
inline bool ShiftLeft(InterpState &S, CodePtr OpPC, const T &V, unsigned RHS) {
|
||||||
if (V.isSigned() && !S.getLangOpts().CPlusPlus2a) {
|
if (V.isSigned() && !S.getLangOpts().CPlusPlus20) {
|
||||||
// C++11 [expr.shift]p2: A signed left shift must have a non-negative
|
// C++11 [expr.shift]p2: A signed left shift must have a non-negative
|
||||||
// operand, and must not overflow the corresponding unsigned type.
|
// operand, and must not overflow the corresponding unsigned type.
|
||||||
// C++2a [expr.shift]p2: E1 << E2 is the unique value congruent to
|
// C++2a [expr.shift]p2: E1 << E2 is the unique value congruent to
|
||||||
|
@ -97,10 +97,10 @@ namespace {
|
|||||||
KEYZVECTOR = 0x40000,
|
KEYZVECTOR = 0x40000,
|
||||||
KEYCOROUTINES = 0x80000,
|
KEYCOROUTINES = 0x80000,
|
||||||
KEYMODULES = 0x100000,
|
KEYMODULES = 0x100000,
|
||||||
KEYCXX2A = 0x200000,
|
KEYCXX20 = 0x200000,
|
||||||
KEYOPENCLCXX = 0x400000,
|
KEYOPENCLCXX = 0x400000,
|
||||||
KEYMSCOMPAT = 0x800000,
|
KEYMSCOMPAT = 0x800000,
|
||||||
KEYALLCXX = KEYCXX | KEYCXX11 | KEYCXX2A,
|
KEYALLCXX = KEYCXX | KEYCXX11 | KEYCXX20,
|
||||||
KEYALL = (0xffffff & ~KEYNOMS18 &
|
KEYALL = (0xffffff & ~KEYNOMS18 &
|
||||||
~KEYNOOPENCL) // KEYNOMS18 and KEYNOOPENCL are used to exclude.
|
~KEYNOOPENCL) // KEYNOMS18 and KEYNOOPENCL are used to exclude.
|
||||||
};
|
};
|
||||||
@ -122,7 +122,7 @@ static KeywordStatus getKeywordStatus(const LangOptions &LangOpts,
|
|||||||
if (Flags == KEYALL) return KS_Enabled;
|
if (Flags == KEYALL) return KS_Enabled;
|
||||||
if (LangOpts.CPlusPlus && (Flags & KEYCXX)) return KS_Enabled;
|
if (LangOpts.CPlusPlus && (Flags & KEYCXX)) return KS_Enabled;
|
||||||
if (LangOpts.CPlusPlus11 && (Flags & KEYCXX11)) return KS_Enabled;
|
if (LangOpts.CPlusPlus11 && (Flags & KEYCXX11)) return KS_Enabled;
|
||||||
if (LangOpts.CPlusPlus2a && (Flags & KEYCXX2A)) return KS_Enabled;
|
if (LangOpts.CPlusPlus20 && (Flags & KEYCXX20)) return KS_Enabled;
|
||||||
if (LangOpts.C99 && (Flags & KEYC99)) return KS_Enabled;
|
if (LangOpts.C99 && (Flags & KEYC99)) return KS_Enabled;
|
||||||
if (LangOpts.GNUKeywords && (Flags & KEYGNU)) return KS_Extension;
|
if (LangOpts.GNUKeywords && (Flags & KEYGNU)) return KS_Extension;
|
||||||
if (LangOpts.MicrosoftExt && (Flags & KEYMS)) return KS_Extension;
|
if (LangOpts.MicrosoftExt && (Flags & KEYMS)) return KS_Extension;
|
||||||
@ -142,7 +142,7 @@ static KeywordStatus getKeywordStatus(const LangOptions &LangOpts,
|
|||||||
// We treat bridge casts as objective-C keywords so we can warn on them
|
// We treat bridge casts as objective-C keywords so we can warn on them
|
||||||
// in non-arc mode.
|
// in non-arc mode.
|
||||||
if (LangOpts.ObjC && (Flags & KEYOBJC)) return KS_Enabled;
|
if (LangOpts.ObjC && (Flags & KEYOBJC)) return KS_Enabled;
|
||||||
if (LangOpts.CPlusPlus2a && (Flags & KEYCONCEPTS)) return KS_Enabled;
|
if (LangOpts.CPlusPlus20 && (Flags & KEYCONCEPTS)) return KS_Enabled;
|
||||||
if (LangOpts.Coroutines && (Flags & KEYCOROUTINES)) return KS_Enabled;
|
if (LangOpts.Coroutines && (Flags & KEYCOROUTINES)) return KS_Enabled;
|
||||||
if (LangOpts.ModulesTS && (Flags & KEYMODULES)) return KS_Enabled;
|
if (LangOpts.ModulesTS && (Flags & KEYMODULES)) return KS_Enabled;
|
||||||
if (LangOpts.CPlusPlus && (Flags & KEYALLCXX)) return KS_Future;
|
if (LangOpts.CPlusPlus && (Flags & KEYALLCXX)) return KS_Future;
|
||||||
@ -257,7 +257,7 @@ bool IdentifierInfo::isCPlusPlusKeyword(const LangOptions &LangOpts) const {
|
|||||||
LangOptions LangOptsNoCPP = LangOpts;
|
LangOptions LangOptsNoCPP = LangOpts;
|
||||||
LangOptsNoCPP.CPlusPlus = false;
|
LangOptsNoCPP.CPlusPlus = false;
|
||||||
LangOptsNoCPP.CPlusPlus11 = false;
|
LangOptsNoCPP.CPlusPlus11 = false;
|
||||||
LangOptsNoCPP.CPlusPlus2a = false;
|
LangOptsNoCPP.CPlusPlus20 = false;
|
||||||
return !isKeyword(LangOptsNoCPP);
|
return !isKeyword(LangOptsNoCPP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ static void addVisualCDefines(const LangOptions &Opts, MacroBuilder &Builder) {
|
|||||||
Builder.defineMacro("_HAS_CHAR16_T_LANGUAGE_SUPPORT", Twine(1));
|
Builder.defineMacro("_HAS_CHAR16_T_LANGUAGE_SUPPORT", Twine(1));
|
||||||
|
|
||||||
if (Opts.isCompatibleWithMSVC(LangOptions::MSVC2015)) {
|
if (Opts.isCompatibleWithMSVC(LangOptions::MSVC2015)) {
|
||||||
if (Opts.CPlusPlus2a)
|
if (Opts.CPlusPlus20)
|
||||||
Builder.defineMacro("_MSVC_LANG", "201705L");
|
Builder.defineMacro("_MSVC_LANG", "201705L");
|
||||||
else if (Opts.CPlusPlus17)
|
else if (Opts.CPlusPlus17)
|
||||||
Builder.defineMacro("_MSVC_LANG", "201703L");
|
Builder.defineMacro("_MSVC_LANG", "201703L");
|
||||||
|
@ -3792,7 +3792,7 @@ Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) {
|
|||||||
bool SanitizeBase = CGF.SanOpts.has(SanitizerKind::ShiftBase) &&
|
bool SanitizeBase = CGF.SanOpts.has(SanitizerKind::ShiftBase) &&
|
||||||
Ops.Ty->hasSignedIntegerRepresentation() &&
|
Ops.Ty->hasSignedIntegerRepresentation() &&
|
||||||
!CGF.getLangOpts().isSignedOverflowDefined() &&
|
!CGF.getLangOpts().isSignedOverflowDefined() &&
|
||||||
!CGF.getLangOpts().CPlusPlus2a;
|
!CGF.getLangOpts().CPlusPlus20;
|
||||||
bool SanitizeExponent = CGF.SanOpts.has(SanitizerKind::ShiftExponent);
|
bool SanitizeExponent = CGF.SanOpts.has(SanitizerKind::ShiftExponent);
|
||||||
// OpenCL 6.3j: shift values are effectively % word size of LHS.
|
// OpenCL 6.3j: shift values are effectively % word size of LHS.
|
||||||
if (CGF.getLangOpts().OpenCL)
|
if (CGF.getLangOpts().OpenCL)
|
||||||
|
@ -288,7 +288,7 @@ llvm::Expected<const T *> CrossTranslationUnitContext::getCrossTUDefinitionImpl(
|
|||||||
if (LangTo.CPlusPlus11 != LangFrom.CPlusPlus11 ||
|
if (LangTo.CPlusPlus11 != LangFrom.CPlusPlus11 ||
|
||||||
LangTo.CPlusPlus14 != LangFrom.CPlusPlus14 ||
|
LangTo.CPlusPlus14 != LangFrom.CPlusPlus14 ||
|
||||||
LangTo.CPlusPlus17 != LangFrom.CPlusPlus17 ||
|
LangTo.CPlusPlus17 != LangFrom.CPlusPlus17 ||
|
||||||
LangTo.CPlusPlus2a != LangFrom.CPlusPlus2a) {
|
LangTo.CPlusPlus20 != LangFrom.CPlusPlus20) {
|
||||||
++NumLangDialectMismatch;
|
++NumLangDialectMismatch;
|
||||||
return llvm::make_error<IndexError>(
|
return llvm::make_error<IndexError>(
|
||||||
index_error_code::lang_dialect_mismatch);
|
index_error_code::lang_dialect_mismatch);
|
||||||
|
@ -2621,7 +2621,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) {
|
|||||||
LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11;
|
LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11;
|
||||||
LangOpts.CPlusPlus14 = LexingStd >= FormatStyle::LS_Cpp14;
|
LangOpts.CPlusPlus14 = LexingStd >= FormatStyle::LS_Cpp14;
|
||||||
LangOpts.CPlusPlus17 = LexingStd >= FormatStyle::LS_Cpp17;
|
LangOpts.CPlusPlus17 = LexingStd >= FormatStyle::LS_Cpp17;
|
||||||
LangOpts.CPlusPlus2a = LexingStd >= FormatStyle::LS_Cpp20;
|
LangOpts.CPlusPlus20 = LexingStd >= FormatStyle::LS_Cpp20;
|
||||||
|
|
||||||
LangOpts.LineComment = 1;
|
LangOpts.LineComment = 1;
|
||||||
bool AlternativeOperators = Style.isCpp();
|
bool AlternativeOperators = Style.isCpp();
|
||||||
|
@ -2287,7 +2287,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
|
|||||||
Opts.CPlusPlus11 = Std.isCPlusPlus11();
|
Opts.CPlusPlus11 = Std.isCPlusPlus11();
|
||||||
Opts.CPlusPlus14 = Std.isCPlusPlus14();
|
Opts.CPlusPlus14 = Std.isCPlusPlus14();
|
||||||
Opts.CPlusPlus17 = Std.isCPlusPlus17();
|
Opts.CPlusPlus17 = Std.isCPlusPlus17();
|
||||||
Opts.CPlusPlus2a = Std.isCPlusPlus2a();
|
Opts.CPlusPlus20 = Std.isCPlusPlus20();
|
||||||
Opts.Digraphs = Std.hasDigraphs();
|
Opts.Digraphs = Std.hasDigraphs();
|
||||||
Opts.GNUMode = Std.isGNUMode();
|
Opts.GNUMode = Std.isGNUMode();
|
||||||
Opts.GNUInline = !Opts.C99 && !Opts.CPlusPlus;
|
Opts.GNUInline = !Opts.C99 && !Opts.CPlusPlus;
|
||||||
@ -2816,7 +2816,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
|||||||
Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
|
Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
|
||||||
&& Opts.OpenCLVersion == 200);
|
&& Opts.OpenCLVersion == 200);
|
||||||
Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
|
Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
|
||||||
Opts.Coroutines = Opts.CPlusPlus2a || Args.hasArg(OPT_fcoroutines_ts);
|
Opts.Coroutines = Opts.CPlusPlus20 || Args.hasArg(OPT_fcoroutines_ts);
|
||||||
|
|
||||||
Opts.ConvergentFunctions = Opts.OpenCL || (Opts.CUDA && Opts.CUDAIsDevice) ||
|
Opts.ConvergentFunctions = Opts.OpenCL || (Opts.CUDA && Opts.CUDAIsDevice) ||
|
||||||
Args.hasArg(OPT_fconvergent_functions);
|
Args.hasArg(OPT_fconvergent_functions);
|
||||||
@ -2826,7 +2826,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
|||||||
OPT_fno_double_square_bracket_attributes,
|
OPT_fno_double_square_bracket_attributes,
|
||||||
Opts.DoubleSquareBracketAttributes);
|
Opts.DoubleSquareBracketAttributes);
|
||||||
|
|
||||||
Opts.CPlusPlusModules = Opts.CPlusPlus2a;
|
Opts.CPlusPlusModules = Opts.CPlusPlus20;
|
||||||
Opts.ModulesTS = Args.hasArg(OPT_fmodules_ts);
|
Opts.ModulesTS = Args.hasArg(OPT_fmodules_ts);
|
||||||
Opts.Modules =
|
Opts.Modules =
|
||||||
Args.hasArg(OPT_fmodules) || Opts.ModulesTS || Opts.CPlusPlusModules;
|
Args.hasArg(OPT_fmodules) || Opts.ModulesTS || Opts.CPlusPlusModules;
|
||||||
@ -2847,7 +2847,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
|||||||
Opts.ImplicitModules = !Args.hasArg(OPT_fno_implicit_modules);
|
Opts.ImplicitModules = !Args.hasArg(OPT_fno_implicit_modules);
|
||||||
Opts.CharIsSigned = Opts.OpenCL || !Args.hasArg(OPT_fno_signed_char);
|
Opts.CharIsSigned = Opts.OpenCL || !Args.hasArg(OPT_fno_signed_char);
|
||||||
Opts.WChar = Opts.CPlusPlus && !Args.hasArg(OPT_fno_wchar);
|
Opts.WChar = Opts.CPlusPlus && !Args.hasArg(OPT_fno_wchar);
|
||||||
Opts.Char8 = Args.hasFlag(OPT_fchar8__t, OPT_fno_char8__t, Opts.CPlusPlus2a);
|
Opts.Char8 = Args.hasFlag(OPT_fchar8__t, OPT_fno_char8__t, Opts.CPlusPlus20);
|
||||||
if (const Arg *A = Args.getLastArg(OPT_fwchar_type_EQ)) {
|
if (const Arg *A = Args.getLastArg(OPT_fwchar_type_EQ)) {
|
||||||
Opts.WCharSize = llvm::StringSwitch<unsigned>(A->getValue())
|
Opts.WCharSize = llvm::StringSwitch<unsigned>(A->getValue())
|
||||||
.Case("char", 1)
|
.Case("char", 1)
|
||||||
|
@ -377,7 +377,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
|
|||||||
} else {
|
} else {
|
||||||
// -- __cplusplus
|
// -- __cplusplus
|
||||||
// [C++20] The integer literal 202002L.
|
// [C++20] The integer literal 202002L.
|
||||||
if (LangOpts.CPlusPlus2a)
|
if (LangOpts.CPlusPlus20)
|
||||||
Builder.defineMacro("__cplusplus", "202002L");
|
Builder.defineMacro("__cplusplus", "202002L");
|
||||||
// [C++17] The integer literal 201703L.
|
// [C++17] The integer literal 201703L.
|
||||||
else if (LangOpts.CPlusPlus17)
|
else if (LangOpts.CPlusPlus17)
|
||||||
@ -498,7 +498,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
|
|||||||
Builder.defineMacro("__cpp_user_defined_literals", "200809L");
|
Builder.defineMacro("__cpp_user_defined_literals", "200809L");
|
||||||
Builder.defineMacro("__cpp_lambdas", "200907L");
|
Builder.defineMacro("__cpp_lambdas", "200907L");
|
||||||
Builder.defineMacro("__cpp_constexpr",
|
Builder.defineMacro("__cpp_constexpr",
|
||||||
LangOpts.CPlusPlus2a ? "201907L" :
|
LangOpts.CPlusPlus20 ? "201907L" :
|
||||||
LangOpts.CPlusPlus17 ? "201603L" :
|
LangOpts.CPlusPlus17 ? "201603L" :
|
||||||
LangOpts.CPlusPlus14 ? "201304L" : "200704");
|
LangOpts.CPlusPlus14 ? "201304L" : "200704");
|
||||||
Builder.defineMacro("__cpp_constexpr_in_decltype", "201711L");
|
Builder.defineMacro("__cpp_constexpr_in_decltype", "201711L");
|
||||||
@ -525,9 +525,9 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
|
|||||||
Builder.defineMacro("__cpp_binary_literals", "201304L");
|
Builder.defineMacro("__cpp_binary_literals", "201304L");
|
||||||
Builder.defineMacro("__cpp_digit_separators", "201309L");
|
Builder.defineMacro("__cpp_digit_separators", "201309L");
|
||||||
Builder.defineMacro("__cpp_init_captures",
|
Builder.defineMacro("__cpp_init_captures",
|
||||||
LangOpts.CPlusPlus2a ? "201803L" : "201304L");
|
LangOpts.CPlusPlus20 ? "201803L" : "201304L");
|
||||||
Builder.defineMacro("__cpp_generic_lambdas",
|
Builder.defineMacro("__cpp_generic_lambdas",
|
||||||
LangOpts.CPlusPlus2a ? "201707L" : "201304L");
|
LangOpts.CPlusPlus20 ? "201707L" : "201304L");
|
||||||
Builder.defineMacro("__cpp_decltype_auto", "201304L");
|
Builder.defineMacro("__cpp_decltype_auto", "201304L");
|
||||||
Builder.defineMacro("__cpp_return_type_deduction", "201304L");
|
Builder.defineMacro("__cpp_return_type_deduction", "201304L");
|
||||||
Builder.defineMacro("__cpp_aggregate_nsdmi", "201304L");
|
Builder.defineMacro("__cpp_aggregate_nsdmi", "201304L");
|
||||||
@ -563,7 +563,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
|
|||||||
Builder.defineMacro("__cpp_template_template_args", "201611L");
|
Builder.defineMacro("__cpp_template_template_args", "201611L");
|
||||||
|
|
||||||
// C++20 features.
|
// C++20 features.
|
||||||
if (LangOpts.CPlusPlus2a) {
|
if (LangOpts.CPlusPlus20) {
|
||||||
//Builder.defineMacro("__cpp_aggregate_paren_init", "201902L");
|
//Builder.defineMacro("__cpp_aggregate_paren_init", "201902L");
|
||||||
Builder.defineMacro("__cpp_concepts", "201907L");
|
Builder.defineMacro("__cpp_concepts", "201907L");
|
||||||
Builder.defineMacro("__cpp_conditional_explicit", "201806L");
|
Builder.defineMacro("__cpp_conditional_explicit", "201806L");
|
||||||
|
@ -3700,7 +3700,7 @@ LexNextToken:
|
|||||||
} else if (Char == '=') {
|
} else if (Char == '=') {
|
||||||
char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2);
|
char After = getCharAndSize(CurPtr+SizeTmp, SizeTmp2);
|
||||||
if (After == '>') {
|
if (After == '>') {
|
||||||
if (getLangOpts().CPlusPlus2a) {
|
if (getLangOpts().CPlusPlus20) {
|
||||||
if (!isLexingRawMode())
|
if (!isLexingRawMode())
|
||||||
Diag(BufferPtr, diag::warn_cxx17_compat_spaceship);
|
Diag(BufferPtr, diag::warn_cxx17_compat_spaceship);
|
||||||
CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
|
CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
|
||||||
|
@ -816,7 +816,7 @@ bool NumericLiteralParser::isValidUDSuffix(const LangOptions &LangOpts,
|
|||||||
.Cases("h", "min", "s", true)
|
.Cases("h", "min", "s", true)
|
||||||
.Cases("ms", "us", "ns", true)
|
.Cases("ms", "us", "ns", true)
|
||||||
.Cases("il", "i", "if", true)
|
.Cases("il", "i", "if", true)
|
||||||
.Cases("d", "y", LangOpts.CPlusPlus2a)
|
.Cases("d", "y", LangOpts.CPlusPlus20)
|
||||||
.Default(false);
|
.Default(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ Preprocessor::Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts,
|
|||||||
// a macro. They get unpoisoned where it is allowed.
|
// a macro. They get unpoisoned where it is allowed.
|
||||||
(Ident__VA_ARGS__ = getIdentifierInfo("__VA_ARGS__"))->setIsPoisoned();
|
(Ident__VA_ARGS__ = getIdentifierInfo("__VA_ARGS__"))->setIsPoisoned();
|
||||||
SetPoisonReason(Ident__VA_ARGS__,diag::ext_pp_bad_vaargs_use);
|
SetPoisonReason(Ident__VA_ARGS__,diag::ext_pp_bad_vaargs_use);
|
||||||
if (getLangOpts().CPlusPlus2a) {
|
if (getLangOpts().CPlusPlus20) {
|
||||||
(Ident__VA_OPT__ = getIdentifierInfo("__VA_OPT__"))->setIsPoisoned();
|
(Ident__VA_OPT__ = getIdentifierInfo("__VA_OPT__"))->setIsPoisoned();
|
||||||
SetPoisonReason(Ident__VA_OPT__,diag::ext_pp_bad_vaopt_use);
|
SetPoisonReason(Ident__VA_OPT__,diag::ext_pp_bad_vaopt_use);
|
||||||
} else {
|
} else {
|
||||||
@ -771,7 +771,7 @@ static diag::kind getFutureCompatDiagKind(const IdentifierInfo &II,
|
|||||||
return llvm::StringSwitch<diag::kind>(II.getName())
|
return llvm::StringSwitch<diag::kind>(II.getName())
|
||||||
#define CXX11_KEYWORD(NAME, FLAGS) \
|
#define CXX11_KEYWORD(NAME, FLAGS) \
|
||||||
.Case(#NAME, diag::warn_cxx11_keyword)
|
.Case(#NAME, diag::warn_cxx11_keyword)
|
||||||
#define CXX2A_KEYWORD(NAME, FLAGS) \
|
#define CXX20_KEYWORD(NAME, FLAGS) \
|
||||||
.Case(#NAME, diag::warn_cxx2a_keyword)
|
.Case(#NAME, diag::warn_cxx2a_keyword)
|
||||||
#include "clang/Basic/TokenKinds.def"
|
#include "clang/Basic/TokenKinds.def"
|
||||||
;
|
;
|
||||||
|
@ -103,7 +103,7 @@ TokenConcatenation::TokenConcatenation(const Preprocessor &pp) : PP(pp) {
|
|||||||
TokenInfo[tok::utf8_char_constant] |= aci_custom;
|
TokenInfo[tok::utf8_char_constant] |= aci_custom;
|
||||||
|
|
||||||
// These tokens have custom code in C++2a mode.
|
// These tokens have custom code in C++2a mode.
|
||||||
if (PP.getLangOpts().CPlusPlus2a)
|
if (PP.getLangOpts().CPlusPlus20)
|
||||||
TokenInfo[tok::lessequal ] |= aci_custom_firstchar;
|
TokenInfo[tok::lessequal ] |= aci_custom_firstchar;
|
||||||
|
|
||||||
// These tokens change behavior if followed by an '='.
|
// These tokens change behavior if followed by an '='.
|
||||||
@ -292,6 +292,6 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok,
|
|||||||
case tok::arrow: // ->*
|
case tok::arrow: // ->*
|
||||||
return PP.getLangOpts().CPlusPlus && FirstChar == '*';
|
return PP.getLangOpts().CPlusPlus && FirstChar == '*';
|
||||||
case tok::lessequal: // <=> (C++2a)
|
case tok::lessequal: // <=> (C++2a)
|
||||||
return PP.getLangOpts().CPlusPlus2a && FirstChar == '>';
|
return PP.getLangOpts().CPlusPlus20 && FirstChar == '>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2359,7 +2359,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
|
|||||||
<< 0 /* default */;
|
<< 0 /* default */;
|
||||||
else
|
else
|
||||||
Diag(ConsumeToken(), diag::err_default_special_members)
|
Diag(ConsumeToken(), diag::err_default_special_members)
|
||||||
<< getLangOpts().CPlusPlus2a;
|
<< getLangOpts().CPlusPlus20;
|
||||||
} else {
|
} else {
|
||||||
InitializerScopeRAII InitScope(*this, D, ThisDecl);
|
InitializerScopeRAII InitScope(*this, D, ThisDecl);
|
||||||
|
|
||||||
@ -3712,8 +3712,8 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
|||||||
ConsumedEnd = ExplicitLoc;
|
ConsumedEnd = ExplicitLoc;
|
||||||
ConsumeToken(); // kw_explicit
|
ConsumeToken(); // kw_explicit
|
||||||
if (Tok.is(tok::l_paren)) {
|
if (Tok.is(tok::l_paren)) {
|
||||||
if (getLangOpts().CPlusPlus2a || isExplicitBool() == TPResult::True) {
|
if (getLangOpts().CPlusPlus20 || isExplicitBool() == TPResult::True) {
|
||||||
Diag(Tok.getLocation(), getLangOpts().CPlusPlus2a
|
Diag(Tok.getLocation(), getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_explicit_bool
|
? diag::warn_cxx17_compat_explicit_bool
|
||||||
: diag::ext_explicit_bool);
|
: diag::ext_explicit_bool);
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ Parser::DeclGroupPtrTy Parser::ParseNamespace(DeclaratorContext Context,
|
|||||||
// Normal namespace definition, not a nested-namespace-definition.
|
// Normal namespace definition, not a nested-namespace-definition.
|
||||||
} else if (InlineLoc.isValid()) {
|
} else if (InlineLoc.isValid()) {
|
||||||
Diag(InlineLoc, diag::err_inline_nested_namespace_definition);
|
Diag(InlineLoc, diag::err_inline_nested_namespace_definition);
|
||||||
} else if (getLangOpts().CPlusPlus2a) {
|
} else if (getLangOpts().CPlusPlus20) {
|
||||||
Diag(ExtraNSs[0].NamespaceLoc,
|
Diag(ExtraNSs[0].NamespaceLoc,
|
||||||
diag::warn_cxx14_compat_nested_namespace_definition);
|
diag::warn_cxx14_compat_nested_namespace_definition);
|
||||||
if (FirstNestedInlineLoc.isValid())
|
if (FirstNestedInlineLoc.isValid())
|
||||||
@ -2787,7 +2787,7 @@ Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
|||||||
!DS.isFriendSpecified()) {
|
!DS.isFriendSpecified()) {
|
||||||
// It's a default member initializer.
|
// It's a default member initializer.
|
||||||
if (BitfieldSize.get())
|
if (BitfieldSize.get())
|
||||||
Diag(Tok, getLangOpts().CPlusPlus2a
|
Diag(Tok, getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_bitfield_member_init
|
? diag::warn_cxx17_compat_bitfield_member_init
|
||||||
: diag::ext_bitfield_member_init);
|
: diag::ext_bitfield_member_init);
|
||||||
HasInClassInit = Tok.is(tok::equal) ? ICIS_CopyInit : ICIS_ListInit;
|
HasInClassInit = Tok.is(tok::equal) ? ICIS_CopyInit : ICIS_ListInit;
|
||||||
@ -2992,7 +2992,7 @@ ExprResult Parser::ParseCXXMemberInitializer(Decl *D, bool IsFunction,
|
|||||||
<< 0 /* default */;
|
<< 0 /* default */;
|
||||||
else
|
else
|
||||||
Diag(ConsumeToken(), diag::err_default_special_members)
|
Diag(ConsumeToken(), diag::err_default_special_members)
|
||||||
<< getLangOpts().CPlusPlus2a;
|
<< getLangOpts().CPlusPlus20;
|
||||||
return ExprError();
|
return ExprError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1261,7 +1261,7 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
|
|||||||
ParseScope TemplateParamScope(this, Scope::TemplateParamScope,
|
ParseScope TemplateParamScope(this, Scope::TemplateParamScope,
|
||||||
/*EnteredScope=*/HasExplicitTemplateParams);
|
/*EnteredScope=*/HasExplicitTemplateParams);
|
||||||
if (HasExplicitTemplateParams) {
|
if (HasExplicitTemplateParams) {
|
||||||
Diag(Tok, getLangOpts().CPlusPlus2a
|
Diag(Tok, getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_lambda_template_parameter_list
|
? diag::warn_cxx17_compat_lambda_template_parameter_list
|
||||||
: diag::ext_lambda_template_parameter_list);
|
: diag::ext_lambda_template_parameter_list);
|
||||||
|
|
||||||
|
@ -1922,7 +1922,7 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) {
|
|||||||
if (ForRangeInfo.ParsedForRangeDecl()) {
|
if (ForRangeInfo.ParsedForRangeDecl()) {
|
||||||
Diag(FirstPart.get() ? FirstPart.get()->getBeginLoc()
|
Diag(FirstPart.get() ? FirstPart.get()->getBeginLoc()
|
||||||
: ForRangeInfo.ColonLoc,
|
: ForRangeInfo.ColonLoc,
|
||||||
getLangOpts().CPlusPlus2a
|
getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_for_range_init_stmt
|
? diag::warn_cxx17_compat_for_range_init_stmt
|
||||||
: diag::ext_for_range_init_stmt)
|
: diag::ext_for_range_init_stmt)
|
||||||
<< (FirstPart.get() ? FirstPart.get()->getSourceRange()
|
<< (FirstPart.get() ? FirstPart.get()->getSourceRange()
|
||||||
|
@ -680,7 +680,7 @@ bool Parser::isTypeConstraintAnnotation() {
|
|||||||
///
|
///
|
||||||
/// \returns true if an error occurred, and false otherwise.
|
/// \returns true if an error occurred, and false otherwise.
|
||||||
bool Parser::TryAnnotateTypeConstraint() {
|
bool Parser::TryAnnotateTypeConstraint() {
|
||||||
if (!getLangOpts().CPlusPlus2a)
|
if (!getLangOpts().CPlusPlus20)
|
||||||
return false;
|
return false;
|
||||||
CXXScopeSpec SS;
|
CXXScopeSpec SS;
|
||||||
bool WasScopeAnnotation = Tok.is(tok::annot_cxxscope);
|
bool WasScopeAnnotation = Tok.is(tok::annot_cxxscope);
|
||||||
|
@ -926,7 +926,7 @@ Corrected:
|
|||||||
return NameClassification::NonType(D);
|
return NameClassification::NonType(D);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getLangOpts().CPlusPlus2a && SS.isEmpty() && NextToken.is(tok::less)) {
|
if (getLangOpts().CPlusPlus20 && SS.isEmpty() && NextToken.is(tok::less)) {
|
||||||
// In C++20 onwards, this could be an ADL-only call to a function
|
// In C++20 onwards, this could be an ADL-only call to a function
|
||||||
// template, and we're required to assume that this is a template name.
|
// template, and we're required to assume that this is a template name.
|
||||||
//
|
//
|
||||||
@ -1069,7 +1069,7 @@ Corrected:
|
|||||||
Result, /*AllowFunctionTemplates=*/true,
|
Result, /*AllowFunctionTemplates=*/true,
|
||||||
/*AllowDependent=*/false,
|
/*AllowDependent=*/false,
|
||||||
/*AllowNonTemplateFunctions*/ SS.isEmpty() &&
|
/*AllowNonTemplateFunctions*/ SS.isEmpty() &&
|
||||||
getLangOpts().CPlusPlus2a))) {
|
getLangOpts().CPlusPlus20))) {
|
||||||
// C++ [temp.names]p3:
|
// C++ [temp.names]p3:
|
||||||
// After name lookup (3.4) finds that a name is a template-name or that
|
// After name lookup (3.4) finds that a name is a template-name or that
|
||||||
// an operator-function-id or a literal- operator-id refers to a set of
|
// an operator-function-id or a literal- operator-id refers to a set of
|
||||||
@ -2759,7 +2759,7 @@ static void diagnoseMissingConstinit(Sema &S, const VarDecl *InitDecl,
|
|||||||
// enough of the attribute list spelling information to extract that without
|
// enough of the attribute list spelling information to extract that without
|
||||||
// heroics.
|
// heroics.
|
||||||
std::string SuitableSpelling;
|
std::string SuitableSpelling;
|
||||||
if (S.getLangOpts().CPlusPlus2a)
|
if (S.getLangOpts().CPlusPlus20)
|
||||||
SuitableSpelling = std::string(
|
SuitableSpelling = std::string(
|
||||||
S.PP.getLastMacroWithSpelling(InsertLoc, {tok::kw_constinit}));
|
S.PP.getLastMacroWithSpelling(InsertLoc, {tok::kw_constinit}));
|
||||||
if (SuitableSpelling.empty() && S.getLangOpts().CPlusPlus11)
|
if (SuitableSpelling.empty() && S.getLangOpts().CPlusPlus11)
|
||||||
@ -2773,7 +2773,7 @@ static void diagnoseMissingConstinit(Sema &S, const VarDecl *InitDecl,
|
|||||||
InsertLoc, {tok::kw___attribute, tok::l_paren, tok::r_paren,
|
InsertLoc, {tok::kw___attribute, tok::l_paren, tok::r_paren,
|
||||||
S.PP.getIdentifierInfo("require_constant_initialization"),
|
S.PP.getIdentifierInfo("require_constant_initialization"),
|
||||||
tok::r_paren, tok::r_paren}));
|
tok::r_paren, tok::r_paren}));
|
||||||
if (SuitableSpelling.empty() && S.getLangOpts().CPlusPlus2a)
|
if (SuitableSpelling.empty() && S.getLangOpts().CPlusPlus20)
|
||||||
SuitableSpelling = "constinit";
|
SuitableSpelling = "constinit";
|
||||||
if (SuitableSpelling.empty() && S.getLangOpts().CPlusPlus11)
|
if (SuitableSpelling.empty() && S.getLangOpts().CPlusPlus11)
|
||||||
SuitableSpelling = "[[clang::require_constant_initialization]]";
|
SuitableSpelling = "[[clang::require_constant_initialization]]";
|
||||||
@ -9038,10 +9038,10 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
|
|||||||
// be either constructors or to return a literal type. Therefore,
|
// be either constructors or to return a literal type. Therefore,
|
||||||
// destructors cannot be declared constexpr.
|
// destructors cannot be declared constexpr.
|
||||||
if (isa<CXXDestructorDecl>(NewFD) &&
|
if (isa<CXXDestructorDecl>(NewFD) &&
|
||||||
(!getLangOpts().CPlusPlus2a || ConstexprKind == CSK_consteval)) {
|
(!getLangOpts().CPlusPlus20 || ConstexprKind == CSK_consteval)) {
|
||||||
Diag(D.getDeclSpec().getConstexprSpecLoc(), diag::err_constexpr_dtor)
|
Diag(D.getDeclSpec().getConstexprSpecLoc(), diag::err_constexpr_dtor)
|
||||||
<< ConstexprKind;
|
<< ConstexprKind;
|
||||||
NewFD->setConstexprKind(getLangOpts().CPlusPlus2a ? CSK_unspecified : CSK_constexpr);
|
NewFD->setConstexprKind(getLangOpts().CPlusPlus20 ? CSK_unspecified : CSK_constexpr);
|
||||||
}
|
}
|
||||||
// C++20 [dcl.constexpr]p2: An allocation function, or a
|
// C++20 [dcl.constexpr]p2: An allocation function, or a
|
||||||
// deallocation function shall not be declared with the consteval
|
// deallocation function shall not be declared with the consteval
|
||||||
|
@ -2839,7 +2839,7 @@ static void handleWarnUnusedResult(Sema &S, Decl *D, const ParsedAttr &AL) {
|
|||||||
// extension warning for C2x mode.
|
// extension warning for C2x mode.
|
||||||
const LangOptions &LO = S.getLangOpts();
|
const LangOptions &LO = S.getLangOpts();
|
||||||
if (AL.getNumArgs() == 1) {
|
if (AL.getNumArgs() == 1) {
|
||||||
if (LO.CPlusPlus && !LO.CPlusPlus2a)
|
if (LO.CPlusPlus && !LO.CPlusPlus20)
|
||||||
S.Diag(AL.getLoc(), diag::ext_cxx2a_attr) << AL;
|
S.Diag(AL.getLoc(), diag::ext_cxx2a_attr) << AL;
|
||||||
|
|
||||||
// Since this this is spelled [[nodiscard]], get the optional string
|
// Since this this is spelled [[nodiscard]], get the optional string
|
||||||
|
@ -761,7 +761,7 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D,
|
|||||||
Err << SourceRange(Loc, Loc);
|
Err << SourceRange(Loc, Loc);
|
||||||
} else if (!CPlusPlus20Specifiers.empty()) {
|
} else if (!CPlusPlus20Specifiers.empty()) {
|
||||||
auto &&Warn = Diag(CPlusPlus20SpecifierLocs.front(),
|
auto &&Warn = Diag(CPlusPlus20SpecifierLocs.front(),
|
||||||
getLangOpts().CPlusPlus2a
|
getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_decomp_decl_spec
|
? diag::warn_cxx17_compat_decomp_decl_spec
|
||||||
: diag::ext_decomp_decl_spec);
|
: diag::ext_decomp_decl_spec);
|
||||||
Warn << (int)CPlusPlus20Specifiers.size()
|
Warn << (int)CPlusPlus20Specifiers.size()
|
||||||
@ -778,7 +778,7 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D,
|
|||||||
// C++2a [dcl.struct.bind]p1:
|
// C++2a [dcl.struct.bind]p1:
|
||||||
// A cv that includes volatile is deprecated
|
// A cv that includes volatile is deprecated
|
||||||
if ((DS.getTypeQualifiers() & DeclSpec::TQ_volatile) &&
|
if ((DS.getTypeQualifiers() & DeclSpec::TQ_volatile) &&
|
||||||
getLangOpts().CPlusPlus2a)
|
getLangOpts().CPlusPlus20)
|
||||||
Diag(DS.getVolatileSpecLoc(),
|
Diag(DS.getVolatileSpecLoc(),
|
||||||
diag::warn_deprecated_volatile_structured_binding);
|
diag::warn_deprecated_volatile_structured_binding);
|
||||||
|
|
||||||
@ -1716,7 +1716,7 @@ bool Sema::CheckConstexprFunctionDefinition(const FunctionDecl *NewFD,
|
|||||||
// - it shall not be virtual; (removed in C++20)
|
// - it shall not be virtual; (removed in C++20)
|
||||||
const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(NewFD);
|
const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(NewFD);
|
||||||
if (Method && Method->isVirtual()) {
|
if (Method && Method->isVirtual()) {
|
||||||
if (getLangOpts().CPlusPlus2a) {
|
if (getLangOpts().CPlusPlus20) {
|
||||||
if (Kind == CheckConstexprKind::Diagnose)
|
if (Kind == CheckConstexprKind::Diagnose)
|
||||||
Diag(Method->getLocation(), diag::warn_cxx17_compat_constexpr_virtual);
|
Diag(Method->getLocation(), diag::warn_cxx17_compat_constexpr_virtual);
|
||||||
} else {
|
} else {
|
||||||
@ -1856,11 +1856,11 @@ static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl,
|
|||||||
if (Kind == Sema::CheckConstexprKind::Diagnose) {
|
if (Kind == Sema::CheckConstexprKind::Diagnose) {
|
||||||
SemaRef.Diag(
|
SemaRef.Diag(
|
||||||
VD->getLocation(),
|
VD->getLocation(),
|
||||||
SemaRef.getLangOpts().CPlusPlus2a
|
SemaRef.getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_constexpr_local_var_no_init
|
? diag::warn_cxx17_compat_constexpr_local_var_no_init
|
||||||
: diag::ext_constexpr_local_var_no_init)
|
: diag::ext_constexpr_local_var_no_init)
|
||||||
<< isa<CXXConstructorDecl>(Dcl);
|
<< isa<CXXConstructorDecl>(Dcl);
|
||||||
} else if (!SemaRef.getLangOpts().CPlusPlus2a) {
|
} else if (!SemaRef.getLangOpts().CPlusPlus20) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -1919,7 +1919,7 @@ static bool CheckConstexprCtorInitializer(Sema &SemaRef,
|
|||||||
Sema::CheckConstexprKind Kind) {
|
Sema::CheckConstexprKind Kind) {
|
||||||
// In C++20 onwards, there's nothing to check for validity.
|
// In C++20 onwards, there's nothing to check for validity.
|
||||||
if (Kind == Sema::CheckConstexprKind::CheckValid &&
|
if (Kind == Sema::CheckConstexprKind::CheckValid &&
|
||||||
SemaRef.getLangOpts().CPlusPlus2a)
|
SemaRef.getLangOpts().CPlusPlus20)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Field->isInvalidDecl())
|
if (Field->isInvalidDecl())
|
||||||
@ -1941,14 +1941,14 @@ static bool CheckConstexprCtorInitializer(Sema &SemaRef,
|
|||||||
if (Kind == Sema::CheckConstexprKind::Diagnose) {
|
if (Kind == Sema::CheckConstexprKind::Diagnose) {
|
||||||
if (!Diagnosed) {
|
if (!Diagnosed) {
|
||||||
SemaRef.Diag(Dcl->getLocation(),
|
SemaRef.Diag(Dcl->getLocation(),
|
||||||
SemaRef.getLangOpts().CPlusPlus2a
|
SemaRef.getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_constexpr_ctor_missing_init
|
? diag::warn_cxx17_compat_constexpr_ctor_missing_init
|
||||||
: diag::ext_constexpr_ctor_missing_init);
|
: diag::ext_constexpr_ctor_missing_init);
|
||||||
Diagnosed = true;
|
Diagnosed = true;
|
||||||
}
|
}
|
||||||
SemaRef.Diag(Field->getLocation(),
|
SemaRef.Diag(Field->getLocation(),
|
||||||
diag::note_constexpr_ctor_missing_init);
|
diag::note_constexpr_ctor_missing_init);
|
||||||
} else if (!SemaRef.getLangOpts().CPlusPlus2a) {
|
} else if (!SemaRef.getLangOpts().CPlusPlus20) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (Field->isAnonymousStructOrUnion()) {
|
} else if (Field->isAnonymousStructOrUnion()) {
|
||||||
@ -2132,13 +2132,13 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl,
|
|||||||
// apply the general constexpr rules.
|
// apply the general constexpr rules.
|
||||||
switch (Kind) {
|
switch (Kind) {
|
||||||
case Sema::CheckConstexprKind::CheckValid:
|
case Sema::CheckConstexprKind::CheckValid:
|
||||||
if (!SemaRef.getLangOpts().CPlusPlus2a)
|
if (!SemaRef.getLangOpts().CPlusPlus20)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Sema::CheckConstexprKind::Diagnose:
|
case Sema::CheckConstexprKind::Diagnose:
|
||||||
SemaRef.Diag(Body->getBeginLoc(),
|
SemaRef.Diag(Body->getBeginLoc(),
|
||||||
!SemaRef.getLangOpts().CPlusPlus2a
|
!SemaRef.getLangOpts().CPlusPlus20
|
||||||
? diag::ext_constexpr_function_try_block_cxx2a
|
? diag::ext_constexpr_function_try_block_cxx2a
|
||||||
: diag::warn_cxx17_compat_constexpr_function_try_block)
|
: diag::warn_cxx17_compat_constexpr_function_try_block)
|
||||||
<< isa<CXXConstructorDecl>(Dcl);
|
<< isa<CXXConstructorDecl>(Dcl);
|
||||||
@ -2162,12 +2162,12 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl,
|
|||||||
if (Kind == Sema::CheckConstexprKind::CheckValid) {
|
if (Kind == Sema::CheckConstexprKind::CheckValid) {
|
||||||
// If this is only valid as an extension, report that we don't satisfy the
|
// If this is only valid as an extension, report that we don't satisfy the
|
||||||
// constraints of the current language.
|
// constraints of the current language.
|
||||||
if ((Cxx2aLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus2a) ||
|
if ((Cxx2aLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus20) ||
|
||||||
(Cxx1yLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus17))
|
(Cxx1yLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus17))
|
||||||
return false;
|
return false;
|
||||||
} else if (Cxx2aLoc.isValid()) {
|
} else if (Cxx2aLoc.isValid()) {
|
||||||
SemaRef.Diag(Cxx2aLoc,
|
SemaRef.Diag(Cxx2aLoc,
|
||||||
SemaRef.getLangOpts().CPlusPlus2a
|
SemaRef.getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_constexpr_body_invalid_stmt
|
? diag::warn_cxx17_compat_constexpr_body_invalid_stmt
|
||||||
: diag::ext_constexpr_body_invalid_stmt_cxx2a)
|
: diag::ext_constexpr_body_invalid_stmt_cxx2a)
|
||||||
<< isa<CXXConstructorDecl>(Dcl);
|
<< isa<CXXConstructorDecl>(Dcl);
|
||||||
@ -2194,10 +2194,10 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl,
|
|||||||
if (Kind == Sema::CheckConstexprKind::Diagnose) {
|
if (Kind == Sema::CheckConstexprKind::Diagnose) {
|
||||||
SemaRef.Diag(
|
SemaRef.Diag(
|
||||||
Dcl->getLocation(),
|
Dcl->getLocation(),
|
||||||
SemaRef.getLangOpts().CPlusPlus2a
|
SemaRef.getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_constexpr_union_ctor_no_init
|
? diag::warn_cxx17_compat_constexpr_union_ctor_no_init
|
||||||
: diag::ext_constexpr_union_ctor_no_init);
|
: diag::ext_constexpr_union_ctor_no_init);
|
||||||
} else if (!SemaRef.getLangOpts().CPlusPlus2a) {
|
} else if (!SemaRef.getLangOpts().CPlusPlus20) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6282,7 +6282,7 @@ Sema::getDefaultedFunctionKind(const FunctionDecl *FD) {
|
|||||||
|
|
||||||
case OO_Spaceship:
|
case OO_Spaceship:
|
||||||
// No point allowing this if <=> doesn't exist in the current language mode.
|
// No point allowing this if <=> doesn't exist in the current language mode.
|
||||||
if (!getLangOpts().CPlusPlus2a)
|
if (!getLangOpts().CPlusPlus20)
|
||||||
break;
|
break;
|
||||||
return DefaultedComparisonKind::ThreeWay;
|
return DefaultedComparisonKind::ThreeWay;
|
||||||
|
|
||||||
@ -6291,7 +6291,7 @@ Sema::getDefaultedFunctionKind(const FunctionDecl *FD) {
|
|||||||
case OO_Greater:
|
case OO_Greater:
|
||||||
case OO_GreaterEqual:
|
case OO_GreaterEqual:
|
||||||
// No point allowing this if <=> doesn't exist in the current language mode.
|
// No point allowing this if <=> doesn't exist in the current language mode.
|
||||||
if (!getLangOpts().CPlusPlus2a)
|
if (!getLangOpts().CPlusPlus20)
|
||||||
break;
|
break;
|
||||||
return DefaultedComparisonKind::Relational;
|
return DefaultedComparisonKind::Relational;
|
||||||
|
|
||||||
@ -7169,7 +7169,7 @@ bool Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD,
|
|||||||
// C++2a changes the second bullet to instead delete the function if it's
|
// C++2a changes the second bullet to instead delete the function if it's
|
||||||
// defaulted on its first declaration, unless it's "an assignment operator,
|
// defaulted on its first declaration, unless it's "an assignment operator,
|
||||||
// and its return type differs or its parameter type is not a reference".
|
// and its return type differs or its parameter type is not a reference".
|
||||||
bool DeleteOnTypeMismatch = getLangOpts().CPlusPlus2a && First;
|
bool DeleteOnTypeMismatch = getLangOpts().CPlusPlus20 && First;
|
||||||
bool ShouldDeleteForTypeMismatch = false;
|
bool ShouldDeleteForTypeMismatch = false;
|
||||||
unsigned ExpectedParams = 1;
|
unsigned ExpectedParams = 1;
|
||||||
if (CSM == CXXDefaultConstructor || CSM == CXXDestructor)
|
if (CSM == CXXDefaultConstructor || CSM == CXXDestructor)
|
||||||
@ -7279,7 +7279,7 @@ bool Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD,
|
|||||||
// FIXME: This should not apply if the member is deleted.
|
// FIXME: This should not apply if the member is deleted.
|
||||||
bool Constexpr = defaultedSpecialMemberIsConstexpr(*this, RD, CSM,
|
bool Constexpr = defaultedSpecialMemberIsConstexpr(*this, RD, CSM,
|
||||||
HasConstParam);
|
HasConstParam);
|
||||||
if ((getLangOpts().CPlusPlus2a ||
|
if ((getLangOpts().CPlusPlus20 ||
|
||||||
(getLangOpts().CPlusPlus14 ? !isa<CXXDestructorDecl>(MD)
|
(getLangOpts().CPlusPlus14 ? !isa<CXXDestructorDecl>(MD)
|
||||||
: isa<CXXConstructorDecl>(MD))) &&
|
: isa<CXXConstructorDecl>(MD))) &&
|
||||||
MD->isConstexpr() && !Constexpr &&
|
MD->isConstexpr() && !Constexpr &&
|
||||||
@ -9867,7 +9867,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
|
|||||||
// for each defaulted three-way comparison operator function defined in the
|
// for each defaulted three-way comparison operator function defined in the
|
||||||
// member-specification
|
// member-specification
|
||||||
// FIXME: Consider doing this lazily.
|
// FIXME: Consider doing this lazily.
|
||||||
if (getLangOpts().CPlusPlus2a) {
|
if (getLangOpts().CPlusPlus20) {
|
||||||
llvm::SmallVector<FunctionDecl*, 4> DefaultedSpaceships;
|
llvm::SmallVector<FunctionDecl*, 4> DefaultedSpaceships;
|
||||||
findImplicitlyDeclaredEqualityComparisons(Context, ClassDecl,
|
findImplicitlyDeclaredEqualityComparisons(Context, ClassDecl,
|
||||||
DefaultedSpaceships);
|
DefaultedSpaceships);
|
||||||
@ -10467,7 +10467,7 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R,
|
|||||||
R = Context.getFunctionType(ConvType, None, Proto->getExtProtoInfo());
|
R = Context.getFunctionType(ConvType, None, Proto->getExtProtoInfo());
|
||||||
|
|
||||||
// C++0x explicit conversion operators.
|
// C++0x explicit conversion operators.
|
||||||
if (DS.hasExplicitSpecifier() && !getLangOpts().CPlusPlus2a)
|
if (DS.hasExplicitSpecifier() && !getLangOpts().CPlusPlus20)
|
||||||
Diag(DS.getExplicitSpecLoc(),
|
Diag(DS.getExplicitSpecLoc(),
|
||||||
getLangOpts().CPlusPlus11
|
getLangOpts().CPlusPlus11
|
||||||
? diag::warn_cxx98_compat_explicit_conversion_functions
|
? diag::warn_cxx98_compat_explicit_conversion_functions
|
||||||
@ -16636,7 +16636,7 @@ void Sema::SetDeclDefaulted(Decl *Dcl, SourceLocation DefaultLoc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Diag(DefaultLoc, diag::err_default_special_members)
|
Diag(DefaultLoc, diag::err_default_special_members)
|
||||||
<< getLangOpts().CPlusPlus2a;
|
<< getLangOpts().CPlusPlus20;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16650,7 +16650,7 @@ void Sema::SetDeclDefaulted(Decl *Dcl, SourceLocation DefaultLoc) {
|
|||||||
(!isa<CXXConstructorDecl>(FD) &&
|
(!isa<CXXConstructorDecl>(FD) &&
|
||||||
FD->getDeclName().getCXXOverloadedOperator() != OO_Equal))) {
|
FD->getDeclName().getCXXOverloadedOperator() != OO_Equal))) {
|
||||||
Diag(DefaultLoc, diag::err_default_special_members)
|
Diag(DefaultLoc, diag::err_default_special_members)
|
||||||
<< getLangOpts().CPlusPlus2a;
|
<< getLangOpts().CPlusPlus20;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16665,7 +16665,7 @@ void Sema::SetDeclDefaulted(Decl *Dcl, SourceLocation DefaultLoc) {
|
|||||||
// 'operator<=>' when parsing the '<=>' token.
|
// 'operator<=>' when parsing the '<=>' token.
|
||||||
if (DefKind.isComparison() &&
|
if (DefKind.isComparison() &&
|
||||||
DefKind.asComparison() != DefaultedComparisonKind::ThreeWay) {
|
DefKind.asComparison() != DefaultedComparisonKind::ThreeWay) {
|
||||||
Diag(DefaultLoc, getLangOpts().CPlusPlus2a
|
Diag(DefaultLoc, getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_defaulted_comparison
|
? diag::warn_cxx17_compat_defaulted_comparison
|
||||||
: diag::ext_defaulted_comparison);
|
: diag::ext_defaulted_comparison);
|
||||||
}
|
}
|
||||||
|
@ -1391,7 +1391,7 @@ static void checkEnumArithmeticConversions(Sema &S, Expr *LHS, Expr *RHS,
|
|||||||
bool IsCompAssign = ACK == Sema::ACK_CompAssign;
|
bool IsCompAssign = ACK == Sema::ACK_CompAssign;
|
||||||
if ((!IsCompAssign && LEnum && R->isFloatingType()) ||
|
if ((!IsCompAssign && LEnum && R->isFloatingType()) ||
|
||||||
(REnum && L->isFloatingType())) {
|
(REnum && L->isFloatingType())) {
|
||||||
S.Diag(Loc, S.getLangOpts().CPlusPlus2a
|
S.Diag(Loc, S.getLangOpts().CPlusPlus20
|
||||||
? diag::warn_arith_conv_enum_float_cxx2a
|
? diag::warn_arith_conv_enum_float_cxx2a
|
||||||
: diag::warn_arith_conv_enum_float)
|
: diag::warn_arith_conv_enum_float)
|
||||||
<< LHS->getSourceRange() << RHS->getSourceRange()
|
<< LHS->getSourceRange() << RHS->getSourceRange()
|
||||||
@ -1404,23 +1404,23 @@ static void checkEnumArithmeticConversions(Sema &S, Expr *LHS, Expr *RHS,
|
|||||||
// If either enumeration type is unnamed, it's less likely that the
|
// If either enumeration type is unnamed, it's less likely that the
|
||||||
// user cares about this, but this situation is still deprecated in
|
// user cares about this, but this situation is still deprecated in
|
||||||
// C++2a. Use a different warning group.
|
// C++2a. Use a different warning group.
|
||||||
DiagID = S.getLangOpts().CPlusPlus2a
|
DiagID = S.getLangOpts().CPlusPlus20
|
||||||
? diag::warn_arith_conv_mixed_anon_enum_types_cxx2a
|
? diag::warn_arith_conv_mixed_anon_enum_types_cxx2a
|
||||||
: diag::warn_arith_conv_mixed_anon_enum_types;
|
: diag::warn_arith_conv_mixed_anon_enum_types;
|
||||||
} else if (ACK == Sema::ACK_Conditional) {
|
} else if (ACK == Sema::ACK_Conditional) {
|
||||||
// Conditional expressions are separated out because they have
|
// Conditional expressions are separated out because they have
|
||||||
// historically had a different warning flag.
|
// historically had a different warning flag.
|
||||||
DiagID = S.getLangOpts().CPlusPlus2a
|
DiagID = S.getLangOpts().CPlusPlus20
|
||||||
? diag::warn_conditional_mixed_enum_types_cxx2a
|
? diag::warn_conditional_mixed_enum_types_cxx2a
|
||||||
: diag::warn_conditional_mixed_enum_types;
|
: diag::warn_conditional_mixed_enum_types;
|
||||||
} else if (ACK == Sema::ACK_Comparison) {
|
} else if (ACK == Sema::ACK_Comparison) {
|
||||||
// Comparison expressions are separated out because they have
|
// Comparison expressions are separated out because they have
|
||||||
// historically had a different warning flag.
|
// historically had a different warning flag.
|
||||||
DiagID = S.getLangOpts().CPlusPlus2a
|
DiagID = S.getLangOpts().CPlusPlus20
|
||||||
? diag::warn_comparison_mixed_enum_types_cxx2a
|
? diag::warn_comparison_mixed_enum_types_cxx2a
|
||||||
: diag::warn_comparison_mixed_enum_types;
|
: diag::warn_comparison_mixed_enum_types;
|
||||||
} else {
|
} else {
|
||||||
DiagID = S.getLangOpts().CPlusPlus2a
|
DiagID = S.getLangOpts().CPlusPlus20
|
||||||
? diag::warn_arith_conv_mixed_enum_types_cxx2a
|
? diag::warn_arith_conv_mixed_enum_types_cxx2a
|
||||||
: diag::warn_arith_conv_mixed_enum_types;
|
: diag::warn_arith_conv_mixed_enum_types;
|
||||||
}
|
}
|
||||||
@ -1771,7 +1771,7 @@ Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
|
|||||||
|
|
||||||
// Warn on initializing an array of char from a u8 string literal; this
|
// Warn on initializing an array of char from a u8 string literal; this
|
||||||
// becomes ill-formed in C++2a.
|
// becomes ill-formed in C++2a.
|
||||||
if (getLangOpts().CPlusPlus && !getLangOpts().CPlusPlus2a &&
|
if (getLangOpts().CPlusPlus && !getLangOpts().CPlusPlus20 &&
|
||||||
!getLangOpts().Char8 && Kind == StringLiteral::UTF8) {
|
!getLangOpts().Char8 && Kind == StringLiteral::UTF8) {
|
||||||
Diag(StringTokLocs.front(), diag::warn_cxx2a_compat_utf8_string);
|
Diag(StringTokLocs.front(), diag::warn_cxx2a_compat_utf8_string);
|
||||||
|
|
||||||
@ -4542,7 +4542,7 @@ Sema::ActOnArraySubscriptExpr(Scope *S, Expr *base, SourceLocation lbLoc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A comma-expression as the index is deprecated in C++2a onwards.
|
// A comma-expression as the index is deprecated in C++2a onwards.
|
||||||
if (getLangOpts().CPlusPlus2a &&
|
if (getLangOpts().CPlusPlus20 &&
|
||||||
((isa<BinaryOperator>(idx) && cast<BinaryOperator>(idx)->isCommaOp()) ||
|
((isa<BinaryOperator>(idx) && cast<BinaryOperator>(idx)->isCommaOp()) ||
|
||||||
(isa<CXXOperatorCallExpr>(idx) &&
|
(isa<CXXOperatorCallExpr>(idx) &&
|
||||||
cast<CXXOperatorCallExpr>(idx)->getOperator() == OO_Comma))) {
|
cast<CXXOperatorCallExpr>(idx)->getOperator() == OO_Comma))) {
|
||||||
@ -6162,7 +6162,7 @@ ExprResult Sema::ActOnCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
|
|||||||
if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(Fn)) {
|
if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(Fn)) {
|
||||||
if (ULE->hasExplicitTemplateArgs() &&
|
if (ULE->hasExplicitTemplateArgs() &&
|
||||||
ULE->decls_begin() == ULE->decls_end()) {
|
ULE->decls_begin() == ULE->decls_end()) {
|
||||||
Diag(Fn->getExprLoc(), getLangOpts().CPlusPlus2a
|
Diag(Fn->getExprLoc(), getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_adl_only_template_id
|
? diag::warn_cxx17_compat_adl_only_template_id
|
||||||
: diag::ext_adl_only_template_id)
|
: diag::ext_adl_only_template_id)
|
||||||
<< ULE->getName();
|
<< ULE->getName();
|
||||||
@ -6783,7 +6783,7 @@ Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
|
|||||||
// already diagnose use of (non-C++20) C99 designator syntax.
|
// already diagnose use of (non-C++20) C99 designator syntax.
|
||||||
if (getLangOpts().CPlusPlus && !DiagnosedArrayDesignator &&
|
if (getLangOpts().CPlusPlus && !DiagnosedArrayDesignator &&
|
||||||
!DiagnosedNestedDesignator && !DiagnosedMixedDesignator) {
|
!DiagnosedNestedDesignator && !DiagnosedMixedDesignator) {
|
||||||
Diag(FirstDesignator, getLangOpts().CPlusPlus2a
|
Diag(FirstDesignator, getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_designated_init
|
? diag::warn_cxx17_compat_designated_init
|
||||||
: diag::ext_cxx_designated_init);
|
: diag::ext_cxx_designated_init);
|
||||||
} else if (!getLangOpts().CPlusPlus && !getLangOpts().C99) {
|
} else if (!getLangOpts().CPlusPlus && !getLangOpts().C99) {
|
||||||
@ -10469,7 +10469,7 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult &LHS, ExprResult &RHS,
|
|||||||
// If LHS does not have a signed type and non-negative value
|
// If LHS does not have a signed type and non-negative value
|
||||||
// then, the behavior is undefined before C++2a. Warn about it.
|
// then, the behavior is undefined before C++2a. Warn about it.
|
||||||
if (Left.isNegative() && !S.getLangOpts().isSignedOverflowDefined() &&
|
if (Left.isNegative() && !S.getLangOpts().isSignedOverflowDefined() &&
|
||||||
!S.getLangOpts().CPlusPlus2a) {
|
!S.getLangOpts().CPlusPlus20) {
|
||||||
S.DiagRuntimeBehavior(Loc, LHS.get(),
|
S.DiagRuntimeBehavior(Loc, LHS.get(),
|
||||||
S.PDiag(diag::warn_shift_lhs_negative)
|
S.PDiag(diag::warn_shift_lhs_negative)
|
||||||
<< LHS.get()->getSourceRange());
|
<< LHS.get()->getSourceRange());
|
||||||
@ -10949,7 +10949,7 @@ static void diagnoseTautologicalComparison(Sema &S, SourceLocation Loc,
|
|||||||
// C++2a [depr.array.comp]:
|
// C++2a [depr.array.comp]:
|
||||||
// Equality and relational comparisons ([expr.eq], [expr.rel]) between two
|
// Equality and relational comparisons ([expr.eq], [expr.rel]) between two
|
||||||
// operands of array type are deprecated.
|
// operands of array type are deprecated.
|
||||||
if (S.getLangOpts().CPlusPlus2a && LHSStripped->getType()->isArrayType() &&
|
if (S.getLangOpts().CPlusPlus20 && LHSStripped->getType()->isArrayType() &&
|
||||||
RHSStripped->getType()->isArrayType()) {
|
RHSStripped->getType()->isArrayType()) {
|
||||||
S.Diag(Loc, diag::warn_depr_array_comparison)
|
S.Diag(Loc, diag::warn_depr_array_comparison)
|
||||||
<< LHS->getSourceRange() << RHS->getSourceRange()
|
<< LHS->getSourceRange() << RHS->getSourceRange()
|
||||||
@ -12595,7 +12595,7 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS,
|
|||||||
|
|
||||||
CheckForNullPointerDereference(*this, LHSExpr);
|
CheckForNullPointerDereference(*this, LHSExpr);
|
||||||
|
|
||||||
if (getLangOpts().CPlusPlus2a && LHSType.isVolatileQualified()) {
|
if (getLangOpts().CPlusPlus20 && LHSType.isVolatileQualified()) {
|
||||||
if (CompoundType.isNull()) {
|
if (CompoundType.isNull()) {
|
||||||
// C++2a [expr.ass]p5:
|
// C++2a [expr.ass]p5:
|
||||||
// A simple-assignment whose left operand is of a volatile-qualified
|
// A simple-assignment whose left operand is of a volatile-qualified
|
||||||
@ -12798,7 +12798,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op,
|
|||||||
// Now make sure the operand is a modifiable lvalue.
|
// Now make sure the operand is a modifiable lvalue.
|
||||||
if (CheckForModifiableLvalue(Op, OpLoc, S))
|
if (CheckForModifiableLvalue(Op, OpLoc, S))
|
||||||
return QualType();
|
return QualType();
|
||||||
if (S.getLangOpts().CPlusPlus2a && ResType.isVolatileQualified()) {
|
if (S.getLangOpts().CPlusPlus20 && ResType.isVolatileQualified()) {
|
||||||
// C++2a [expr.pre.inc]p1, [expr.post.inc]p1:
|
// C++2a [expr.pre.inc]p1, [expr.post.inc]p1:
|
||||||
// An operand with volatile-qualified type is deprecated
|
// An operand with volatile-qualified type is deprecated
|
||||||
S.Diag(OpLoc, diag::warn_deprecated_increment_decrement_volatile)
|
S.Diag(OpLoc, diag::warn_deprecated_increment_decrement_volatile)
|
||||||
@ -13973,7 +13973,7 @@ static ExprResult BuildOverloadedBinOp(Sema &S, Scope *Sc, SourceLocation OpLoc,
|
|||||||
RHS->getType(), Functions);
|
RHS->getType(), Functions);
|
||||||
|
|
||||||
// In C++20 onwards, we may have a second operator to look up.
|
// In C++20 onwards, we may have a second operator to look up.
|
||||||
if (S.getLangOpts().CPlusPlus2a) {
|
if (S.getLangOpts().CPlusPlus20) {
|
||||||
if (OverloadedOperatorKind ExtraOp = getRewrittenOverloadedOperator(OverOp))
|
if (OverloadedOperatorKind ExtraOp = getRewrittenOverloadedOperator(OverOp))
|
||||||
S.LookupOverloadedOperatorName(ExtraOp, Sc, LHS->getType(),
|
S.LookupOverloadedOperatorName(ExtraOp, Sc, LHS->getType(),
|
||||||
RHS->getType(), Functions);
|
RHS->getType(), Functions);
|
||||||
@ -15873,7 +15873,7 @@ void Sema::WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec) {
|
|||||||
/// and if so, remove it from the list of volatile-qualified assignments that
|
/// and if so, remove it from the list of volatile-qualified assignments that
|
||||||
/// we are going to warn are deprecated.
|
/// we are going to warn are deprecated.
|
||||||
void Sema::CheckUnusedVolatileAssignment(Expr *E) {
|
void Sema::CheckUnusedVolatileAssignment(Expr *E) {
|
||||||
if (!E->getType().isVolatileQualified() || !getLangOpts().CPlusPlus2a)
|
if (!E->getType().isVolatileQualified() || !getLangOpts().CPlusPlus20)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Note: ignoring parens here is not justified by the standard rules, but
|
// Note: ignoring parens here is not justified by the standard rules, but
|
||||||
|
@ -5684,7 +5684,7 @@ QualType Sema::CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS,
|
|||||||
// C++2a allows functions with ref-qualifier & if their cv-qualifier-seq
|
// C++2a allows functions with ref-qualifier & if their cv-qualifier-seq
|
||||||
// is (exactly) 'const'.
|
// is (exactly) 'const'.
|
||||||
if (Proto->isConst() && !Proto->isVolatile())
|
if (Proto->isConst() && !Proto->isVolatile())
|
||||||
Diag(Loc, getLangOpts().CPlusPlus2a
|
Diag(Loc, getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue
|
? diag::warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue
|
||||||
: diag::ext_pointer_to_const_ref_member_on_rvalue);
|
: diag::ext_pointer_to_const_ref_member_on_rvalue);
|
||||||
else
|
else
|
||||||
|
@ -8782,7 +8782,7 @@ bool InitializationSequence::Diagnose(Sema &S,
|
|||||||
case FK_UTF8StringIntoPlainChar:
|
case FK_UTF8StringIntoPlainChar:
|
||||||
S.Diag(Kind.getLocation(),
|
S.Diag(Kind.getLocation(),
|
||||||
diag::err_array_init_utf8_string_into_char)
|
diag::err_array_init_utf8_string_into_char)
|
||||||
<< S.getLangOpts().CPlusPlus2a;
|
<< S.getLangOpts().CPlusPlus20;
|
||||||
break;
|
break;
|
||||||
case FK_ArrayTypeMismatch:
|
case FK_ArrayTypeMismatch:
|
||||||
case FK_NonConstantArrayInit:
|
case FK_NonConstantArrayInit:
|
||||||
|
@ -800,7 +800,7 @@ QualType Sema::buildLambdaInitCaptureInitialization(
|
|||||||
}
|
}
|
||||||
if (EllipsisLoc.isValid()) {
|
if (EllipsisLoc.isValid()) {
|
||||||
if (Init->containsUnexpandedParameterPack()) {
|
if (Init->containsUnexpandedParameterPack()) {
|
||||||
Diag(EllipsisLoc, getLangOpts().CPlusPlus2a
|
Diag(EllipsisLoc, getLangOpts().CPlusPlus20
|
||||||
? diag::warn_cxx17_compat_init_capture_pack
|
? diag::warn_cxx17_compat_init_capture_pack
|
||||||
: diag::ext_init_capture_pack);
|
: diag::ext_init_capture_pack);
|
||||||
DeductType = Context.getPackExpansionType(DeductType, NumExpansions);
|
DeductType = Context.getPackExpansionType(DeductType, NumExpansions);
|
||||||
@ -1053,7 +1053,7 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
|
|||||||
// "&identifier", "this", or "* this". [ Note: The form [&,this] is
|
// "&identifier", "this", or "* this". [ Note: The form [&,this] is
|
||||||
// redundant but accepted for compatibility with ISO C++14. --end note ]
|
// redundant but accepted for compatibility with ISO C++14. --end note ]
|
||||||
if (Intro.Default == LCD_ByCopy && C->Kind != LCK_StarThis)
|
if (Intro.Default == LCD_ByCopy && C->Kind != LCK_StarThis)
|
||||||
Diag(C->Loc, !getLangOpts().CPlusPlus2a
|
Diag(C->Loc, !getLangOpts().CPlusPlus20
|
||||||
? diag::ext_equals_this_lambda_capture_cxx2a
|
? diag::ext_equals_this_lambda_capture_cxx2a
|
||||||
: diag::warn_cxx17_compat_equals_this_lambda_capture);
|
: diag::warn_cxx17_compat_equals_this_lambda_capture);
|
||||||
|
|
||||||
@ -1748,7 +1748,7 @@ ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc,
|
|||||||
// Capturing 'this' implicitly with a default of '[=]' is deprecated,
|
// Capturing 'this' implicitly with a default of '[=]' is deprecated,
|
||||||
// because it results in a reference capture. Don't warn prior to
|
// because it results in a reference capture. Don't warn prior to
|
||||||
// C++2a; there's nothing that can be done about it before then.
|
// C++2a; there's nothing that can be done about it before then.
|
||||||
if (getLangOpts().CPlusPlus2a && IsImplicit &&
|
if (getLangOpts().CPlusPlus20 && IsImplicit &&
|
||||||
CaptureDefault == LCD_ByCopy) {
|
CaptureDefault == LCD_ByCopy) {
|
||||||
Diag(From.getLocation(), diag::warn_deprecated_this_capture);
|
Diag(From.getLocation(), diag::warn_deprecated_this_capture);
|
||||||
Diag(CaptureDefaultLoc, diag::note_deprecated_this_capture)
|
Diag(CaptureDefaultLoc, diag::note_deprecated_this_capture)
|
||||||
|
@ -13206,7 +13206,7 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
|
|||||||
Expr *Args[2] = { LHS, RHS };
|
Expr *Args[2] = { LHS, RHS };
|
||||||
LHS=RHS=nullptr; // Please use only Args instead of LHS/RHS couple
|
LHS=RHS=nullptr; // Please use only Args instead of LHS/RHS couple
|
||||||
|
|
||||||
if (!getLangOpts().CPlusPlus2a)
|
if (!getLangOpts().CPlusPlus20)
|
||||||
AllowRewrittenCandidates = false;
|
AllowRewrittenCandidates = false;
|
||||||
|
|
||||||
OverloadedOperatorKind Op = BinaryOperator::getOverloadedOperator(Opc);
|
OverloadedOperatorKind Op = BinaryOperator::getOverloadedOperator(Opc);
|
||||||
|
@ -485,7 +485,7 @@ bool Sema::LookupTemplateName(LookupResult &Found,
|
|||||||
// all language modes, and diagnose the empty lookup in ActOnCallExpr if we
|
// all language modes, and diagnose the empty lookup in ActOnCallExpr if we
|
||||||
// successfully form a call to an undeclared template-id.
|
// successfully form a call to an undeclared template-id.
|
||||||
bool AllFunctions =
|
bool AllFunctions =
|
||||||
getLangOpts().CPlusPlus2a &&
|
getLangOpts().CPlusPlus20 &&
|
||||||
std::all_of(Found.begin(), Found.end(), [](NamedDecl *ND) {
|
std::all_of(Found.begin(), Found.end(), [](NamedDecl *ND) {
|
||||||
return isa<FunctionDecl>(ND->getUnderlyingDecl());
|
return isa<FunctionDecl>(ND->getUnderlyingDecl());
|
||||||
});
|
});
|
||||||
@ -4168,7 +4168,7 @@ DeclResult Sema::ActOnVarTemplateSpecialization(
|
|||||||
|
|
||||||
if (isSameAsPrimaryTemplate(VarTemplate->getTemplateParameters(),
|
if (isSameAsPrimaryTemplate(VarTemplate->getTemplateParameters(),
|
||||||
Converted) &&
|
Converted) &&
|
||||||
(!Context.getLangOpts().CPlusPlus2a ||
|
(!Context.getLangOpts().CPlusPlus20 ||
|
||||||
!TemplateParams->hasAssociatedConstraints())) {
|
!TemplateParams->hasAssociatedConstraints())) {
|
||||||
// C++ [temp.class.spec]p9b3:
|
// C++ [temp.class.spec]p9b3:
|
||||||
//
|
//
|
||||||
@ -8193,7 +8193,7 @@ DeclResult Sema::ActOnClassTemplateSpecialization(
|
|||||||
|
|
||||||
if (Context.hasSameType(CanonType,
|
if (Context.hasSameType(CanonType,
|
||||||
ClassTemplate->getInjectedClassNameSpecialization()) &&
|
ClassTemplate->getInjectedClassNameSpecialization()) &&
|
||||||
(!Context.getLangOpts().CPlusPlus2a ||
|
(!Context.getLangOpts().CPlusPlus20 ||
|
||||||
!TemplateParams->hasAssociatedConstraints())) {
|
!TemplateParams->hasAssociatedConstraints())) {
|
||||||
// C++ [temp.class.spec]p9b3:
|
// C++ [temp.class.spec]p9b3:
|
||||||
//
|
//
|
||||||
|
@ -2594,7 +2594,7 @@ bool Sema::CheckFunctionReturnType(QualType T, SourceLocation Loc) {
|
|||||||
|
|
||||||
// C++2a [dcl.fct]p12:
|
// C++2a [dcl.fct]p12:
|
||||||
// A volatile-qualified return type is deprecated
|
// A volatile-qualified return type is deprecated
|
||||||
if (T.isVolatileQualified() && getLangOpts().CPlusPlus2a)
|
if (T.isVolatileQualified() && getLangOpts().CPlusPlus20)
|
||||||
Diag(Loc, diag::warn_deprecated_volatile_return) << T;
|
Diag(Loc, diag::warn_deprecated_volatile_return) << T;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -2679,7 +2679,7 @@ QualType Sema::BuildFunctionType(QualType T,
|
|||||||
|
|
||||||
// C++2a [dcl.fct]p4:
|
// C++2a [dcl.fct]p4:
|
||||||
// A parameter with volatile-qualified type is deprecated
|
// A parameter with volatile-qualified type is deprecated
|
||||||
if (ParamType.isVolatileQualified() && getLangOpts().CPlusPlus2a)
|
if (ParamType.isVolatileQualified() && getLangOpts().CPlusPlus20)
|
||||||
Diag(Loc, diag::warn_deprecated_volatile_param) << ParamType;
|
Diag(Loc, diag::warn_deprecated_volatile_param) << ParamType;
|
||||||
|
|
||||||
ParamTypes[Idx] = ParamType;
|
ParamTypes[Idx] = ParamType;
|
||||||
@ -3180,7 +3180,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
|
|||||||
InventedTemplateParameterInfo *Info = nullptr;
|
InventedTemplateParameterInfo *Info = nullptr;
|
||||||
if (D.getContext() == DeclaratorContext::PrototypeContext) {
|
if (D.getContext() == DeclaratorContext::PrototypeContext) {
|
||||||
// With concepts we allow 'auto' in function parameters.
|
// With concepts we allow 'auto' in function parameters.
|
||||||
if (!SemaRef.getLangOpts().CPlusPlus2a || !Auto ||
|
if (!SemaRef.getLangOpts().CPlusPlus20 || !Auto ||
|
||||||
Auto->getKeyword() != AutoTypeKeyword::Auto) {
|
Auto->getKeyword() != AutoTypeKeyword::Auto) {
|
||||||
Error = 0;
|
Error = 0;
|
||||||
break;
|
break;
|
||||||
@ -4795,7 +4795,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
|||||||
// An error occurred parsing the trailing return type.
|
// An error occurred parsing the trailing return type.
|
||||||
T = Context.IntTy;
|
T = Context.IntTy;
|
||||||
D.setInvalidType(true);
|
D.setInvalidType(true);
|
||||||
} else if (S.getLangOpts().CPlusPlus2a)
|
} else if (S.getLangOpts().CPlusPlus20)
|
||||||
// Handle cases like: `auto f() -> auto` or `auto f() -> C auto`.
|
// Handle cases like: `auto f() -> auto` or `auto f() -> C auto`.
|
||||||
if (AutoType *Auto = T->getContainedAutoType())
|
if (AutoType *Auto = T->getContainedAutoType())
|
||||||
if (S.getCurScope()->isFunctionDeclarationScope())
|
if (S.getCurScope()->isFunctionDeclarationScope())
|
||||||
@ -4904,7 +4904,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
|||||||
|
|
||||||
// C++2a [dcl.fct]p12:
|
// C++2a [dcl.fct]p12:
|
||||||
// A volatile-qualified return type is deprecated
|
// A volatile-qualified return type is deprecated
|
||||||
if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus2a)
|
if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus20)
|
||||||
S.Diag(DeclType.Loc, diag::warn_deprecated_volatile_return) << T;
|
S.Diag(DeclType.Loc, diag::warn_deprecated_volatile_return) << T;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5395,7 +5395,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
|||||||
|
|
||||||
// C++2a [dcl.fct]p4:
|
// C++2a [dcl.fct]p4:
|
||||||
// A parameter with volatile-qualified type is deprecated
|
// A parameter with volatile-qualified type is deprecated
|
||||||
if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus2a &&
|
if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus20 &&
|
||||||
(D.getContext() == DeclaratorContext::PrototypeContext ||
|
(D.getContext() == DeclaratorContext::PrototypeContext ||
|
||||||
D.getContext() == DeclaratorContext::LambdaExprParameterContext))
|
D.getContext() == DeclaratorContext::LambdaExprParameterContext))
|
||||||
S.Diag(D.getIdentifierLoc(), diag::warn_deprecated_volatile_param) << T;
|
S.Diag(D.getIdentifierLoc(), diag::warn_deprecated_volatile_param) << T;
|
||||||
@ -5421,7 +5421,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
|||||||
// We represent function parameter packs as function parameters whose
|
// We represent function parameter packs as function parameters whose
|
||||||
// type is a pack expansion.
|
// type is a pack expansion.
|
||||||
if (!T->containsUnexpandedParameterPack() &&
|
if (!T->containsUnexpandedParameterPack() &&
|
||||||
(!LangOpts.CPlusPlus2a || !T->getContainedAutoType())) {
|
(!LangOpts.CPlusPlus20 || !T->getContainedAutoType())) {
|
||||||
S.Diag(D.getEllipsisLoc(),
|
S.Diag(D.getEllipsisLoc(),
|
||||||
diag::err_function_parameter_pack_without_parameter_packs)
|
diag::err_function_parameter_pack_without_parameter_packs)
|
||||||
<< T << D.getSourceRange();
|
<< T << D.getSourceRange();
|
||||||
@ -8484,7 +8484,7 @@ bool Sema::RequireLiteralType(SourceLocation Loc, QualType T,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (getLangOpts().CPlusPlus2a ? !RD->hasConstexprDestructor()
|
} else if (getLangOpts().CPlusPlus20 ? !RD->hasConstexprDestructor()
|
||||||
: !RD->hasTrivialDestructor()) {
|
: !RD->hasTrivialDestructor()) {
|
||||||
// All fields and bases are of literal types, so have trivial or constexpr
|
// All fields and bases are of literal types, so have trivial or constexpr
|
||||||
// destructors. If this class's destructor is non-trivial / non-constexpr,
|
// destructors. If this class's destructor is non-trivial / non-constexpr,
|
||||||
@ -8494,7 +8494,7 @@ bool Sema::RequireLiteralType(SourceLocation Loc, QualType T,
|
|||||||
if (!Dtor)
|
if (!Dtor)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (getLangOpts().CPlusPlus2a) {
|
if (getLangOpts().CPlusPlus20) {
|
||||||
Diag(Dtor->getLocation(), diag::note_non_literal_non_constexpr_dtor)
|
Diag(Dtor->getLocation(), diag::note_non_literal_non_constexpr_dtor)
|
||||||
<< RD;
|
<< RD;
|
||||||
} else {
|
} else {
|
||||||
|
@ -239,7 +239,7 @@ BasicValueFactory::evalAPSInt(BinaryOperator::Opcode Op,
|
|||||||
if (Amt >= V1.getBitWidth())
|
if (Amt >= V1.getBitWidth())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!Ctx.getLangOpts().CPlusPlus2a) {
|
if (!Ctx.getLangOpts().CPlusPlus20) {
|
||||||
if (V1.isSigned() && V1.isNegative())
|
if (V1.isSigned() && V1.isNegative())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user