21 #include "llvm/ADT/SmallPtrSet.h" 22 #include "llvm/ADT/SmallString.h" 47 if (!RD || !RD->getIdentifier() || !RD->getDescribedClassTemplate() ||
60 if (!II || !(II->
isStr(
"__debug") || II->
isStr(
"__profile")) ||
61 !ND->isInStdNamespace())
69 return llvm::StringSwitch<bool>(RD->getIdentifier()->getName())
71 .Case(
"pair", IsInStd)
72 .Case(
"priority_queue", IsInStd)
73 .Case(
"stack", IsInStd)
74 .Case(
"queue", IsInStd)
86 if (Converted.
get()->isValueDependent()) {
94 diag::err_noexcept_needs_constant_expression,
133 if (RT->isRValueReferenceType()) {
137 Diag(Range.
getBegin(), diag::err_rref_in_exception_spec)
150 unsigned DiagID = diag::err_incomplete_in_exception_spec;
151 bool ReturnValueOnError =
true;
153 DiagID = diag::ext_incomplete_in_exception_spec;
154 ReturnValueOnError =
false;
159 return ReturnValueOnError;
190 Diag(Loc, diag::err_exception_spec_not_parsed);
214 Diag(Loc, diag::err_exception_spec_not_parsed);
226 Listener->ResolvedExceptionSpec(FD);
246 bool *MissingExceptionSpecification =
nullptr,
247 bool *MissingEmptyExceptionSpecification =
nullptr,
248 bool AllowNoexceptAllMatchWithNoSpec =
false,
bool IsOperatorNew =
false);
253 if (!isa<CXXDestructorDecl>(Decl) &&
264 return isa<CXXDestructorDecl>(Decl);
279 bool IsOperatorNew = OO == OO_New || OO == OO_Array_New;
280 bool MissingExceptionSpecification =
false;
281 bool MissingEmptyExceptionSpecification =
false;
283 unsigned DiagID = diag::err_mismatched_exception_spec;
284 bool ReturnValueOnError =
true;
286 DiagID = diag::ext_mismatched_exception_spec;
287 ReturnValueOnError =
false;
301 *
this,
PDiag(DiagID),
PDiag(diag::note_previous_declaration),
304 &MissingExceptionSpecification, &MissingEmptyExceptionSpecification,
305 true, IsOperatorNew)) {
322 if (!MissingExceptionSpecification)
323 return ReturnValueOnError;
336 if (MissingEmptyExceptionSpecification && NewProto &&
376 DiagID = diag::ext_ms_missing_exception_specification;
377 ReturnValueOnError =
false;
382 DiagID = diag::ext_missing_exception_specification;
383 ReturnValueOnError =
false;
387 DiagID = diag::ext_missing_exception_specification;
388 ReturnValueOnError =
false;
390 DiagID = diag::err_missing_exception_specification;
391 ReturnValueOnError =
true;
396 llvm::raw_svector_ostream OS(ExceptionSpecString);
404 bool OnFirstException =
true;
405 for (
const auto &E : OldProto->
exceptions()) {
406 if (OnFirstException)
407 OnFirstException =
false;
425 assert(OldProto->
getNoexceptExpr() !=
nullptr &&
"Expected non-null Expr");
430 OS <<
"__attribute__((nothrow))";
437 llvm_unreachable(
"This spec type is compatible with none.");
446 if (!FTLoc.getTypePtr()->hasTrailingReturn())
462 return ReturnValueOnError;
475 unsigned DiagID = diag::err_mismatched_exception_spec;
477 DiagID = diag::ext_mismatched_exception_spec;
479 *
this,
PDiag(DiagID),
PDiag(diag::note_previous_declaration),
480 Old, OldLoc, New, NewLoc);
498 bool *MissingExceptionSpecification,
499 bool *MissingEmptyExceptionSpecification,
500 bool AllowNoexceptAllMatchWithNoSpec,
bool IsOperatorNew) {
501 if (MissingExceptionSpecification)
502 *MissingExceptionSpecification =
false;
504 if (MissingEmptyExceptionSpecification)
505 *MissingEmptyExceptionSpecification =
false;
538 "Shouldn't see unknown exception specifications here");
552 if (!AllowNoexceptAllMatchWithNoSpec &&
565 llvm::FoldingSetNodeID OldFSN, NewFSN;
568 if (OldFSN == NewFSN)
578 llvm::SmallPtrSet<CanQualType, 8> OldTypes, NewTypes;
584 if (OldTypes.count(TypePtr))
585 NewTypes.insert(TypePtr);
592 if (Success && OldTypes.size() == NewTypes.size())
599 if (S.
getLangOpts().CPlusPlus11 && IsOperatorNew) {
602 WithExceptions = New;
604 WithExceptions = Old;
611 if (Name && Name->
getName() ==
"bad_alloc") {
613 if (ExRecord->isInStdNamespace()) {
623 if (MissingExceptionSpecification && OldEST !=
EST_None &&
627 *MissingExceptionSpecification =
true;
629 if (MissingEmptyExceptionSpecification && OldCanThrow ==
CT_Cannot) {
633 *MissingEmptyExceptionSpecification =
true;
639 S.
Diag(NewLoc, DiagID);
641 S.
Diag(OldLoc, NoteID);
734 llvm_unreachable(
"access check dependent for unprivileged context");
736 llvm_unreachable(
"access check delayed in non-declaration");
738 llvm_unreachable(
"unexpected access check result");
775 "Shouldn't see unknown exception specifications here");
798 Diag(SubLoc, NoThrowDiagID);
800 Diag(SuperLoc, NoteID);
808 Diag(SubLoc, DiagID);
810 Diag(SuperLoc, NoteID);
815 "Exception spec subset: non-dynamic case slipped through.");
820 SubI = RefTy->getPointeeType();
823 bool Contained =
false;
837 Diag(SubLoc, DiagID);
839 Diag(SuperLoc, NoteID);
875 auto RetDiag = DiagID;
878 *
this, RetDiag,
PDiag(),
886 "Functions have different argument counts.");
888 auto ParamDiag = DiagID;
891 *
this, ParamDiag,
PDiag(),
911 unsigned DiagID = diag::err_incompatible_exception_specs;
912 unsigned NestedDiagID = diag::err_deep_exception_specs_differ;
917 DiagID = diag::warn_incompatible_exception_specs;
918 NestedDiagID = diag::warn_deep_exception_specs_differ;
961 unsigned DiagID = diag::err_override_exception_spec;
963 DiagID = diag::ext_override_exception_spec;
965 PDiag(diag::err_deep_exception_specs_differ),
966 PDiag(diag::note_overridden_virtual_function),
967 PDiag(diag::ext_override_exception_spec),
987 if (D && isa<FunctionDecl>(D) && D->
hasAttr<NoThrowAttr>())
993 if (S.
getLangOpts().CPlusPlus17 && isa<CallExpr>(E)) {
994 E = cast<CallExpr>(E)->getCallee();
1002 if (
auto *Op = dyn_cast<BinaryOperator>(E)) {
1003 assert(Op->getOpcode() == BO_PtrMemD || Op->getOpcode() == BO_PtrMemI);
1004 T = Op->getRHS()->getType()
1007 T = cast<MemberExpr>(E)->getMemberDecl()->getType();
1010 }
else if (
const ValueDecl *VD = dyn_cast_or_null<ValueDecl>(D))
1062 if (!cast<CXXRecordDecl>(RT->
getDecl())->isPolymorphic())
1076 case Expr::ConstantExprClass:
1077 return canThrow(cast<ConstantExpr>(E)->getSubExpr());
1079 case Expr::CXXThrowExprClass:
1083 case Expr::CXXDynamicCastExprClass: {
1092 case Expr::CXXTypeidExprClass:
1100 case Expr::CallExprClass:
1101 case Expr::CXXMemberCallExprClass:
1102 case Expr::CXXOperatorCallExprClass:
1103 case Expr::UserDefinedLiteralClass: {
1104 const CallExpr *CE = cast<CallExpr>(E);
1117 case Expr::CXXConstructExprClass:
1118 case Expr::CXXTemporaryObjectExprClass: {
1120 cast<CXXConstructExpr>(E)->getConstructor());
1126 case Expr::CXXInheritedCtorInitExprClass:
1128 cast<CXXInheritedCtorInitExpr>(E)->getConstructor());
1130 case Expr::LambdaExprClass: {
1131 const LambdaExpr *Lambda = cast<LambdaExpr>(E);
1136 Cap != CapEnd; ++Cap)
1141 case Expr::CXXNewExprClass: {
1146 CT =
canCalleeThrow(*
this, E, cast<CXXNewExpr>(E)->getOperatorNew());
1152 case Expr::CXXDeleteExprClass: {
1154 QualType DTy = cast<CXXDeleteExpr>(E)->getDestroyedType();
1159 cast<CXXDeleteExpr>(E)->getOperatorDelete());
1161 const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
1172 case Expr::CXXBindTemporaryExprClass: {
1175 cast<CXXBindTemporaryExpr>(E)->getTemporary()->getDestructor());
1183 case Expr::ObjCMessageExprClass:
1184 case Expr::ObjCPropertyRefExprClass:
1185 case Expr::ObjCSubscriptRefExprClass:
1191 case Expr::ObjCArrayLiteralClass:
1192 case Expr::ObjCDictionaryLiteralClass:
1193 case Expr::ObjCBoxedExprClass:
1198 case Expr::CoawaitExprClass:
1199 case Expr::ConditionalOperatorClass:
1200 case Expr::CompoundLiteralExprClass:
1201 case Expr::CoyieldExprClass:
1202 case Expr::CXXConstCastExprClass:
1203 case Expr::CXXReinterpretCastExprClass:
1204 case Expr::BuiltinBitCastExprClass:
1205 case Expr::CXXStdInitializerListExprClass:
1206 case Expr::DesignatedInitExprClass:
1207 case Expr::DesignatedInitUpdateExprClass:
1208 case Expr::ExprWithCleanupsClass:
1209 case Expr::ExtVectorElementExprClass:
1210 case Expr::InitListExprClass:
1211 case Expr::ArrayInitLoopExprClass:
1212 case Expr::MemberExprClass:
1213 case Expr::ObjCIsaExprClass:
1214 case Expr::ObjCIvarRefExprClass:
1215 case Expr::ParenExprClass:
1216 case Expr::ParenListExprClass:
1217 case Expr::ShuffleVectorExprClass:
1218 case Expr::ConvertVectorExprClass:
1219 case Expr::VAArgExprClass:
1223 case Expr::ArraySubscriptExprClass:
1224 case Expr::OMPArraySectionExprClass:
1225 case Expr::BinaryOperatorClass:
1226 case Expr::DependentCoawaitExprClass:
1227 case Expr::CompoundAssignOperatorClass:
1228 case Expr::CStyleCastExprClass:
1229 case Expr::CXXStaticCastExprClass:
1230 case Expr::CXXFunctionalCastExprClass:
1231 case Expr::ImplicitCastExprClass:
1232 case Expr::MaterializeTemporaryExprClass:
1233 case Expr::UnaryOperatorClass: {
1239 case Expr::StmtExprClass:
1242 case Expr::CXXDefaultArgExprClass:
1243 return canThrow(cast<CXXDefaultArgExpr>(E)->getExpr());
1245 case Expr::CXXDefaultInitExprClass:
1246 return canThrow(cast<CXXDefaultInitExpr>(E)->getExpr());
1248 case Expr::ChooseExprClass:
1251 return canThrow(cast<ChooseExpr>(E)->getChosenSubExpr());
1253 case Expr::GenericSelectionExprClass:
1254 if (cast<GenericSelectionExpr>(E)->isResultDependent())
1256 return canThrow(cast<GenericSelectionExpr>(E)->getResultExpr());
1259 case Expr::CXXDependentScopeMemberExprClass:
1260 case Expr::CXXUnresolvedConstructExprClass:
1261 case Expr::DependentScopeDeclRefExprClass:
1262 case Expr::CXXFoldExprClass:
1265 case Expr::AsTypeExprClass:
1266 case Expr::BinaryConditionalOperatorClass:
1267 case Expr::BlockExprClass:
1268 case Expr::CUDAKernelCallExprClass:
1269 case Expr::DeclRefExprClass:
1270 case Expr::ObjCBridgedCastExprClass:
1271 case Expr::ObjCIndirectCopyRestoreExprClass:
1272 case Expr::ObjCProtocolExprClass:
1273 case Expr::ObjCSelectorExprClass:
1274 case Expr::ObjCAvailabilityCheckExprClass:
1275 case Expr::OffsetOfExprClass:
1276 case Expr::PackExpansionExprClass:
1277 case Expr::PseudoObjectExprClass:
1278 case Expr::SubstNonTypeTemplateParmExprClass:
1279 case Expr::SubstNonTypeTemplateParmPackExprClass:
1280 case Expr::FunctionParmPackExprClass:
1281 case Expr::UnaryExprOrTypeTraitExprClass:
1282 case Expr::UnresolvedLookupExprClass:
1283 case Expr::UnresolvedMemberExprClass:
1284 case Expr::TypoExprClass:
1288 case Expr::AddrLabelExprClass:
1289 case Expr::ArrayTypeTraitExprClass:
1290 case Expr::AtomicExprClass:
1291 case Expr::TypeTraitExprClass:
1292 case Expr::CXXBoolLiteralExprClass:
1293 case Expr::CXXNoexceptExprClass:
1294 case Expr::CXXNullPtrLiteralExprClass:
1295 case Expr::CXXPseudoDestructorExprClass:
1296 case Expr::CXXScalarValueInitExprClass:
1297 case Expr::CXXThisExprClass:
1298 case Expr::CXXUuidofExprClass:
1299 case Expr::CharacterLiteralClass:
1300 case Expr::ExpressionTraitExprClass:
1301 case Expr::FloatingLiteralClass:
1302 case Expr::GNUNullExprClass:
1303 case Expr::ImaginaryLiteralClass:
1304 case Expr::ImplicitValueInitExprClass:
1305 case Expr::IntegerLiteralClass:
1306 case Expr::FixedPointLiteralClass:
1307 case Expr::ArrayInitIndexExprClass:
1308 case Expr::NoInitExprClass:
1309 case Expr::ObjCEncodeExprClass:
1310 case Expr::ObjCStringLiteralClass:
1311 case Expr::ObjCBoolLiteralExprClass:
1312 case Expr::OpaqueValueExprClass:
1313 case Expr::PredefinedExprClass:
1314 case Expr::SizeOfPackExprClass:
1315 case Expr::StringLiteralClass:
1316 case Expr::SourceLocExprClass:
1320 case Expr::MSPropertyRefExprClass:
1321 case Expr::MSPropertySubscriptExprClass:
1322 llvm_unreachable(
"Invalid class for expression");
1324 #define STMT(CLASS, PARENT) case Expr::CLASS##Class: 1325 #define STMT_RANGE(Base, First, Last) 1326 #define LAST_STMT_RANGE(BASE, FIRST, LAST) 1327 #define EXPR(CLASS, PARENT) 1328 #define ABSTRACT_STMT(STMT) 1329 #include "clang/AST/StmtNodes.inc" 1331 llvm_unreachable(
"Invalid class for expression");
1333 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.
bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const PartialDiagnostic &NoThrowDiagID, const FunctionProtoType *Superset, SourceLocation SuperLoc, const FunctionProtoType *Subset, SourceLocation SubLoc)
CheckExceptionSpecSubset - Check whether the second function type's exception specification is a subs...
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...
Microsoft throw(...) extension.
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.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
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
Return 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
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
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 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.
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...
Microsoft __declspec(nothrow) extension.
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
Skip past any parentheses which might surround this expression until reaching a fixed point...