clang: lib/Sema/SemaExceptionSpec.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

22#include "llvm/ADT/SmallPtrSet.h"

23#include

24

26

28{

36}

37

38

39

40

41

42

43

45 auto *RD = dyn_cast(CurContext);

46

47

48

49

50 if (!RD || !RD->getIdentifier() || !RD->getDescribedClassTemplate() ||

51 D.getIdentifier() || D.getIdentifier()->isStr("swap"))

52 return false;

53

54 auto *ND = dyn_cast(RD->getDeclContext());

55 if (!ND)

56 return false;

57

58 bool IsInStd = ND->isStdNamespace();

59 if (!IsInStd) {

60

61

63 if (!II || !(II->isStr("__debug") || II->isStr("__profile")) ||

64 !ND->isInStdNamespace())

65 return false;

66 }

67

68

70 return false;

71

72 return llvm::StringSwitch(RD->getIdentifier()->getName())

73 .Case("array", true)

74 .Case("pair", IsInStd)

75 .Case("priority_queue", IsInStd)

76 .Case("stack", IsInStd)

77 .Case("queue", IsInStd)

78 .Default(false);

79}

80

83

87 return NoexceptExpr;

88 }

89

93

96

97 auto *BoolExpr = new (Context)

99 llvm::APSInt Value{1};

102 }

103

106 return Converted;

107 }

108

111 return Converted;

112}

113

115

116

117

118

119

120

125

126 int Kind = 0;

131

132

133

135 return false;

139

140 if (RT->isRValueReferenceType()) {

141

142

143

144 Diag(Range.getBegin(), diag::err_rref_in_exception_spec)

146 return true;

147 }

148 }

149

150

151

152

153

154

155

156

157 unsigned DiagID = diag::err_incomplete_in_exception_spec;

158 bool ReturnValueOnError = true;

160 DiagID = diag::ext_incomplete_in_exception_spec;

161 ReturnValueOnError = false;

162 }

166 return ReturnValueOnError;

167

168

170 Diag(Range.getBegin(), diag::err_wasm_reftype_exception_spec);

171 return true;

172 }

173

174

175

177 Diag(Range.getBegin(), diag::err_sizeless_in_exception_spec)

178 << (Kind == 2 ? 1 : 0) << PointeeT << Range;

179 return true;

180 }

181

182 return false;

183}

184

186

187

189 return false;

190

195 else

196 return false;

197

199 if (!FnT)

200 return false;

201

203}

204

208 Diag(Loc, diag::err_exception_spec_not_parsed);

209 return nullptr;

210 }

211

213 return FPT;

214

218

219

221 return SourceFPT;

222

223

226 else

228

232 Diag(Loc, diag::err_exception_spec_not_parsed);

233 Proto = nullptr;

234 }

235 return Proto;

236}

237

238void

241

244 Listener->ResolvedExceptionSpec(FD);

245

248}

249

254 return true;

256 return false;

258 return DC->isRecord() && cast(DC)->isBeingDefined();

259}

260

262 Sema &S, const PartialDiagnostic &DiagID, const PartialDiagnostic &NoteID,

263 const FunctionProtoType *Old, SourceLocation OldLoc,

264 const FunctionProtoType *New, SourceLocation NewLoc,

265 bool *MissingExceptionSpecification = nullptr,

266 bool *MissingEmptyExceptionSpecification = nullptr,

267 bool AllowNoexceptAllMatchWithNoSpec = false, bool IsOperatorNew = false);

268

269

270

272 if (!isa(Decl) &&

273 Decl->getDeclName().getCXXOverloadedOperator() != OO_Delete &&

274 Decl->getDeclName().getCXXOverloadedOperator() != OO_Array_Delete)

275 return false;

276

277

278

279

280

281

282 if (Decl->getTypeSourceInfo())

283 return isa(Decl);

284

287}

288

290

291

292

294 return false;

295

297 bool IsOperatorNew = OO == OO_New || OO == OO_Array_New;

298 bool MissingExceptionSpecification = false;

299 bool MissingEmptyExceptionSpecification = false;

300

301 unsigned DiagID = diag::err_mismatched_exception_spec;

302 bool ReturnValueOnError = true;

304 DiagID = diag::ext_mismatched_exception_spec;

305 ReturnValueOnError = false;

306 }

307

308

309

310

313 return false;

314 }

315

316

317

319 *this, PDiag(DiagID), PDiag(diag::note_previous_declaration),

322 &MissingExceptionSpecification, &MissingEmptyExceptionSpecification,

323 true, IsOperatorNew)) {

324

325

326

327

330 Diag(New->getLocation(), diag::ext_implicit_exception_spec_mismatch)

333 Diag(Old->getLocation(), diag::note_previous_declaration);

334 }

335 return false;

336 }

337

338

339

340 if (!MissingExceptionSpecification)

341 return ReturnValueOnError;

342

344

345

346

347

348

349

350

351

352

353 if (MissingEmptyExceptionSpecification &&

359 NewProto->getReturnType(), NewProto->getParamTypes(),

360 NewProto->getExtProtoInfo().withExceptionSpec(EST_DynamicNone)));

361 return false;

362 }

363

365

368

369

370 ESI.Exceptions = OldProto->exceptions();

371 }

372

377

378

379

382 } else {

383

384

386 NewProto->getReturnType(), NewProto->getParamTypes(),

387 NewProto->getExtProtoInfo().withExceptionSpec(ESI)));

388 }

389

391 DiagID = diag::ext_missing_exception_specification;

392 ReturnValueOnError = false;

395

396

397 DiagID = diag::ext_missing_exception_specification;

398 ReturnValueOnError = false;

400

402 return false;

403 }

404

405

406 DiagID = diag::ext_missing_exception_specification;

407 ReturnValueOnError = false;

408 } else {

409 DiagID = diag::err_missing_exception_specification;

410 ReturnValueOnError = true;

411 }

412

413

415 llvm::raw_svector_ostream OS(ExceptionSpecString);

416 switch (OldProto->getExceptionSpecType()) {

418 OS << "throw()";

419 break;

420

422 OS << "throw(";

423 bool OnFirstException = true;

424 for (const auto &E : OldProto->exceptions()) {

425 if (OnFirstException)

426 OnFirstException = false;

427 else

428 OS << ", ";

429

431 }

432 OS << ")";

433 break;

434 }

435

437 OS << "noexcept";

438 break;

439

443 OS << "noexcept(";

444 assert(OldProto->getNoexceptExpr() != nullptr && "Expected non-null Expr");

445 OldProto->getNoexceptExpr()->printPretty(OS, nullptr, getPrintingPolicy());

446 OS << ")";

447 break;

449 OS <<"__attribute__((nothrow))";

450 break;

456 llvm_unreachable("This spec type is compatible with none.");

457 }

458

462

463

465 if (!FTLoc.getTypePtr()->hasTrailingReturn())

467 }

468

471 << New << OS.str();

472 else {

474 << New << OS.str()

476 }

477

479 Diag(Old->getLocation(), diag::note_previous_declaration);

480

481 return ReturnValueOnError;

482}

483

488 return false;

489

490 unsigned DiagID = diag::err_mismatched_exception_spec;

492 DiagID = diag::ext_mismatched_exception_spec;

494 *this, PDiag(DiagID), PDiag(diag::note_previous_declaration),

495 Old, OldLoc, New, NewLoc);

496

497

499 return false;

501}

502

503

504

505

506

507

508

513 bool *MissingExceptionSpecification,

514 bool *MissingEmptyExceptionSpecification,

515 bool AllowNoexceptAllMatchWithNoSpec, bool IsOperatorNew) {

516 if (MissingExceptionSpecification)

517 *MissingExceptionSpecification = false;

518

519 if (MissingEmptyExceptionSpecification)

520 *MissingEmptyExceptionSpecification = false;

521

523 if (!Old)

524 return false;

526 if (!New)

527 return false;

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

550

553 "Shouldn't see unknown exception specifications here");

554

557

558

560 return false;

561

562

565

566

567 if (!AllowNoexceptAllMatchWithNoSpec &&

570

571 } else {

572 return false;

573 }

574 }

575

576

577

578

580 llvm::FoldingSetNodeID OldFSN, NewFSN;

583 if (OldFSN == NewFSN)

584 return false;

585 }

586

587

588

591

592

594 for (const auto &I : Old->exceptions())

596

597 for (const auto &I : New->exceptions()) {

599 if (OldTypes.count(TypePtr))

600 NewTypes.insert(TypePtr);

601 else {

603 break;

604 }

605 }

606

607 if (Success && OldTypes.size() == NewTypes.size())

608 return false;

609 }

610

611

612

613

614 if (S.getLangOpts().CPlusPlus11 && IsOperatorNew) {

617 WithExceptions = New;

619 WithExceptions = Old;

620 if (WithExceptions && WithExceptions->getNumExceptions() == 1) {

621

622

626 if (Name && Name->getName() == "bad_alloc") {

627

628 if (ExRecord->isInStdNamespace()) {

629 return false;

630 }

631 }

632 }

633 }

634 }

635

636

637

638 if (MissingExceptionSpecification && OldEST != EST_None &&

640

641

642 *MissingExceptionSpecification = true;

643

644 if (MissingEmptyExceptionSpecification && OldCanThrow == CT_Cannot) {

645

646

647

648 *MissingEmptyExceptionSpecification = true;

649 }

650

651 return true;

652 }

653

654 S.Diag(NewLoc, DiagID);

656 S.Diag(OldLoc, NoteID);

657 return true;

658}

659

667 return false;

669 New, NewLoc);

670}

671

673

674

675

676

677

679 if (RefTy)

681

682

684 return true;

685

686

690 return false;

691

692

693

695 return true;

696

697

698

699

700

701

702 bool LifetimeConv;

704

705

707 LifetimeConv) ||

709 return true;

710

711

713 return false;

714

715

719 HandlerType =

722 return false;

723

725 return true;

726

727

728 }

729

730

731

733 return false;

734 CXXBasePaths Paths(true, true,

735 false);

738 return false;

739

740

742 Paths.front(),

743 0,

744 true,

745 true)) {

749 llvm_unreachable("access check dependent for unprivileged context");

751 llvm_unreachable("access check delayed in non-declaration");

752 }

753 llvm_unreachable("unexpected access check result");

754}

755

759 const FunctionProtoType *Superset, bool SkipSupersetFirstParameter,

761 bool SkipSubsetFirstParameter, SourceLocation SubLoc) {

762

763

765 return false;

766

767

768

769

771 SubLoc = SuperLoc;

772

773

775 if (!Superset)

776 return false;

778 if (!Subset)

779 return false;

780

785 "Shouldn't see unknown exception specifications here");

786

787

788

789

790

792 return false;

793

796

797

798

802 SkipSupersetFirstParameter, SuperLoc, Subset,

803 SkipSubsetFirstParameter, SubLoc);

804

805

806

807 if (NoThrowDiagID.getDiagID() != 0 && SubCanThrow == CT_Can &&

809 Diag(SubLoc, NoThrowDiagID);

811 Diag(SuperLoc, NoteID);

812 return true;

813 }

814

815

816

819 Diag(SubLoc, DiagID);

821 Diag(SuperLoc, NoteID);

822 return true;

823 }

824

826 "Exception spec subset: non-dynamic case slipped through.");

827

828

831 SubI = RefTy->getPointeeType();

832

833

834 bool Contained = false;

836

837

838

839

840

841

843 Contained = true;

844 break;

845 }

846 }

847 if (!Contained) {

848 Diag(SubLoc, DiagID);

850 Diag(SuperLoc, NoteID);

851 return true;

852 }

853 }

854

856 SkipSupersetFirstParameter, SuperLoc, Subset,

857 SkipSupersetFirstParameter, SubLoc);

858}

859

860static bool

866 if (!TFunc)

867 return false;

869 if (!SFunc)

870 return false;

871

873 SFunc, SourceLoc);

874}

875

880 bool SkipSourceFirstParameter, SourceLocation SourceLoc) {

881 auto RetDiag = DiagID;

882 RetDiag << 0;

884 *this, RetDiag, PDiag(),

886 SourceLoc))

887 return true;

888

889

890

891 assert((Target->getNumParams() - (unsigned)SkipTargetFirstParameter) ==

892 (Source->getNumParams() - (unsigned)SkipSourceFirstParameter) &&

893 "Functions have different argument counts.");

894 for (unsigned i = 0, E = Target->getNumParams(); i != E; ++i) {

895 auto ParamDiag = DiagID;

896 ParamDiag << 1;

898 *this, ParamDiag, PDiag(),

899 Target->getParamType(i + (SkipTargetFirstParameter ? 1 : 0)),

900 TargetLoc, Source->getParamType(SkipSourceFirstParameter ? 1 : 0),

901 SourceLoc))

902 return true;

903 }

904 return false;

905}

906

908

909

912 return false;

913

914

917 return false;

918

919 unsigned DiagID = diag::err_incompatible_exception_specs;

920 unsigned NestedDiagID = diag::err_deep_exception_specs_differ;

921

922

923

925 DiagID = diag::warn_incompatible_exception_specs;

926 NestedDiagID = diag::warn_deep_exception_specs_differ;

927 }

928

929

930

931

932

933

934

935

936

937

938

939

940

942 PDiag(), ToFunc, 0,

946}

947

950

951

954 return false;

955

956

957

959 return false;

960

961

962

963

964

967 return false;

968 }

969

970 unsigned DiagID = diag::err_override_exception_spec;

972 DiagID = diag::ext_override_exception_spec;

974 PDiag(DiagID), PDiag(diag::err_deep_exception_specs_differ),

975 PDiag(diag::note_overridden_virtual_function),

976 PDiag(diag::ext_override_exception_spec),

981}

982

985 for (const Stmt *SubStmt : S->children()) {

986 if (!SubStmt)

987 continue;

990 break;

991 }

992 return R;

993}

994

997

998

999 if (isa_and_nonnull(D) && D->hasAttr())

1001

1003

1004

1005 if (S.getLangOpts().CPlusPlus17 && isa_and_nonnull(E)) {

1006 E = cast(E)->getCallee();

1007 T = E->getType();

1009

1010

1011 E = E->IgnoreParenImpCasts();

1012

1013

1014 if (auto *Op = dyn_cast(E)) {

1015 assert(Op->getOpcode() == BO_PtrMemD || Op->getOpcode() == BO_PtrMemI);

1016 T = Op->getRHS()->getType()

1018 } else {

1019 T = cast(E)->getMemberDecl()->getType();

1020 }

1021 }

1022 } else if (const ValueDecl *VD = dyn_cast_or_null(D))

1023 T = VD->getType();

1024 else

1025

1027

1038

1039 if (!FT)

1041

1042 if (Loc.isValid() || (Loc.isInvalid() && E))

1043 FT = S.ResolveExceptionSpec(Loc.isInvalid() ? E->getBeginLoc() : Loc, FT);

1044 if (!FT)

1046

1048}

1049

1052

1053

1057

1058

1060 if (auto *RD =

1062 if (auto *Dtor = RD->getDestructor()) {

1065 }

1066 }

1067 }

1068

1069

1070 if (auto *DD = dyn_cast(VD))

1071 for (auto *B : DD->bindings())

1072 if (auto *HD = B->getHoldingVar())

1074

1075 return CT;

1076}

1077

1081

1084

1087

1089}

1090

1092

1095

1098

1099

1102

1103

1106

1108}

1109

1111

1112

1113

1114 switch (S->getStmtClass()) {

1115 case Expr::ConstantExprClass:

1116 return canThrow(cast(S)->getSubExpr());

1117

1118 case Expr::CXXThrowExprClass:

1119

1121

1122 case Expr::CXXDynamicCastExprClass: {

1123

1124

1125 auto *CE = cast(S);

1126

1127 if (CE->getType()->isVariablyModifiedType())

1131 return CT;

1133 }

1134

1135 case Expr::CXXTypeidExprClass:

1136

1137

1138

1139 return canTypeidThrow(*this, cast(S));

1140

1141

1142

1143

1144 case Expr::CallExprClass:

1145 case Expr::CXXMemberCallExprClass:

1146 case Expr::CXXOperatorCallExprClass:

1147 case Expr::UserDefinedLiteralClass: {

1148 const CallExpr *CE = cast(S);

1154 else

1157 return CT;

1159 }

1160

1161 case Expr::CXXConstructExprClass:

1162 case Expr::CXXTemporaryObjectExprClass: {

1163 auto *CE = cast(S);

1164

1165 if (CE->getType()->isVariablyModifiedType())

1169 return CT;

1171 }

1172

1173 case Expr::CXXInheritedCtorInitExprClass: {

1174 auto *ICIE = cast(S);

1175 return canCalleeThrow(*this, ICIE, ICIE->getConstructor());

1176 }

1177

1178 case Expr::LambdaExprClass: {

1179 const LambdaExpr *Lambda = cast(S);

1184 Cap != CapEnd; ++Cap)

1186 return CT;

1187 }

1188

1189 case Expr::CXXNewExprClass: {

1190 auto *NE = cast(S);

1192 if (NE->isTypeDependent())

1194 else

1195 CT = canCalleeThrow(*this, NE, NE->getOperatorNew());

1197 return CT;

1199 }

1200

1201 case Expr::CXXDeleteExprClass: {

1202 auto *DE = cast(S);

1204 QualType DTy = DE->getDestroyedType();

1207 } else {

1208

1209

1210

1211

1212

1213 const FunctionDecl *OperatorDelete = DE->getOperatorDelete();

1218 }

1219

1220

1222

1223

1225 return CT;

1226 }

1228 }

1229

1230 case Expr::CXXBindTemporaryExprClass: {

1231 auto *BTE = cast(S);

1232

1234 canCalleeThrow(*this, BTE, BTE->getTemporary()->getDestructor());

1236 return CT;

1238 }

1239

1240 case Expr::PseudoObjectExprClass: {

1241 auto *POE = cast(S);

1243 for (const Expr *E : POE->semantics()) {

1246 break;

1247 }

1248 return CT;

1249 }

1250

1251

1252

1253 case Expr::ObjCMessageExprClass:

1254 case Expr::ObjCPropertyRefExprClass:

1255 case Expr::ObjCSubscriptRefExprClass:

1257

1258

1259

1260

1261 case Expr::ObjCArrayLiteralClass:

1262 case Expr::ObjCDictionaryLiteralClass:

1263 case Expr::ObjCBoxedExprClass:

1265

1266

1267

1268 case Expr::CoawaitExprClass:

1269 case Expr::ConditionalOperatorClass:

1270 case Expr::CoyieldExprClass:

1271 case Expr::CXXRewrittenBinaryOperatorClass:

1272 case Expr::CXXStdInitializerListExprClass:

1273 case Expr::DesignatedInitExprClass:

1274 case Expr::DesignatedInitUpdateExprClass:

1275 case Expr::ExprWithCleanupsClass:

1276 case Expr::ExtVectorElementExprClass:

1277 case Expr::InitListExprClass:

1278 case Expr::ArrayInitLoopExprClass:

1279 case Expr::MemberExprClass:

1280 case Expr::ObjCIsaExprClass:

1281 case Expr::ObjCIvarRefExprClass:

1282 case Expr::ParenExprClass:

1283 case Expr::ParenListExprClass:

1284 case Expr::ShuffleVectorExprClass:

1285 case Expr::StmtExprClass:

1286 case Expr::ConvertVectorExprClass:

1287 case Expr::VAArgExprClass:

1288 case Expr::CXXParenListInitExprClass:

1290

1291 case Expr::CompoundLiteralExprClass:

1292 case Expr::CXXConstCastExprClass:

1293 case Expr::CXXAddrspaceCastExprClass:

1294 case Expr::CXXReinterpretCastExprClass:

1295 case Expr::BuiltinBitCastExprClass:

1296

1297 if (cast(S)->getType()->isVariablyModifiedType())

1300

1301

1302 case Expr::ArraySubscriptExprClass:

1303 case Expr::MatrixSubscriptExprClass:

1304 case Expr::ArraySectionExprClass:

1305 case Expr::OMPArrayShapingExprClass:

1306 case Expr::OMPIteratorExprClass:

1307 case Expr::BinaryOperatorClass:

1308 case Expr::DependentCoawaitExprClass:

1309 case Expr::CompoundAssignOperatorClass:

1310 case Expr::CStyleCastExprClass:

1311 case Expr::CXXStaticCastExprClass:

1312 case Expr::CXXFunctionalCastExprClass:

1313 case Expr::ImplicitCastExprClass:

1314 case Expr::MaterializeTemporaryExprClass:

1315 case Expr::UnaryOperatorClass: {

1316

1317 if (auto *CE = dyn_cast(S))

1318 if (CE->getType()->isVariablyModifiedType())

1323 }

1324

1325 case Expr::CXXDefaultArgExprClass:

1326 return canThrow(cast(S)->getExpr());

1327

1328 case Expr::CXXDefaultInitExprClass:

1329 return canThrow(cast(S)->getExpr());

1330

1331 case Expr::ChooseExprClass: {

1332 auto *CE = cast(S);

1333 if (CE->isTypeDependent() || CE->isValueDependent())

1335 return canThrow(CE->getChosenSubExpr());

1336 }

1337

1338 case Expr::GenericSelectionExprClass:

1339 if (cast(S)->isResultDependent())

1341 return canThrow(cast(S)->getResultExpr());

1342

1343

1344 case Expr::CXXDependentScopeMemberExprClass:

1345 case Expr::CXXUnresolvedConstructExprClass:

1346 case Expr::DependentScopeDeclRefExprClass:

1347 case Expr::CXXFoldExprClass:

1348 case Expr::RecoveryExprClass:

1350

1351 case Expr::AsTypeExprClass:

1352 case Expr::BinaryConditionalOperatorClass:

1353 case Expr::BlockExprClass:

1354 case Expr::CUDAKernelCallExprClass:

1355 case Expr::DeclRefExprClass:

1356 case Expr::ObjCBridgedCastExprClass:

1357 case Expr::ObjCIndirectCopyRestoreExprClass:

1358 case Expr::ObjCProtocolExprClass:

1359 case Expr::ObjCSelectorExprClass:

1360 case Expr::ObjCAvailabilityCheckExprClass:

1361 case Expr::OffsetOfExprClass:

1362 case Expr::PackExpansionExprClass:

1363 case Expr::SubstNonTypeTemplateParmExprClass:

1364 case Expr::SubstNonTypeTemplateParmPackExprClass:

1365 case Expr::FunctionParmPackExprClass:

1366 case Expr::UnaryExprOrTypeTraitExprClass:

1367 case Expr::UnresolvedLookupExprClass:

1368 case Expr::UnresolvedMemberExprClass:

1369 case Expr::TypoExprClass:

1370

1372

1373 case Expr::AddrLabelExprClass:

1374 case Expr::ArrayTypeTraitExprClass:

1375 case Expr::AtomicExprClass:

1376 case Expr::TypeTraitExprClass:

1377 case Expr::CXXBoolLiteralExprClass:

1378 case Expr::CXXNoexceptExprClass:

1379 case Expr::CXXNullPtrLiteralExprClass:

1380 case Expr::CXXPseudoDestructorExprClass:

1381 case Expr::CXXScalarValueInitExprClass:

1382 case Expr::CXXThisExprClass:

1383 case Expr::CXXUuidofExprClass:

1384 case Expr::CharacterLiteralClass:

1385 case Expr::ExpressionTraitExprClass:

1386 case Expr::FloatingLiteralClass:

1387 case Expr::GNUNullExprClass:

1388 case Expr::ImaginaryLiteralClass:

1389 case Expr::ImplicitValueInitExprClass:

1390 case Expr::IntegerLiteralClass:

1391 case Expr::FixedPointLiteralClass:

1392 case Expr::ArrayInitIndexExprClass:

1393 case Expr::NoInitExprClass:

1394 case Expr::ObjCEncodeExprClass:

1395 case Expr::ObjCStringLiteralClass:

1396 case Expr::ObjCBoolLiteralExprClass:

1397 case Expr::OpaqueValueExprClass:

1398 case Expr::PredefinedExprClass:

1399 case Expr::SizeOfPackExprClass:

1400 case Expr::PackIndexingExprClass:

1401 case Expr::StringLiteralClass:

1402 case Expr::SourceLocExprClass:

1403 case Expr::EmbedExprClass:

1404 case Expr::ConceptSpecializationExprClass:

1405 case Expr::RequiresExprClass:

1406 case Expr::HLSLOutArgExprClass:

1407 case Stmt::OpenACCEnterDataConstructClass:

1408 case Stmt::OpenACCExitDataConstructClass:

1409 case Stmt::OpenACCWaitConstructClass:

1410 case Stmt::OpenACCInitConstructClass:

1411 case Stmt::OpenACCShutdownConstructClass:

1412 case Stmt::OpenACCSetConstructClass:

1413 case Stmt::OpenACCUpdateConstructClass:

1414

1416

1417 case Expr::MSPropertyRefExprClass:

1418 case Expr::MSPropertySubscriptExprClass:

1419 llvm_unreachable("Invalid class for expression");

1420

1421

1422 case Stmt::OpenACCComputeConstructClass:

1423 case Stmt::OpenACCLoopConstructClass:

1424 case Stmt::OpenACCCombinedConstructClass:

1425 case Stmt::OpenACCDataConstructClass:

1426 case Stmt::OpenACCHostDataConstructClass:

1427 case Stmt::AttributedStmtClass:

1428 case Stmt::BreakStmtClass:

1429 case Stmt::CapturedStmtClass:

1430 case Stmt::SYCLKernelCallStmtClass:

1431 case Stmt::CaseStmtClass:

1432 case Stmt::CompoundStmtClass:

1433 case Stmt::ContinueStmtClass:

1434 case Stmt::CoreturnStmtClass:

1435 case Stmt::CoroutineBodyStmtClass:

1436 case Stmt::CXXCatchStmtClass:

1437 case Stmt::CXXForRangeStmtClass:

1438 case Stmt::DefaultStmtClass:

1439 case Stmt::DoStmtClass:

1440 case Stmt::ForStmtClass:

1441 case Stmt::GCCAsmStmtClass:

1442 case Stmt::GotoStmtClass:

1443 case Stmt::IndirectGotoStmtClass:

1444 case Stmt::LabelStmtClass:

1445 case Stmt::MSAsmStmtClass:

1446 case Stmt::MSDependentExistsStmtClass:

1447 case Stmt::NullStmtClass:

1448 case Stmt::ObjCAtCatchStmtClass:

1449 case Stmt::ObjCAtFinallyStmtClass:

1450 case Stmt::ObjCAtSynchronizedStmtClass:

1451 case Stmt::ObjCAutoreleasePoolStmtClass:

1452 case Stmt::ObjCForCollectionStmtClass:

1453 case Stmt::OMPAtomicDirectiveClass:

1454 case Stmt::OMPAssumeDirectiveClass:

1455 case Stmt::OMPBarrierDirectiveClass:

1456 case Stmt::OMPCancelDirectiveClass:

1457 case Stmt::OMPCancellationPointDirectiveClass:

1458 case Stmt::OMPCriticalDirectiveClass:

1459 case Stmt::OMPDistributeDirectiveClass:

1460 case Stmt::OMPDistributeParallelForDirectiveClass:

1461 case Stmt::OMPDistributeParallelForSimdDirectiveClass:

1462 case Stmt::OMPDistributeSimdDirectiveClass:

1463 case Stmt::OMPFlushDirectiveClass:

1464 case Stmt::OMPDepobjDirectiveClass:

1465 case Stmt::OMPScanDirectiveClass:

1466 case Stmt::OMPForDirectiveClass:

1467 case Stmt::OMPForSimdDirectiveClass:

1468 case Stmt::OMPMasterDirectiveClass:

1469 case Stmt::OMPMasterTaskLoopDirectiveClass:

1470 case Stmt::OMPMaskedTaskLoopDirectiveClass:

1471 case Stmt::OMPMasterTaskLoopSimdDirectiveClass:

1472 case Stmt::OMPMaskedTaskLoopSimdDirectiveClass:

1473 case Stmt::OMPOrderedDirectiveClass:

1474 case Stmt::OMPCanonicalLoopClass:

1475 case Stmt::OMPParallelDirectiveClass:

1476 case Stmt::OMPParallelForDirectiveClass:

1477 case Stmt::OMPParallelForSimdDirectiveClass:

1478 case Stmt::OMPParallelMasterDirectiveClass:

1479 case Stmt::OMPParallelMaskedDirectiveClass:

1480 case Stmt::OMPParallelMasterTaskLoopDirectiveClass:

1481 case Stmt::OMPParallelMaskedTaskLoopDirectiveClass:

1482 case Stmt::OMPParallelMasterTaskLoopSimdDirectiveClass:

1483 case Stmt::OMPParallelMaskedTaskLoopSimdDirectiveClass:

1484 case Stmt::OMPParallelSectionsDirectiveClass:

1485 case Stmt::OMPSectionDirectiveClass:

1486 case Stmt::OMPSectionsDirectiveClass:

1487 case Stmt::OMPSimdDirectiveClass:

1488 case Stmt::OMPTileDirectiveClass:

1489 case Stmt::OMPUnrollDirectiveClass:

1490 case Stmt::OMPReverseDirectiveClass:

1491 case Stmt::OMPInterchangeDirectiveClass:

1492 case Stmt::OMPSingleDirectiveClass:

1493 case Stmt::OMPTargetDataDirectiveClass:

1494 case Stmt::OMPTargetDirectiveClass:

1495 case Stmt::OMPTargetEnterDataDirectiveClass:

1496 case Stmt::OMPTargetExitDataDirectiveClass:

1497 case Stmt::OMPTargetParallelDirectiveClass:

1498 case Stmt::OMPTargetParallelForDirectiveClass:

1499 case Stmt::OMPTargetParallelForSimdDirectiveClass:

1500 case Stmt::OMPTargetSimdDirectiveClass:

1501 case Stmt::OMPTargetTeamsDirectiveClass:

1502 case Stmt::OMPTargetTeamsDistributeDirectiveClass:

1503 case Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass:

1504 case Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass:

1505 case Stmt::OMPTargetTeamsDistributeSimdDirectiveClass:

1506 case Stmt::OMPTargetUpdateDirectiveClass:

1507 case Stmt::OMPScopeDirectiveClass:

1508 case Stmt::OMPTaskDirectiveClass:

1509 case Stmt::OMPTaskgroupDirectiveClass:

1510 case Stmt::OMPTaskLoopDirectiveClass:

1511 case Stmt::OMPTaskLoopSimdDirectiveClass:

1512 case Stmt::OMPTaskwaitDirectiveClass:

1513 case Stmt::OMPTaskyieldDirectiveClass:

1514 case Stmt::OMPErrorDirectiveClass:

1515 case Stmt::OMPTeamsDirectiveClass:

1516 case Stmt::OMPTeamsDistributeDirectiveClass:

1517 case Stmt::OMPTeamsDistributeParallelForDirectiveClass:

1518 case Stmt::OMPTeamsDistributeParallelForSimdDirectiveClass:

1519 case Stmt::OMPTeamsDistributeSimdDirectiveClass:

1520 case Stmt::OMPInteropDirectiveClass:

1521 case Stmt::OMPDispatchDirectiveClass:

1522 case Stmt::OMPMaskedDirectiveClass:

1523 case Stmt::OMPMetaDirectiveClass:

1524 case Stmt::OMPGenericLoopDirectiveClass:

1525 case Stmt::OMPTeamsGenericLoopDirectiveClass:

1526 case Stmt::OMPTargetTeamsGenericLoopDirectiveClass:

1527 case Stmt::OMPParallelGenericLoopDirectiveClass:

1528 case Stmt::OMPTargetParallelGenericLoopDirectiveClass:

1529 case Stmt::ReturnStmtClass:

1530 case Stmt::SEHExceptStmtClass:

1531 case Stmt::SEHFinallyStmtClass:

1532 case Stmt::SEHLeaveStmtClass:

1533 case Stmt::SEHTryStmtClass:

1534 case Stmt::SwitchStmtClass:

1535 case Stmt::WhileStmtClass:

1537

1538 case Stmt::DeclStmtClass: {

1540 for (const Decl *D : cast(S)->decls()) {

1541 if (auto *VD = dyn_cast(D))

1543

1544

1545 if (auto *TND = dyn_cast(D))

1546 if (TND->getUnderlyingType()->isVariablyModifiedType())

1548 if (auto *VD = dyn_cast(D))

1549 if (VD->getType()->isVariablyModifiedType())

1551 }

1552 return CT;

1553 }

1554

1555 case Stmt::IfStmtClass: {

1556 auto *IS = cast(S);

1558 if (const Stmt *Init = IS->getInit())

1560 if (const Stmt *CondDS = IS->getConditionVariableDeclStmt())

1563

1564

1565

1566 if (std::optional<const Stmt *> Case = IS->getNondiscardedCase(Context))

1568

1571 if (Then == Else)

1573

1574

1575

1578 }

1579

1580 case Stmt::CXXTryStmtClass: {

1581 auto *TS = cast(S);

1582

1583

1584 const CXXCatchStmt *FinalHandler = TS->getHandler(TS->getNumHandlers() - 1);

1588 }

1589

1590 case Stmt::ObjCAtThrowStmtClass:

1592

1593 case Stmt::ObjCAtTryStmtClass: {

1594 auto *TS = cast(S);

1595

1596

1597

1599 if (const Stmt *Finally = TS->getFinallyStmt())

1601 for (unsigned I = TS->getNumCatchStmts(); I != 0; --I) {

1604

1606 return CT;

1607 }

1608

1609

1611 }

1612

1613 case Stmt::SYCLUniqueStableNameExprClass:

1615 case Stmt::OpenACCAsteriskSizeExprClass:

1618 llvm_unreachable("Invalid class for statement");

1619 }

1620 llvm_unreachable("Bogus StmtClass");

1621}

1622

1623}

Defines the Diagnostic-related interfaces.

enum clang::sema::@1727::IndirectLocalPathEntry::EntryKind Kind

Defines the clang::Expr interface and subclasses for C++ expressions.

llvm::MachO::Target Target

Defines the SourceManager interface.

Defines the Objective-C statement AST node classes.

static QualType getPointeeType(const MemRegion *R)

Defines the clang::TypeLoc interface and its subclasses.

APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...

SourceManager & getSourceManager()

CanQualType getCanonicalType(QualType T) const

Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...

QualType getPointerType(QualType T) const

Return the uniqued reference to the type for a pointer to the specified type.

void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)

Change the exception specification on a function once it is delay-parsed, instantiated,...

bool hasSameUnqualifiedType(QualType T1, QualType T2) const

Determine whether the given types are equivalent after cvr-qualifiers have been removed.

QualType getArrayDecayedType(QualType T) const

Return the properly qualified result of decaying the specified array type to a pointer.

QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const

Return a normal function type with a typed argument list.

QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals) const

Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.

BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...

A boolean literal, per ([C++ lex.bool] Boolean literals).

CXXCatchStmt - This represents a C++ catch block.

Stmt * getHandlerBlock() const

VarDecl * getExceptionDecl() const

Represents a C++ destructor within a class.

bool isCalledByDelete(const FunctionDecl *OpDel=nullptr) const

Will this destructor ever be called when considering which deallocation function is associated with t...

A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).

Represents a static or instance method of a struct/union/class.

const CXXRecordDecl * getParent() const

Return the parent of this method declaration, which is the class in which this method is defined.

Represents a C++ struct/union/class.

A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...

bool isTypeOperand() const

Expr * getExprOperand() const

bool isPotentiallyEvaluated() const

Determine whether this typeid has a type operand which is potentially evaluated, per C++11 [expr....

bool hasNullCheck() const

Whether this is of a form like "typeid(*ptr)" that can throw a std::bad_typeid if a pointer is a null...

CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).

CanQual< T > getUnqualifiedType() const

Retrieve the unqualified form of this type.

CastKind getCastKind() const

static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)

DeclContext - This is used only as base class of specific decl types that can act as declaration cont...

Decl - This represents one declaration (or definition), e.g.

void setInvalidDecl(bool Invalid=true)

setInvalidDecl - Indicates the Decl had a semantic error.

SourceLocation getLocation() const

DeclContext * getLexicalDeclContext()

getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).

OverloadedOperatorKind getCXXOverloadedOperator() const

If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...

TypeSourceInfo * getTypeSourceInfo() const

Information about one declarator, including the parsed type information and the identifier.

QualType getTypeAsWritten() const

getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...

This represents one expression.

bool isValueDependent() const

Determines whether the value of this expression depends on.

bool isTypeDependent() const

Determines whether the type of this expression depends on.

bool containsUnexpandedParameterPack() const

Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates).

Expr * IgnoreParens() LLVM_READONLY

Skip past any parentheses which might surround this expression until reaching a fixed point.

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.

Represents a function declaration or definition.

unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const

Returns a value indicating whether this function corresponds to a builtin function.

bool hasCXXExplicitFunctionObjectParameter() const

bool isExternC() const

Determines whether this function is a function with external, C linkage.

bool isReplaceableGlobalAllocationFunction(std::optional< unsigned > *AlignmentParam=nullptr, bool *IsNothrow=nullptr) const

Determines whether this function is one of the replaceable global allocation functions: void *operato...

Represents a prototype with parameter type info, e.g.

bool hasDependentExceptionSpec() const

Return whether this function has a dependent exception spec.

ExceptionSpecificationType getExceptionSpecType() const

Get the kind of exception specification on this function.

unsigned getNumParams() const

QualType getParamType(unsigned i) const

unsigned getNumExceptions() const

Return the number of types in the exception specification.

bool hasExceptionSpec() const

Return whether this function has any kind of exception spec.

CanThrowResult canThrow() const

Determine whether this function type has a non-throwing exception specification.

Expr * getNoexceptExpr() const

Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...

ArrayRef< QualType > exceptions() const

exception_iterator exception_begin() const

FunctionDecl * getExceptionSpecDecl() const

If this function type has an exception specification which hasn't been determined yet (either because...

QualType getReturnType() const

One of these records is kept for each identifier that is lexed.

bool isStr(const char(&Str)[StrLen]) const

Return true if this is the identifier for the specified string.

A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...

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.

capture_init_iterator capture_init_begin()

Retrieve the first initialization argument for this lambda expression (which initializes the first ca...

A pointer to member type per C++ 8.3.3 - Pointers to members.

DeclarationName getDeclName() const

Get the actual, stored name of the declaration, which may be a special name.

Represents Objective-C's @catch statement.

unsigned getDiagID() const

PointerType - C99 6.7.5.1 - Pointer Declarators.

A (possibly-)qualified type.

bool isVolatileQualified() const

Determine whether this type is volatile-qualified.

bool isNull() const

Return true if this QualType doesn't point to a type yet.

bool isWebAssemblyReferenceType() const

Returns true if it is a WebAssembly Reference Type.

bool isConstQualified() const

Determine whether this type is const-qualified.

The collection of all-type qualifiers we support.

bool compatiblyIncludes(Qualifiers other, const ASTContext &Ctx) const

Determines if these qualifiers compatibly include another set.

A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...

redecl_range redecls() const

Returns an iterator range for all the redeclarations of the same decl.

Base for LValueReferenceType and RValueReferenceType.

QualType getPointeeType() const

SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)

Emit a diagnostic.

PartialDiagnostic PDiag(unsigned DiagID=0)

Build a partial diagnostic.

Sema - This implements semantic analysis and AST building for C.

bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)

CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.

void EvaluateImplicitExceptionSpec(SourceLocation Loc, FunctionDecl *FD)

Evaluate the implicit exception specification for a defaulted special member function.

void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)

bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)

IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...

ASTContext & getASTContext() const

SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks

All the function redeclarations seen during a class definition that had their exception spec checks d...

PrintingPolicy getPrintingPolicy() const

Retrieve a suitable printing policy for diagnostics.

ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)

bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Target, bool SkipTargetFirstParameter, SourceLocation TargetLoc, const FunctionProtoType *Source, bool SkipSourceFirstParameter, SourceLocation SourceLoc)

CheckParamExceptionSpec - Check if the parameter and return types of the two functions have equivalen...

SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)

Calls Lexer::getLocForEndOfToken()

const LangOptions & getLangOpts() const

const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)

ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr, ExceptionSpecificationType &EST)

Check the given noexcept-specifier, convert its expression, and compute the appropriate ExceptionSpec...

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.

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 isLibstdcxxEagerExceptionSpecHack(const Declarator &D)

Determine if we're in a case where we need to (incorrectly) eagerly parse an exception specification ...

bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const PartialDiagnostic &NoThrowDiagID, const FunctionProtoType *Superset, bool SkipSupersetFirstParameter, SourceLocation SuperLoc, const FunctionProtoType *Subset, bool SkipSubsetFirstParameter, SourceLocation SubLoc)

CheckExceptionSpecSubset - Check whether the second function type's exception specification is a subs...

DeclContext * CurContext

CurContext - This is the current declaration context of parsing.

CanThrowResult canThrow(const Stmt *E)

@ CCEK_Noexcept

Condition in a noexcept(bool) specifier.

bool handlerCanCatch(QualType HandlerType, QualType ExceptionType)

bool CheckDistantExceptionSpec(QualType T)

CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...

bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)

Ensure that the type T is a complete type.

bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)

bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)

CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec.

void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)

bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)

Determine whether the type Derived is a C++ class that is derived from the type Base.

bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)

bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)

Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...

ASTMutationListener * getASTMutationListener() const

static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D, SourceLocation Loc=SourceLocation())

Determine whether the callee of a particular function call can throw.

Encodes a location in the source.

bool isValid() const

Return true if this is a valid SourceLocation object.

bool isInSystemHeader(SourceLocation Loc) const

Returns if a SourceLocation is in a system header.

A trivial tuple used to represent a source range.

SourceLocation getBegin() const

Stmt - This represents one statement.

SourceRange getSourceRange() const LLVM_READONLY

SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...

void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const

Produce a unique representation of the given statement.

SourceLocation getBeginLoc() const LLVM_READONLY

bool isDependentType() const

Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...

bool isBeingDefined() const

Determines whether this type is in the process of being defined.

Base wrapper for a particular "section" of type source info.

T getAs() const

Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...

TypeLoc IgnoreParens() const

A container of type source information.

bool isSizelessType() const

As an extension, we classify types as one of "sized" or "sizeless"; every type is one or the other.

CXXRecordDecl * getAsCXXRecordDecl() const

Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...

bool isPointerType() const

const T * castAs() const

Member-template castAs.

bool isSpecificPlaceholderType(unsigned K) const

Test for a specific placeholder type.

bool isReferenceType() const

QualType getPointeeType() const

If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.

bool isDependentType() const

Whether this type is a dependent type, meaning that its definition somehow depends on a template para...

const Type * getBaseElementTypeUnsafe() const

Get the base element type of this type, potentially discarding type qualifiers.

bool isMemberPointerType() const

bool isObjectType() const

Determine whether this type is an object type.

bool isFunctionType() const

const T * getAs() const

Member-template getAs'.

bool isNullPtrType() const

bool isRecordType() const

Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...

void setType(QualType newType)

Represents a variable declaration or definition.

QualType::DestructionKind needsDestruction(const ASTContext &Ctx) const

Would the destruction of this variable have any effect, and if so, what kind?

const Expr * getInit() const

bool isUsableInConstantExpressions(const ASTContext &C) const

Determine whether this variable's value can be used in a constant expression, according to the releva...

The JSON file list parser is used to communicate input to InstallAPI.

OverloadedOperatorKind

Enumeration specifying the different kinds of C++ overloaded operators.

CanThrowResult

Possible results from evaluation of a noexcept expression.

static const FunctionProtoType * GetUnderlyingFunction(QualType T)

bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)

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.

bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)

static bool hasImplicitExceptionSpec(FunctionDecl *Decl)

Determine whether a function has an implicitly-generated exception specification.

@ Self

'self' clause, allowed on Compute and Combined Constructs, plus 'update'.

CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2)

@ Result

The result type of a method or function.

static CanThrowResult canVarDeclThrow(Sema &Self, const VarDecl *VD)

static CanThrowResult canDynamicCastThrow(const CXXDynamicCastExpr *DC)

static CanThrowResult canSubStmtsThrow(Sema &Self, const Stmt *S)

const FunctionProtoType * T

static CanThrowResult canTypeidThrow(Sema &S, const CXXTypeidExpr *DC)

static bool CheckSpecForTypesEquivalent(Sema &S, const PartialDiagnostic &DiagID, const PartialDiagnostic &NoteID, QualType Target, SourceLocation TargetLoc, QualType Source, SourceLocation SourceLoc)

@ Success

Template argument deduction was successful.

ExceptionSpecificationType

The various types of exception specifications that exist in C++11.

@ EST_DependentNoexcept

noexcept(expression), value-dependent

@ EST_Uninstantiated

not instantiated yet

@ EST_Unparsed

not parsed yet

@ EST_NoThrow

Microsoft __declspec(nothrow) extension.

@ EST_None

no exception specification

@ EST_MSAny

Microsoft throw(...) extension.

@ EST_BasicNoexcept

noexcept

@ EST_NoexceptFalse

noexcept(expression), evals to 'false'

@ EST_Unevaluated

not evaluated yet, for special member function

@ EST_NoexceptTrue

noexcept(expression), evals to 'true'

@ EST_Dynamic

throw(T1, T2)

static bool exceptionSpecNotKnownYet(const FunctionDecl *FD)

Holds information about the various types of exception specification.

ExceptionSpecificationType Type

The kind of exception specification this is.

ArrayRef< QualType > Exceptions

Explicitly-specified list of exception types.