22 #include "llvm/ADT/SmallPtrSet.h" 23 #include "llvm/ADT/SmallString.h" 48 if (!RD || !RD->getIdentifier() || !RD->getDescribedClassTemplate() ||
61 if (!II || !(II->
isStr(
"__debug") || II->
isStr(
"__profile")) ||
62 !ND->isInStdNamespace())
70 return llvm::StringSwitch<bool>(RD->getIdentifier()->getName())
72 .Case(
"pair", IsInStd)
73 .Case(
"priority_queue", IsInStd)
74 .Case(
"stack", IsInStd)
75 .Case(
"queue", IsInStd)
87 if (Converted.
get()->isValueDependent()) {
95 diag::err_noexcept_needs_constant_expression,
134 if (RT->isRValueReferenceType()) {
138 Diag(Range.
getBegin(), diag::err_rref_in_exception_spec)
151 unsigned DiagID = diag::err_incomplete_in_exception_spec;
152 bool ReturnValueOnError =
true;
154 DiagID = diag::ext_incomplete_in_exception_spec;
155 ReturnValueOnError =
false;
160 return ReturnValueOnError;
191 Diag(Loc, diag::err_exception_spec_not_parsed);
215 Diag(Loc, diag::err_exception_spec_not_parsed);
227 Listener->ResolvedExceptionSpec(FD);
247 bool *MissingExceptionSpecification =
nullptr,
248 bool *MissingEmptyExceptionSpecification =
nullptr,
249 bool AllowNoexceptAllMatchWithNoSpec =
false,
bool IsOperatorNew =
false);
254 if (!isa<CXXDestructorDecl>(Decl) &&
265 return isa<CXXDestructorDecl>(Decl);
280 bool IsOperatorNew = OO == OO_New || OO == OO_Array_New;
281 bool MissingExceptionSpecification =
false;
282 bool MissingEmptyExceptionSpecification =
false;
284 unsigned DiagID = diag::err_mismatched_exception_spec;
285 bool ReturnValueOnError =
true;
287 DiagID = diag::ext_mismatched_exception_spec;
288 ReturnValueOnError =
false;
302 *
this,
PDiag(DiagID),
PDiag(diag::note_previous_declaration),
305 &MissingExceptionSpecification, &MissingEmptyExceptionSpecification,
306 true, IsOperatorNew)) {
323 if (!MissingExceptionSpecification)
324 return ReturnValueOnError;
337 if (MissingEmptyExceptionSpecification && NewProto &&
377 DiagID = diag::ext_ms_missing_exception_specification;
378 ReturnValueOnError =
false;
383 DiagID = diag::ext_missing_exception_specification;
384 ReturnValueOnError =
false;
386 DiagID = diag::err_missing_exception_specification;
387 ReturnValueOnError =
true;
392 llvm::raw_svector_ostream OS(ExceptionSpecString);
400 bool OnFirstException =
true;
401 for (
const auto &E : OldProto->
exceptions()) {
402 if (OnFirstException)
403 OnFirstException =
false;
421 assert(OldProto->
getNoexceptExpr() !=
nullptr &&
"Expected non-null Expr");
427 llvm_unreachable(
"This spec type is compatible with none.");
436 if (!FTLoc.getTypePtr()->hasTrailingReturn())
452 return ReturnValueOnError;
465 unsigned DiagID = diag::err_mismatched_exception_spec;
467 DiagID = diag::ext_mismatched_exception_spec;
469 *
this,
PDiag(DiagID),
PDiag(diag::note_previous_declaration),
470 Old, OldLoc, New, NewLoc);
488 bool *MissingExceptionSpecification,
489 bool *MissingEmptyExceptionSpecification,
490 bool AllowNoexceptAllMatchWithNoSpec,
bool IsOperatorNew) {
491 if (MissingExceptionSpecification)
492 *MissingExceptionSpecification =
false;
494 if (MissingEmptyExceptionSpecification)
495 *MissingEmptyExceptionSpecification =
false;
528 "Shouldn't see unknown exception specifications here");
542 if (!AllowNoexceptAllMatchWithNoSpec &&
555 llvm::FoldingSetNodeID OldFSN, NewFSN;
558 if (OldFSN == NewFSN)
568 llvm::SmallPtrSet<CanQualType, 8> OldTypes, NewTypes;
574 if (OldTypes.count(TypePtr))
575 NewTypes.insert(TypePtr);
582 if (Success && OldTypes.size() == NewTypes.size())
589 if (S.
getLangOpts().CPlusPlus11 && IsOperatorNew) {
592 WithExceptions = New;
594 WithExceptions = Old;
601 if (Name && Name->
getName() ==
"bad_alloc") {
603 if (ExRecord->isInStdNamespace()) {
613 if (MissingExceptionSpecification && OldEST !=
EST_None &&
617 *MissingExceptionSpecification =
true;
619 if (MissingEmptyExceptionSpecification && OldCanThrow ==
CT_Cannot) {
623 *MissingEmptyExceptionSpecification =
true;
629 S.
Diag(NewLoc, DiagID);
631 S.
Diag(OldLoc, NoteID);
724 llvm_unreachable(
"access check dependent for unprivileged context");
726 llvm_unreachable(
"access check delayed in non-declaration");
728 llvm_unreachable(
"unexpected access check result");
764 "Shouldn't see unknown exception specifications here");
787 Diag(SubLoc, DiagID);
789 Diag(SuperLoc, NoteID);
794 "Exception spec subset: non-dynamic case slipped through.");
799 SubI = RefTy->getPointeeType();
802 bool Contained =
false;
816 Diag(SubLoc, DiagID);
818 Diag(SuperLoc, NoteID);
854 auto RetDiag = DiagID;
857 *
this, RetDiag,
PDiag(),
865 "Functions have different argument counts.");
866 for (
unsigned i = 0, E = Target->
getNumParams(); i != E; ++i) {
867 auto ParamDiag = DiagID;
870 *
this, ParamDiag,
PDiag(),
890 unsigned DiagID = diag::err_incompatible_exception_specs;
891 unsigned NestedDiagID = diag::err_deep_exception_specs_differ;
896 DiagID = diag::warn_incompatible_exception_specs;
897 NestedDiagID = diag::warn_deep_exception_specs_differ;
940 unsigned DiagID = diag::err_override_exception_spec;
942 DiagID = diag::ext_override_exception_spec;
944 PDiag(diag::err_deep_exception_specs_differ),
945 PDiag(diag::note_overridden_virtual_function),
965 if (D && isa<FunctionDecl>(D) && D->
hasAttr<NoThrowAttr>())
971 if (S.
getLangOpts().CPlusPlus17 && isa<CallExpr>(E)) {
972 E = cast<CallExpr>(E)->getCallee();
980 if (
auto *Op = dyn_cast<BinaryOperator>(E)) {
981 assert(Op->getOpcode() == BO_PtrMemD || Op->getOpcode() == BO_PtrMemI);
982 T = Op->getRHS()->getType()
985 T = cast<MemberExpr>(E)->getMemberDecl()->getType();
988 }
else if (
const ValueDecl *VD = dyn_cast_or_null<ValueDecl>(D))
1040 if (!cast<CXXRecordDecl>(RT->
getDecl())->isPolymorphic())
1054 case Expr::ConstantExprClass:
1055 return canThrow(cast<ConstantExpr>(E)->getSubExpr());
1057 case Expr::CXXThrowExprClass:
1061 case Expr::CXXDynamicCastExprClass: {
1070 case Expr::CXXTypeidExprClass:
1078 case Expr::CallExprClass:
1079 case Expr::CXXMemberCallExprClass:
1080 case Expr::CXXOperatorCallExprClass:
1081 case Expr::UserDefinedLiteralClass: {
1082 const CallExpr *CE = cast<CallExpr>(E);
1095 case Expr::CXXConstructExprClass:
1096 case Expr::CXXTemporaryObjectExprClass: {
1098 cast<CXXConstructExpr>(E)->getConstructor());
1104 case Expr::CXXInheritedCtorInitExprClass:
1106 cast<CXXInheritedCtorInitExpr>(E)->getConstructor());
1108 case Expr::LambdaExprClass: {
1109 const LambdaExpr *Lambda = cast<LambdaExpr>(E);
1114 Cap != CapEnd; ++Cap)
1119 case Expr::CXXNewExprClass: {
1124 CT =
canCalleeThrow(*
this, E, cast<CXXNewExpr>(E)->getOperatorNew());
1130 case Expr::CXXDeleteExprClass: {
1132 QualType DTy = cast<CXXDeleteExpr>(E)->getDestroyedType();
1137 cast<CXXDeleteExpr>(E)->getOperatorDelete());
1139 const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
1150 case Expr::CXXBindTemporaryExprClass: {
1153 cast<CXXBindTemporaryExpr>(E)->getTemporary()->getDestructor());
1161 case Expr::ObjCMessageExprClass:
1162 case Expr::ObjCPropertyRefExprClass:
1163 case Expr::ObjCSubscriptRefExprClass:
1169 case Expr::ObjCArrayLiteralClass:
1170 case Expr::ObjCDictionaryLiteralClass:
1171 case Expr::ObjCBoxedExprClass:
1176 case Expr::CoawaitExprClass:
1177 case Expr::ConditionalOperatorClass:
1178 case Expr::CompoundLiteralExprClass:
1179 case Expr::CoyieldExprClass:
1180 case Expr::CXXConstCastExprClass:
1181 case Expr::CXXReinterpretCastExprClass:
1182 case Expr::CXXStdInitializerListExprClass:
1183 case Expr::DesignatedInitExprClass:
1184 case Expr::DesignatedInitUpdateExprClass:
1185 case Expr::ExprWithCleanupsClass:
1186 case Expr::ExtVectorElementExprClass:
1187 case Expr::InitListExprClass:
1188 case Expr::ArrayInitLoopExprClass:
1189 case Expr::MemberExprClass:
1190 case Expr::ObjCIsaExprClass:
1191 case Expr::ObjCIvarRefExprClass:
1192 case Expr::ParenExprClass:
1193 case Expr::ParenListExprClass:
1194 case Expr::ShuffleVectorExprClass:
1195 case Expr::ConvertVectorExprClass:
1196 case Expr::VAArgExprClass:
1200 case Expr::ArraySubscriptExprClass:
1201 case Expr::OMPArraySectionExprClass:
1202 case Expr::BinaryOperatorClass:
1203 case Expr::DependentCoawaitExprClass:
1204 case Expr::CompoundAssignOperatorClass:
1205 case Expr::CStyleCastExprClass:
1206 case Expr::CXXStaticCastExprClass:
1207 case Expr::CXXFunctionalCastExprClass:
1208 case Expr::ImplicitCastExprClass:
1209 case Expr::MaterializeTemporaryExprClass:
1210 case Expr::UnaryOperatorClass: {
1216 case Expr::StmtExprClass:
1219 case Expr::CXXDefaultArgExprClass:
1220 return canThrow(cast<CXXDefaultArgExpr>(E)->getExpr());
1222 case Expr::CXXDefaultInitExprClass:
1223 return canThrow(cast<CXXDefaultInitExpr>(E)->getExpr());
1225 case Expr::ChooseExprClass:
1228 return canThrow(cast<ChooseExpr>(E)->getChosenSubExpr());
1230 case Expr::GenericSelectionExprClass:
1231 if (cast<GenericSelectionExpr>(E)->isResultDependent())
1233 return canThrow(cast<GenericSelectionExpr>(E)->getResultExpr());
1236 case Expr::CXXDependentScopeMemberExprClass:
1237 case Expr::CXXUnresolvedConstructExprClass:
1238 case Expr::DependentScopeDeclRefExprClass:
1239 case Expr::CXXFoldExprClass:
1242 case Expr::AsTypeExprClass:
1243 case Expr::BinaryConditionalOperatorClass:
1244 case Expr::BlockExprClass:
1245 case Expr::CUDAKernelCallExprClass:
1246 case Expr::DeclRefExprClass:
1247 case Expr::ObjCBridgedCastExprClass:
1248 case Expr::ObjCIndirectCopyRestoreExprClass:
1249 case Expr::ObjCProtocolExprClass:
1250 case Expr::ObjCSelectorExprClass:
1251 case Expr::ObjCAvailabilityCheckExprClass:
1252 case Expr::OffsetOfExprClass:
1253 case Expr::PackExpansionExprClass:
1254 case Expr::PseudoObjectExprClass:
1255 case Expr::SubstNonTypeTemplateParmExprClass:
1256 case Expr::SubstNonTypeTemplateParmPackExprClass:
1257 case Expr::FunctionParmPackExprClass:
1258 case Expr::UnaryExprOrTypeTraitExprClass:
1259 case Expr::UnresolvedLookupExprClass:
1260 case Expr::UnresolvedMemberExprClass:
1261 case Expr::TypoExprClass:
1265 case Expr::AddrLabelExprClass:
1266 case Expr::ArrayTypeTraitExprClass:
1267 case Expr::AtomicExprClass:
1268 case Expr::TypeTraitExprClass:
1269 case Expr::CXXBoolLiteralExprClass:
1270 case Expr::CXXNoexceptExprClass:
1271 case Expr::CXXNullPtrLiteralExprClass:
1272 case Expr::CXXPseudoDestructorExprClass:
1273 case Expr::CXXScalarValueInitExprClass:
1274 case Expr::CXXThisExprClass:
1275 case Expr::CXXUuidofExprClass:
1276 case Expr::CharacterLiteralClass:
1277 case Expr::ExpressionTraitExprClass:
1278 case Expr::FloatingLiteralClass:
1279 case Expr::GNUNullExprClass:
1280 case Expr::ImaginaryLiteralClass:
1281 case Expr::ImplicitValueInitExprClass:
1282 case Expr::IntegerLiteralClass:
1283 case Expr::FixedPointLiteralClass:
1284 case Expr::ArrayInitIndexExprClass:
1285 case Expr::NoInitExprClass:
1286 case Expr::ObjCEncodeExprClass:
1287 case Expr::ObjCStringLiteralClass:
1288 case Expr::ObjCBoolLiteralExprClass:
1289 case Expr::OpaqueValueExprClass:
1290 case Expr::PredefinedExprClass:
1291 case Expr::SizeOfPackExprClass:
1292 case Expr::StringLiteralClass:
1296 case Expr::MSPropertyRefExprClass:
1297 case Expr::MSPropertySubscriptExprClass:
1298 llvm_unreachable(
"Invalid class for expression");
1300 #define STMT(CLASS, PARENT) case Expr::CLASS##Class: 1301 #define STMT_RANGE(Base, First, Last) 1302 #define LAST_STMT_RANGE(BASE, FIRST, LAST) 1303 #define EXPR(CLASS, PARENT) 1304 #define ABSTRACT_STMT(STMT) 1305 #include "clang/AST/StmtNodes.inc" 1307 llvm_unreachable(
"Invalid class for expression");
1309 llvm_unreachable(
"Bogus StmtClass");
CanThrowResult canThrow(const Expr *E)
Represents a function declaration or definition.
no exception specification
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool isMemberPointerType() const
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
unsigned getNumExceptions() const
Return the number of types in the exception specification.
bool isExternC() const
Determines whether this function is a function with external, C linkage.
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
Stmt - This represents one statement.
ExprResult ActOnNoexceptSpec(SourceLocation NoexceptLoc, Expr *NoexceptExpr, ExceptionSpecificationType &EST)
Check the given noexcept-specifier, convert its expression, and compute the appropriate ExceptionSpec...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
Defines the SourceManager interface.
SmallVector< std::pair< const CXXMethodDecl *, const CXXMethodDecl * >, 2 > DelayedOverridingExceptionSpecChecks
All the overriding functions seen during a class definition that had their exception spec checks dela...
bool isRecordType() const
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Decl - This represents one declaration (or definition), e.g.
bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Target, SourceLocation TargetLoc, const FunctionProtoType *Source, SourceLocation SourceLoc)
CheckParamExceptionSpec - Check if the parameter and return types of the two functions have equivalen...
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
void EvaluateImplicitExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD)
Evaluate the implicit exception specification for a defaulted special member function.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
SourceLocation getBeginLoc() const LLVM_READONLY
Represent a C++ namespace.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
A container of type source information.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
Information about one declarator, including the parsed type information and the identifier.
unsigned getNumParams() const
const T * getAs() const
Member-template getAs<specific type>'.
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical) const
Produce a unique representation of the given statement.
unsigned getDiagID() const
Expr * getExprOperand() const
Defines the clang::Expr interface and subclasses for C++ expressions.
noexcept(expression), value-dependent
The collection of all-type qualifiers we support.
Base wrapper for a particular "section" of type source info.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
One of these records is kept for each identifier that is lexed.
SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks
All the function redeclarations seen during a class definition that had their exception spec checks d...
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
ArrayRef< QualType > getParamTypes() const
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
SourceLocation getBeginLoc() const LLVM_READONLY
bool isReferenceType() const
bool isReplaceableGlobalAllocationFunction(bool *IsAligned=nullptr) const
Determines whether this function is one of the replaceable global allocation functions: void *operato...
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec...
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
static bool CheckSpecForTypesEquivalent(Sema &S, const PartialDiagnostic &DiagID, const PartialDiagnostic &NoteID, QualType Target, SourceLocation TargetLoc, QualType Source, SourceLocation SourceLoc)
Defines the Diagnostic-related interfaces.
static bool CheckEquivalentExceptionSpecImpl(Sema &S, const PartialDiagnostic &DiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Old, SourceLocation OldLoc, const FunctionProtoType *New, SourceLocation NewLoc, bool *MissingExceptionSpecification=nullptr, bool *MissingEmptyExceptionSpecification=nullptr, bool AllowNoexceptAllMatchWithNoSpec=false, bool IsOperatorNew=false)
CheckEquivalentExceptionSpec - Check if the two types have compatible exception specifications.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
const LangOptions & getLangOpts() const
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
IdentifierInfo * getIdentifier() const
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Sema - This implements semantic analysis and AST building for C.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
FunctionDecl * getExceptionSpecDecl() const
If this function type has an exception specification which hasn't been determined yet (either because...
Represents a prototype with parameter type info, e.g.
bool compatiblyIncludes(Qualifiers other) const
Determines if these qualifiers compatibly include another set.
CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2)
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
QualType getPointeeType() const
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
const T * castAs() const
Member-template castAs<specific type>.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
Represents a C++ destructor within a class.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool isNullPtrType() const
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, bool AllowFold=true)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Defines the clang::TypeLoc interface and its subclasses.
bool handlerCanCatch(QualType HandlerType, QualType ExceptionType)
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
The result type of a method or function.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
static CanThrowResult canDynamicCastThrow(const CXXDynamicCastExpr *DC)
bool isConstQualified() const
Determine whether this type is const-qualified.
RecordDecl * getDecl() const
noexcept(expression), evals to 'false'
CanThrowResult
Possible results from evaluation of a noexcept expression.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
ExceptionSpecificationType Type
The kind of exception specification this is.
TypeLoc IgnoreParens() const
ExtProtoInfo getExtProtoInfo() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Encodes a location in the source.
QualType getReturnType() const
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
CastKind getCastKind() const
Represents a static or instance method of a struct/union/class.
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
static bool hasImplicitExceptionSpec(FunctionDecl *Decl)
Determine whether a function has an implicitly-generated exception specification. ...
bool isStdNamespace() const
static CanThrowResult canTypeidThrow(Sema &S, const CXXTypeidExpr *DC)
Represents a canonical, potentially-qualified type.
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
bool isLibstdcxxEagerExceptionSpecHack(const Declarator &D)
Determine if we're in a case where we need to (incorrectly) eagerly parse an exception specification ...
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
exception_iterator exception_begin() const
StringRef getName() const
Return the actual identifier string.
bool isTypeOperand() const
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
not evaluated yet, for special member function
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
ASTMutationListener * getASTMutationListener() const
bool hasDependentExceptionSpec() const
Return whether this function has a dependent exception spec.
StmtClass getStmtClass() const
ArrayRef< QualType > exceptions() const
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
bool isAmbiguous(CanQualType BaseType)
Determine whether the path from the most-derived type to the given base type is ambiguous (i...
A pointer to member type per C++ 8.3.3 - Pointers to members.
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &ESI)
Expr * IgnoreParenImpCasts() LLVM_READONLY
IgnoreParenImpCasts - Ignore parentheses and implicit casts.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
CanThrowResult canThrow() const
Determine whether this function type has a non-throwing exception specification.
bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Superset, SourceLocation SuperLoc, const FunctionProtoType *Subset, SourceLocation SubLoc)
CheckExceptionSpecSubset - Check whether the second function type's exception specification is a subs...
bool isFunctionType() const
TypeSourceInfo * getTypeSourceInfo() const
Base for LValueReferenceType and RValueReferenceType.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
Holds information about the various types of exception specification.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
bool isObjectType() const
Determine whether this type is an object type.
SourceManager & getSourceManager()
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
QualType getParamType(unsigned i) const
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\, const ASTContext *Context=nullptr) const
Represents a C++ struct/union/class.
unsigned getBuiltinID() const
Returns a value indicating whether this function corresponds to a builtin function.
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
AccessResult CheckBaseClassAccess(SourceLocation AccessLoc, QualType Base, QualType Derived, const CXXBasePath &Path, unsigned DiagID, bool ForceCheck=false, bool ForceUnprivileged=false)
Checks access for a hierarchy conversion.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated, or computed.
static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D)
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression...
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
bool isPointerType() const
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
static bool exceptionSpecNotKnownYet(const FunctionDecl *FD)
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
A trivial tuple used to represent a source range.
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
static CanThrowResult canSubExprsThrow(Sema &S, const Expr *E)
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)
void setType(QualType newType)
SourceLocation getBegin() const
static const FunctionProtoType * GetUnderlyingFunction(QualType T)
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
SourceLocation getLocation() const
QualType getType() const
Return the type wrapped by this type source info.
noexcept(expression), evals to 'true'
Expr * IgnoreParens() LLVM_READONLY
IgnoreParens - Ignore parentheses.