1 // RUN: rm -f %t 2 // RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-temporary-dtors=true %s > %t 2>&1 3 // RUN: FileCheck --input-file=%t %s 4 // XPASS: * 5 6 class A { 7 public: 8 A() {} 9 ~A() {} 10 11 static A make() { return A(); } 12 13 operator bool() { return false; } 14 operator int() { return 0; } 15 }; 16 17 class B { 18 public: 19 B() {} 20 ~B() {} 21 22 operator bool() { return true; } 23 operator int() { return 1; } 24 operator A() { return A(); } 25 }; 26 27 void foo(int); 28 void foo(bool); 29 void foo(const A&); 30 31 void test_binary() { 32 int a = int(A()) + int(B()); 33 foo(int(A()) + int(B())); 34 int b; 35 } 36 37 void test_and() { 38 bool a = A() && B(); 39 foo(A() && B()); 40 int b; 41 } 42 43 void test_or() { 44 bool a = A() || B(); 45 foo(A() || B()); 46 int b; 47 } 48 49 void test_cond() { 50 A a = B() ? A() : A(B()); 51 if (B()) { foo(0); } else { foo(0); } 52 int b; 53 } 54 55 void test_cond_cref() { 56 const A& a = B() ? A() : A(B()); 57 foo(B() ? A() : A(B())); 58 int b; 59 } 60 61 void test_cond_implicit() { 62 A a = A() ?: A(); 63 int b; 64 } 65 66 void test_cond_implicit_cref() { 67 const A& a = A() ?: A(); 68 foo(A() ?: A()); 69 int b; 70 } 71 72 void test_copy_init() { 73 A a = A(); 74 int b; 75 } 76 77 void test_cref_init() { 78 const A& a = A(); 79 foo(A()); 80 int b; 81 } 82 83 void test_call_copy_init() { 84 A a = A::make(); 85 int b; 86 } 87 88 void test_call_cref_init() { 89 const A& a = A::make(); 90 foo(A::make()); 91 int b; 92 } 93 94 void test_assign() { 95 int a; 96 a = A(); 97 int b; 98 } 99 100 class TestCtorInits { 101 int a; 102 int b; 103 public: 104 TestCtorInits(); 105 }; 106 107 TestCtorInits::TestCtorInits() 108 : a(int(A()) + int(B())) 109 , b() {} 110 111 // CHECK: [B1 (ENTRY)] 112 // CHECK: Succs (1): B0 113 // CHECK: [B0 (EXIT)] 114 // CHECK: Preds (1): B1 115 // CHECK: [B1 (ENTRY)] 116 // CHECK: Succs (1): B0 117 // CHECK: [B0 (EXIT)] 118 // CHECK: Preds (1): B1 119 // CHECK: [B2 (ENTRY)] 120 // CHECK: Succs (1): B1 121 // CHECK: [B1] 122 // CHECK: 1: A() (CXXConstructExpr, class A) 123 // CHECK: 2: [B1.1] (BindTemporary) 124 // CHECK: 3: [B1.2] (ImplicitCastExpr, NoOp, const class A) 125 // CHECK: 4: [B1.3] 126 // CHECK: 5: [B1.4] (CXXConstructExpr, class A) 127 // CHECK: 6: ~A() (Temporary object destructor) 128 // CHECK: 7: return [B1.5]; 129 // CHECK: Preds (1): B2 130 // CHECK: Succs (1): B0 131 // CHECK: [B0 (EXIT)] 132 // CHECK: Preds (1): B1 133 // CHECK: [B2 (ENTRY)] 134 // CHECK: Succs (1): B1 135 // CHECK: [B1] 136 // CHECK: 1: false 137 // CHECK: 2: return [B1.1]; 138 // CHECK: Preds (1): B2 139 // CHECK: Succs (1): B0 140 // CHECK: [B0 (EXIT)] 141 // CHECK: Preds (1): B1 142 // CHECK: [B2 (ENTRY)] 143 // CHECK: Succs (1): B1 144 // CHECK: [B1] 145 // CHECK: 1: 0 146 // CHECK: 2: return [B1.1]; 147 // CHECK: Preds (1): B2 148 // CHECK: Succs (1): B0 149 // CHECK: [B0 (EXIT)] 150 // CHECK: Preds (1): B1 151 // CHECK: [B1 (ENTRY)] 152 // CHECK: Succs (1): B0 153 // CHECK: [B0 (EXIT)] 154 // CHECK: Preds (1): B1 155 // CHECK: [B1 (ENTRY)] 156 // CHECK: Succs (1): B0 157 // CHECK: [B0 (EXIT)] 158 // CHECK: Preds (1): B1 159 // CHECK: [B2 (ENTRY)] 160 // CHECK: Succs (1): B1 161 // CHECK: [B1] 162 // CHECK: 1: true 163 // CHECK: 2: return [B1.1]; 164 // CHECK: Preds (1): B2 165 // CHECK: Succs (1): B0 166 // CHECK: [B0 (EXIT)] 167 // CHECK: Preds (1): B1 168 // CHECK: [B2 (ENTRY)] 169 // CHECK: Succs (1): B1 170 // CHECK: [B1] 171 // CHECK: 1: 1 172 // CHECK: 2: return [B1.1]; 173 // CHECK: Preds (1): B2 174 // CHECK: Succs (1): B0 175 // CHECK: [B0 (EXIT)] 176 // CHECK: Preds (1): B1 177 // CHECK: [B2 (ENTRY)] 178 // CHECK: Succs (1): B1 179 // CHECK: [B1] 180 // CHECK: 1: A() (CXXConstructExpr, class A) 181 // CHECK: 2: [B1.1] (BindTemporary) 182 // CHECK: 3: [B1.2] (ImplicitCastExpr, NoOp, const class A) 183 // CHECK: 4: [B1.3] 184 // CHECK: 5: [B1.4] (CXXConstructExpr, class A) 185 // CHECK: 6: ~A() (Temporary object destructor) 186 // CHECK: 7: return [B1.5]; 187 // CHECK: Preds (1): B2 188 // CHECK: Succs (1): B0 189 // CHECK: [B0 (EXIT)] 190 // CHECK: Preds (1): B1 191 // CHECK: [B2 (ENTRY)] 192 // CHECK: Succs (1): B1 193 // CHECK: [B1] 194 // CHECK: 1: A() (CXXConstructExpr, class A) 195 // CHECK: 2: [B1.1] (BindTemporary) 196 // CHECK: 3: [B1.2].operator int 197 // CHECK: 4: [B1.3]() 198 // CHECK: 5: [B1.4] (ImplicitCastExpr, UserDefinedConversion, int) 199 // CHECK: 6: int([B1.5]) (CXXFunctionalCastExpr, NoOp, int) 200 // CHECK: 7: B() (CXXConstructExpr, class B) 201 // CHECK: 8: [B1.7] (BindTemporary) 202 // CHECK: 9: [B1.8].operator int 203 // CHECK: 10: [B1.9]() 204 // CHECK: 11: [B1.10] (ImplicitCastExpr, UserDefinedConversion, int) 205 // CHECK: 12: int([B1.11]) (CXXFunctionalCastExpr, NoOp, int) 206 // CHECK: 13: [B1.6] + [B1.12] 207 // CHECK: 14: int a = int(A().operator int()) + int(B().operator int()); 208 // CHECK: 15: ~B() (Temporary object destructor) 209 // CHECK: 16: ~A() (Temporary object destructor) 210 // CHECK: 17: foo 211 // CHECK: 18: [B1.17] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(int)) 212 // CHECK: 19: A() (CXXConstructExpr, class A) 213 // CHECK: 20: [B1.19] (BindTemporary) 214 // CHECK: 21: [B1.20].operator int 215 // CHECK: 22: [B1.21]() 216 // CHECK: 23: [B1.22] (ImplicitCastExpr, UserDefinedConversion, int) 217 // CHECK: 24: int([B1.23]) (CXXFunctionalCastExpr, NoOp, int) 218 // CHECK: 25: B() (CXXConstructExpr, class B) 219 // CHECK: 26: [B1.25] (BindTemporary) 220 // CHECK: 27: [B1.26].operator int 221 // CHECK: 28: [B1.27]() 222 // CHECK: 29: [B1.28] (ImplicitCastExpr, UserDefinedConversion, int) 223 // CHECK: 30: int([B1.29]) (CXXFunctionalCastExpr, NoOp, int) 224 // CHECK: 31: [B1.24] + [B1.30] 225 // CHECK: 32: [B1.18]([B1.31]) 226 // CHECK: 33: ~B() (Temporary object destructor) 227 // CHECK: 34: ~A() (Temporary object destructor) 228 // CHECK: 35: int b; 229 // CHECK: Preds (1): B2 230 // CHECK: Succs (1): B0 231 // CHECK: [B0 (EXIT)] 232 // CHECK: Preds (1): B1 233 // CHECK: [B10 (ENTRY)] 234 // CHECK: Succs (1): B9 235 // CHECK: [B1] 236 // CHECK: 1: ~A() (Temporary object destructor) 237 // CHECK: 2: int b; 238 // CHECK: Preds (2): B2 B3 239 // CHECK: Succs (1): B0 240 // CHECK: [B2] 241 // CHECK: 1: ~B() (Temporary object destructor) 242 // CHECK: Preds (1): B3 243 // CHECK: Succs (1): B1 244 // CHECK: [B3] 245 // CHECK: 1: [B5.8] && [B4.5] 246 // CHECK: 2: [B5.3]([B3.1]) 247 // CHECK: T: [B5.8] && ... 248 // CHECK: Preds (2): B4 B5 249 // CHECK: Succs (2): B2 B1 250 // CHECK: [B4] 251 // CHECK: 1: B() (CXXConstructExpr, class B) 252 // CHECK: 2: [B4.1] (BindTemporary) 253 // CHECK: 3: [B4.2].operator _Bool 254 // CHECK: 4: [B4.3]() 255 // CHECK: 5: [B4.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) 256 // CHECK: Preds (1): B5 257 // CHECK: Succs (1): B3 258 // CHECK: [B5] 259 // CHECK: 1: ~A() (Temporary object destructor) 260 // CHECK: 2: foo 261 // CHECK: 3: [B5.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(_Bool)) 262 // CHECK: 4: A() (CXXConstructExpr, class A) 263 // CHECK: 5: [B5.4] (BindTemporary) 264 // CHECK: 6: [B5.5].operator _Bool 265 // CHECK: 7: [B5.6]() 266 // CHECK: 8: [B5.7] (ImplicitCastExpr, UserDefinedConversion, _Bool) 267 // CHECK: T: [B5.8] && ... 268 // CHECK: Preds (2): B6 B7 269 // CHECK: Succs (2): B4 B3 270 // CHECK: [B6] 271 // CHECK: 1: ~B() (Temporary object destructor) 272 // CHECK: Preds (1): B7 273 // CHECK: Succs (1): B5 274 // CHECK: [B7] 275 // CHECK: 1: [B9.5] && [B8.5] 276 // CHECK: 2: bool a = A().operator _Bool() && B().operator _Bool(); 277 // CHECK: T: [B9.5] && ... 278 // CHECK: Preds (2): B8 B9 279 // CHECK: Succs (2): B6 B5 280 // CHECK: [B8] 281 // CHECK: 1: B() (CXXConstructExpr, class B) 282 // CHECK: 2: [B8.1] (BindTemporary) 283 // CHECK: 3: [B8.2].operator _Bool 284 // CHECK: 4: [B8.3]() 285 // CHECK: 5: [B8.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) 286 // CHECK: Preds (1): B9 287 // CHECK: Succs (1): B7 288 // CHECK: [B9] 289 // CHECK: 1: A() (CXXConstructExpr, class A) 290 // CHECK: 2: [B9.1] (BindTemporary) 291 // CHECK: 3: [B9.2].operator _Bool 292 // CHECK: 4: [B9.3]() 293 // CHECK: 5: [B9.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) 294 // CHECK: T: [B9.5] && ... 295 // CHECK: Preds (1): B10 296 // CHECK: Succs (2): B8 B7 297 // CHECK: [B0 (EXIT)] 298 // CHECK: Preds (1): B1 299 // CHECK: [B10 (ENTRY)] 300 // CHECK: Succs (1): B9 301 // CHECK: [B1] 302 // CHECK: 1: ~A() (Temporary object destructor) 303 // CHECK: 2: int b; 304 // CHECK: Preds (2): B2 B3 305 // CHECK: Succs (1): B0 306 // CHECK: [B2] 307 // CHECK: 1: ~B() (Temporary object destructor) 308 // CHECK: Preds (1): B3 309 // CHECK: Succs (1): B1 310 // CHECK: [B3] 311 // CHECK: 1: [B5.8] || [B4.5] 312 // CHECK: 2: [B5.3]([B3.1]) 313 // CHECK: T: [B5.8] || ... 314 // CHECK: Preds (2): B4 B5 315 // CHECK: Succs (2): B1 B2 316 // CHECK: [B4] 317 // CHECK: 1: B() (CXXConstructExpr, class B) 318 // CHECK: 2: [B4.1] (BindTemporary) 319 // CHECK: 3: [B4.2].operator _Bool 320 // CHECK: 4: [B4.3]() 321 // CHECK: 5: [B4.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) 322 // CHECK: Preds (1): B5 323 // CHECK: Succs (1): B3 324 // CHECK: [B5] 325 // CHECK: 1: ~A() (Temporary object destructor) 326 // CHECK: 2: foo 327 // CHECK: 3: [B5.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(_Bool)) 328 // CHECK: 4: A() (CXXConstructExpr, class A) 329 // CHECK: 5: [B5.4] (BindTemporary) 330 // CHECK: 6: [B5.5].operator _Bool 331 // CHECK: 7: [B5.6]() 332 // CHECK: 8: [B5.7] (ImplicitCastExpr, UserDefinedConversion, _Bool) 333 // CHECK: T: [B5.8] || ... 334 // CHECK: Preds (2): B6 B7 335 // CHECK: Succs (2): B3 B4 336 // CHECK: [B6] 337 // CHECK: 1: ~B() (Temporary object destructor) 338 // CHECK: Preds (1): B7 339 // CHECK: Succs (1): B5 340 // CHECK: [B7] 341 // CHECK: 1: [B9.5] || [B8.5] 342 // CHECK: 2: bool a = A().operator _Bool() || B().operator _Bool(); 343 // CHECK: T: [B9.5] || ... 344 // CHECK: Preds (2): B8 B9 345 // CHECK: Succs (2): B5 B6 346 // CHECK: [B8] 347 // CHECK: 1: B() (CXXConstructExpr, class B) 348 // CHECK: 2: [B8.1] (BindTemporary) 349 // CHECK: 3: [B8.2].operator _Bool 350 // CHECK: 4: [B8.3]() 351 // CHECK: 5: [B8.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) 352 // CHECK: Preds (1): B9 353 // CHECK: Succs (1): B7 354 // CHECK: [B9] 355 // CHECK: 1: A() (CXXConstructExpr, class A) 356 // CHECK: 2: [B9.1] (BindTemporary) 357 // CHECK: 3: [B9.2].operator _Bool 358 // CHECK: 4: [B9.3]() 359 // CHECK: 5: [B9.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) 360 // CHECK: T: [B9.5] || ... 361 // CHECK: Preds (1): B10 362 // CHECK: Succs (2): B7 B8 363 // CHECK: [B0 (EXIT)] 364 // CHECK: Preds (1): B1 365 // CHECK: [B11 (ENTRY)] 366 // CHECK: Succs (1): B10 367 // CHECK: [B1] 368 // CHECK: 1: int b; 369 // CHECK: 2: [B7.5].~A() (Implicit destructor) 370 // CHECK: Preds (2): B2 B3 371 // CHECK: Succs (1): B0 372 // CHECK: [B2] 373 // CHECK: 1: foo 374 // CHECK: 2: [B2.1] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(int)) 375 // CHECK: 3: 0 376 // CHECK: 4: [B2.2]([B2.3]) 377 // CHECK: Preds (1): B4 378 // CHECK: Succs (1): B1 379 // CHECK: [B3] 380 // CHECK: 1: foo 381 // CHECK: 2: [B3.1] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(int)) 382 // CHECK: 3: 0 383 // CHECK: 4: [B3.2]([B3.3]) 384 // CHECK: Preds (1): B4 385 // CHECK: Succs (1): B1 386 // CHECK: [B4] 387 // CHECK: 1: ~B() (Temporary object destructor) 388 // CHECK: 2: B() (CXXConstructExpr, class B) 389 // CHECK: 3: [B4.2] (BindTemporary) 390 // CHECK: 4: [B4.3].operator _Bool 391 // CHECK: 5: [B4.4]() 392 // CHECK: 6: [B4.5] (ImplicitCastExpr, UserDefinedConversion, _Bool) 393 // CHECK: 7: ~B() (Temporary object destructor) 394 // CHECK: T: if [B4.6] 395 // CHECK: Preds (2): B5 B6 396 // CHECK: Succs (2): B3 B2 397 // CHECK: [B5] 398 // CHECK: 1: ~A() (Temporary object destructor) 399 // CHECK: 2: ~A() (Temporary object destructor) 400 // CHECK: Preds (1): B7 401 // CHECK: Succs (1): B4 402 // CHECK: [B6] 403 // CHECK: 1: ~A() (Temporary object destructor) 404 // CHECK: 2: ~A() (Temporary object destructor) 405 // CHECK: 3: ~A() (Temporary object destructor) 406 // CHECK: 4: ~B() (Temporary object destructor) 407 // CHECK: Preds (1): B7 408 // CHECK: Succs (1): B4 409 // CHECK: [B7] 410 // CHECK: 1: [B10.5] ? [B8.6] : [B9.15] 411 // CHECK: 2: [B7.1] (ImplicitCastExpr, NoOp, const class A) 412 // CHECK: 3: [B7.2] 413 // CHECK: 4: [B7.3] (CXXConstructExpr, class A) 414 // CHECK: 5: A a = B().operator _Bool() ? A() : A(B().operator A()); 415 // CHECK: T: [B10.5] ? ... : ... 416 // CHECK: Preds (2): B8 B9 417 // CHECK: Succs (2): B5 B6 418 // CHECK: [B8] 419 // CHECK: 1: A() (CXXConstructExpr, class A) 420 // CHECK: 2: [B8.1] (BindTemporary) 421 // CHECK: 3: [B8.2] (ImplicitCastExpr, NoOp, const class A) 422 // CHECK: 4: [B8.3] 423 // CHECK: 5: [B8.4] (CXXConstructExpr, class A) 424 // CHECK: 6: [B8.5] (BindTemporary) 425 // CHECK: Preds (1): B10 426 // CHECK: Succs (1): B7 427 // CHECK: [B9] 428 // CHECK: 1: B() (CXXConstructExpr, class B) 429 // CHECK: 2: [B9.1] (BindTemporary) 430 // CHECK: 3: [B9.2].operator A 431 // CHECK: 4: [B9.3]() 432 // CHECK: 5: [B9.4] (ImplicitCastExpr, UserDefinedConversion, class A) 433 // CHECK: 6: [B9.5] (BindTemporary) 434 // CHECK: 7: [B9.6] (ImplicitCastExpr, NoOp, const class A) 435 // CHECK: 8: [B9.7] 436 // CHECK: 9: [B9.8] (CXXConstructExpr, class A) 437 // CHECK: 10: [B9.9] (BindTemporary) 438 // CHECK: 11: A([B9.10]) (CXXFunctionalCastExpr, ConstructorConversion, class A) 439 // CHECK: 12: [B9.11] (ImplicitCastExpr, NoOp, const class A) 440 // CHECK: 13: [B9.12] 441 // CHECK: 14: [B9.13] (CXXConstructExpr, class A) 442 // CHECK: 15: [B9.14] (BindTemporary) 443 // CHECK: Preds (1): B10 444 // CHECK: Succs (1): B7 445 // CHECK: [B10] 446 // CHECK: 1: B() (CXXConstructExpr, class B) 447 // CHECK: 2: [B10.1] (BindTemporary) 448 // CHECK: 3: [B10.2].operator _Bool 449 // CHECK: 4: [B10.3]() 450 // CHECK: 5: [B10.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) 451 // CHECK: T: [B10.5] ? ... : ... 452 // CHECK: Preds (1): B11 453 // CHECK: Succs (2): B8 B9 454 // CHECK: [B0 (EXIT)] 455 // CHECK: Preds (1): B1 456 // CHECK: [B14 (ENTRY)] 457 // CHECK: Succs (1): B13 458 // CHECK: [B1] 459 // CHECK: 1: ~B() (Temporary object destructor) 460 // CHECK: 2: int b; 461 // CHECK: 3: [B10.4].~A() (Implicit destructor) 462 // CHECK: Preds (2): B2 B3 463 // CHECK: Succs (1): B0 464 // CHECK: [B2] 465 // CHECK: 1: ~A() (Temporary object destructor) 466 // CHECK: 2: ~A() (Temporary object destructor) 467 // CHECK: Preds (1): B4 468 // CHECK: Succs (1): B1 469 // CHECK: [B3] 470 // CHECK: 1: ~A() (Temporary object destructor) 471 // CHECK: 2: ~A() (Temporary object destructor) 472 // CHECK: 3: ~A() (Temporary object destructor) 473 // CHECK: 4: ~B() (Temporary object destructor) 474 // CHECK: Preds (1): B4 475 // CHECK: Succs (1): B1 476 // CHECK: [B4] 477 // CHECK: 1: [B7.8] ? [B5.6] : [B6.15] 478 // CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A) 479 // CHECK: 3: [B4.2] 480 // CHECK: 4: [B7.3]([B4.3]) 481 // CHECK: T: [B7.8] ? ... : ... 482 // CHECK: Preds (2): B5 B6 483 // CHECK: Succs (2): B2 B3 484 // CHECK: [B5] 485 // CHECK: 1: A() (CXXConstructExpr, class A) 486 // CHECK: 2: [B5.1] (BindTemporary) 487 // CHECK: 3: [B5.2] (ImplicitCastExpr, NoOp, const class A) 488 // CHECK: 4: [B5.3] 489 // CHECK: 5: [B5.4] (CXXConstructExpr, class A) 490 // CHECK: 6: [B5.5] (BindTemporary) 491 // CHECK: Preds (1): B7 492 // CHECK: Succs (1): B4 493 // CHECK: [B6] 494 // CHECK: 1: B() (CXXConstructExpr, class B) 495 // CHECK: 2: [B6.1] (BindTemporary) 496 // CHECK: 3: [B6.2].operator A 497 // CHECK: 4: [B6.3]() 498 // CHECK: 5: [B6.4] (ImplicitCastExpr, UserDefinedConversion, class A) 499 // CHECK: 6: [B6.5] (BindTemporary) 500 // CHECK: 7: [B6.6] (ImplicitCastExpr, NoOp, const class A) 501 // CHECK: 8: [B6.7] 502 // CHECK: 9: [B6.8] (CXXConstructExpr, class A) 503 // CHECK: 10: [B6.9] (BindTemporary) 504 // CHECK: 11: A([B6.10]) (CXXFunctionalCastExpr, ConstructorConversion, class A) 505 // CHECK: 12: [B6.11] (ImplicitCastExpr, NoOp, const class A) 506 // CHECK: 13: [B6.12] 507 // CHECK: 14: [B6.13] (CXXConstructExpr, class A) 508 // CHECK: 15: [B6.14] (BindTemporary) 509 // CHECK: Preds (1): B7 510 // CHECK: Succs (1): B4 511 // CHECK: [B7] 512 // CHECK: 1: ~B() (Temporary object destructor) 513 // CHECK: 2: foo 514 // CHECK: 3: [B7.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &)) 515 // CHECK: 4: B() (CXXConstructExpr, class B) 516 // CHECK: 5: [B7.4] (BindTemporary) 517 // CHECK: 6: [B7.5].operator _Bool 518 // CHECK: 7: [B7.6]() 519 // CHECK: 8: [B7.7] (ImplicitCastExpr, UserDefinedConversion, _Bool) 520 // CHECK: T: [B7.8] ? ... : ... 521 // CHECK: Preds (2): B8 B9 522 // CHECK: Succs (2): B5 B6 523 // CHECK: [B8] 524 // CHECK: 1: ~A() (Temporary object destructor) 525 // CHECK: Preds (1): B10 526 // CHECK: Succs (1): B7 527 // CHECK: [B9] 528 // CHECK: 1: ~A() (Temporary object destructor) 529 // CHECK: 2: ~A() (Temporary object destructor) 530 // CHECK: 3: ~B() (Temporary object destructor) 531 // CHECK: Preds (1): B10 532 // CHECK: Succs (1): B7 533 // CHECK: [B10] 534 // CHECK: 1: [B13.5] ? [B11.6] : [B12.15] 535 // CHECK: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A) 536 // CHECK: 3: [B10.2] 537 // CHECK: 4: const A &a = B().operator _Bool() ? A() : A(B().operator A()); 538 // CHECK: T: [B13.5] ? ... : ... 539 // CHECK: Preds (2): B11 B12 540 // CHECK: Succs (2): B8 B9 541 // CHECK: [B11] 542 // CHECK: 1: A() (CXXConstructExpr, class A) 543 // CHECK: 2: [B11.1] (BindTemporary) 544 // CHECK: 3: [B11.2] (ImplicitCastExpr, NoOp, const class A) 545 // CHECK: 4: [B11.3] 546 // CHECK: 5: [B11.4] (CXXConstructExpr, class A) 547 // CHECK: 6: [B11.5] (BindTemporary) 548 // CHECK: Preds (1): B13 549 // CHECK: Succs (1): B10 550 // CHECK: [B12] 551 // CHECK: 1: B() (CXXConstructExpr, class B) 552 // CHECK: 2: [B12.1] (BindTemporary) 553 // CHECK: 3: [B12.2].operator A 554 // CHECK: 4: [B12.3]() 555 // CHECK: 5: [B12.4] (ImplicitCastExpr, UserDefinedConversion, class A) 556 // CHECK: 6: [B12.5] (BindTemporary) 557 // CHECK: 7: [B12.6] (ImplicitCastExpr, NoOp, const class A) 558 // CHECK: 8: [B12.7] 559 // CHECK: 9: [B12.8] (CXXConstructExpr, class A) 560 // CHECK: 10: [B12.9] (BindTemporary) 561 // CHECK: 11: A([B12.10]) (CXXFunctionalCastExpr, ConstructorConversion, class A) 562 // CHECK: 12: [B12.11] (ImplicitCastExpr, NoOp, const class A) 563 // CHECK: 13: [B12.12] 564 // CHECK: 14: [B12.13] (CXXConstructExpr, class A) 565 // CHECK: 15: [B12.14] (BindTemporary) 566 // CHECK: Preds (1): B13 567 // CHECK: Succs (1): B10 568 // CHECK: [B13] 569 // CHECK: 1: B() (CXXConstructExpr, class B) 570 // CHECK: 2: [B13.1] (BindTemporary) 571 // CHECK: 3: [B13.2].operator _Bool 572 // CHECK: 4: [B13.3]() 573 // CHECK: 5: [B13.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) 574 // CHECK: T: [B13.5] ? ... : ... 575 // CHECK: Preds (1): B14 576 // CHECK: Succs (2): B11 B12 577 // CHECK: [B0 (EXIT)] 578 // CHECK: Preds (1): B1 579 // CHECK: [B8 (ENTRY)] 580 // CHECK: Succs (1): B7 581 // CHECK: [B1] 582 // CHECK: 1: ~A() (Temporary object destructor) 583 // CHECK: 2: int b; 584 // CHECK: 3: [B4.5].~A() (Implicit destructor) 585 // CHECK: Preds (2): B2 B3 586 // CHECK: Succs (1): B0 587 // CHECK: [B2] 588 // CHECK: 1: ~A() (Temporary object destructor) 589 // CHECK: Preds (1): B4 590 // CHECK: Succs (1): B1 591 // CHECK: [B3] 592 // CHECK: 1: ~A() (Temporary object destructor) 593 // CHECK: 2: ~A() (Temporary object destructor) 594 // CHECK: Preds (1): B4 595 // CHECK: Succs (1): B1 596 // CHECK: [B4] 597 // CHECK: 1: [B7.2] ?: [B6.6] 598 // CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A) 599 // CHECK: 3: [B4.2] 600 // CHECK: 4: [B4.3] (CXXConstructExpr, class A) 601 // CHECK: 5: A a = A() ?: A(); 602 // CHECK: T: [B7.5] ? ... : ... 603 // CHECK: Preds (2): B5 B6 604 // CHECK: Succs (2): B2 B3 605 // CHECK: [B5] 606 // CHECK: 1: [B7.2] (ImplicitCastExpr, NoOp, const class A) 607 // CHECK: 2: [B5.1] 608 // CHECK: 3: [B5.2] (CXXConstructExpr, class A) 609 // CHECK: 4: [B5.3] (BindTemporary) 610 // CHECK: Preds (1): B7 611 // CHECK: Succs (1): B4 612 // CHECK: [B6] 613 // CHECK: 1: A() (CXXConstructExpr, class A) 614 // CHECK: 2: [B6.1] (BindTemporary) 615 // CHECK: 3: [B6.2] (ImplicitCastExpr, NoOp, const class A) 616 // CHECK: 4: [B6.3] 617 // CHECK: 5: [B6.4] (CXXConstructExpr, class A) 618 // CHECK: 6: [B6.5] (BindTemporary) 619 // CHECK: Preds (1): B7 620 // CHECK: Succs (1): B4 621 // CHECK: [B7] 622 // CHECK: 1: A() (CXXConstructExpr, class A) 623 // CHECK: 2: [B7.1] (BindTemporary) 624 // CHECK: 3: [B7.2].operator _Bool 625 // CHECK: 4: [B7.3]() 626 // CHECK: 5: [B7.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) 627 // CHECK: T: [B7.5] ? ... : ... 628 // CHECK: Preds (1): B8 629 // CHECK: Succs (2): B5 B6 630 // CHECK: [B0 (EXIT)] 631 // CHECK: Preds (1): B1 632 // CHECK: [B13 (ENTRY)] 633 // CHECK: Succs (1): B12 634 // CHECK: [B1] 635 // CHECK: 1: ~A() (Temporary object destructor) 636 // CHECK: 2: int b; 637 // CHECK: 3: [B9.4].~A() (Implicit destructor) 638 // CHECK: Preds (2): B2 B3 639 // CHECK: Succs (1): B0 640 // CHECK: [B2] 641 // CHECK: 1: ~A() (Temporary object destructor) 642 // CHECK: Preds (1): B4 643 // CHECK: Succs (1): B1 644 // CHECK: [B3] 645 // CHECK: 1: ~A() (Temporary object destructor) 646 // CHECK: 2: ~A() (Temporary object destructor) 647 // CHECK: Preds (1): B4 648 // CHECK: Succs (1): B1 649 // CHECK: [B4] 650 // CHECK: 1: [B7.5] ?: [B6.6] 651 // CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A) 652 // CHECK: 3: [B4.2] 653 // CHECK: 4: [B7.3]([B4.3]) 654 // CHECK: T: [B7.8] ? ... : ... 655 // CHECK: Preds (2): B5 B6 656 // CHECK: Succs (2): B2 B3 657 // CHECK: [B5] 658 // CHECK: 1: [B7.5] (ImplicitCastExpr, NoOp, const class A) 659 // CHECK: 2: [B5.1] 660 // CHECK: 3: [B5.2] (CXXConstructExpr, class A) 661 // CHECK: 4: [B5.3] (BindTemporary) 662 // CHECK: Preds (1): B7 663 // CHECK: Succs (1): B4 664 // CHECK: [B6] 665 // CHECK: 1: A() (CXXConstructExpr, class A) 666 // CHECK: 2: [B6.1] (BindTemporary) 667 // CHECK: 3: [B6.2] (ImplicitCastExpr, NoOp, const class A) 668 // CHECK: 4: [B6.3] 669 // CHECK: 5: [B6.4] (CXXConstructExpr, class A) 670 // CHECK: 6: [B6.5] (BindTemporary) 671 // CHECK: Preds (1): B7 672 // CHECK: Succs (1): B4 673 // CHECK: [B7] 674 // CHECK: 1: ~A() (Temporary object destructor) 675 // CHECK: 2: foo 676 // CHECK: 3: [B7.2] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &)) 677 // CHECK: 4: A() (CXXConstructExpr, class A) 678 // CHECK: 5: [B7.4] (BindTemporary) 679 // CHECK: 6: [B7.5].operator _Bool 680 // CHECK: 7: [B7.6]() 681 // CHECK: 8: [B7.7] (ImplicitCastExpr, UserDefinedConversion, _Bool) 682 // CHECK: T: [B7.8] ? ... : ... 683 // CHECK: Preds (2): B9 B8 684 // CHECK: Succs (2): B5 B6 685 // CHECK: [B8] 686 // CHECK: 1: ~A() (Temporary object destructor) 687 // CHECK: Preds (1): B9 688 // CHECK: Succs (1): B7 689 // CHECK: [B9] 690 // CHECK: 1: [B12.2] ?: [B11.6] 691 // CHECK: 2: [B9.1] (ImplicitCastExpr, NoOp, const class A) 692 // CHECK: 3: [B9.2] 693 // CHECK: 4: const A &a = A() ?: A(); 694 // CHECK: T: [B12.5] ? ... : ... 695 // CHECK: Preds (2): B10 B11 696 // CHECK: Succs (2): B7 B8 697 // CHECK: [B10] 698 // CHECK: 1: [B12.2] (ImplicitCastExpr, NoOp, const class A) 699 // CHECK: 2: [B10.1] 700 // CHECK: 3: [B10.2] (CXXConstructExpr, class A) 701 // CHECK: 4: [B10.3] (BindTemporary) 702 // CHECK: Preds (1): B12 703 // CHECK: Succs (1): B9 704 // CHECK: [B11] 705 // CHECK: 1: A() (CXXConstructExpr, class A) 706 // CHECK: 2: [B11.1] (BindTemporary) 707 // CHECK: 3: [B11.2] (ImplicitCastExpr, NoOp, const class A) 708 // CHECK: 4: [B11.3] 709 // CHECK: 5: [B11.4] (CXXConstructExpr, class A) 710 // CHECK: 6: [B11.5] (BindTemporary) 711 // CHECK: Preds (1): B12 712 // CHECK: Succs (1): B9 713 // CHECK: [B12] 714 // CHECK: 1: A() (CXXConstructExpr, class A) 715 // CHECK: 2: [B12.1] (BindTemporary) 716 // CHECK: 3: [B12.2].operator _Bool 717 // CHECK: 4: [B12.3]() 718 // CHECK: 5: [B12.4] (ImplicitCastExpr, UserDefinedConversion, _Bool) 719 // CHECK: T: [B12.5] ? ... : ... 720 // CHECK: Preds (1): B13 721 // CHECK: Succs (2): B10 B11 722 // CHECK: [B0 (EXIT)] 723 // CHECK: Preds (1): B1 724 // CHECK: [B2 (ENTRY)] 725 // CHECK: Succs (1): B1 726 // CHECK: [B1] 727 // CHECK: 1: A() (CXXConstructExpr, class A) 728 // CHECK: 2: [B1.1] (BindTemporary) 729 // CHECK: 3: [B1.2] (ImplicitCastExpr, NoOp, const class A) 730 // CHECK: 4: [B1.3] 731 // CHECK: 5: [B1.4] (CXXConstructExpr, class A) 732 // CHECK: 6: A a = A(); 733 // CHECK: 7: ~A() (Temporary object destructor) 734 // CHECK: 8: int b; 735 // CHECK: 9: [B1.6].~A() (Implicit destructor) 736 // CHECK: Preds (1): B2 737 // CHECK: Succs (1): B0 738 // CHECK: [B0 (EXIT)] 739 // CHECK: Preds (1): B1 740 // CHECK: [B2 (ENTRY)] 741 // CHECK: Succs (1): B1 742 // CHECK: [B1] 743 // CHECK: 1: A() (CXXConstructExpr, class A) 744 // CHECK: 2: [B1.1] (BindTemporary) 745 // CHECK: 3: [B1.2] (ImplicitCastExpr, NoOp, const class A) 746 // CHECK: 4: [B1.3] 747 // CHECK: 5: const A &a = A(); 748 // CHECK: 6: foo 749 // CHECK: 7: [B1.6] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &)) 750 // CHECK: 8: A() (CXXConstructExpr, class A) 751 // CHECK: 9: [B1.8] (BindTemporary) 752 // CHECK: 10: [B1.9] (ImplicitCastExpr, NoOp, const class A) 753 // CHECK: 11: [B1.10] 754 // CHECK: 12: [B1.7]([B1.11]) 755 // CHECK: 13: ~A() (Temporary object destructor) 756 // CHECK: 14: int b; 757 // CHECK: 15: [B1.5].~A() (Implicit destructor) 758 // CHECK: Preds (1): B2 759 // CHECK: Succs (1): B0 760 // CHECK: [B0 (EXIT)] 761 // CHECK: Preds (1): B1 762 // CHECK: [B2 (ENTRY)] 763 // CHECK: Succs (1): B1 764 // CHECK: [B1] 765 // CHECK: 1: A::make 766 // CHECK: 2: [B1.1] (ImplicitCastExpr, FunctionToPointerDecay, class A (*)(void)) 767 // CHECK: 3: [B1.2]() 768 // CHECK: 4: [B1.3] (BindTemporary) 769 // CHECK: 5: [B1.4] (ImplicitCastExpr, NoOp, const class A) 770 // CHECK: 6: [B1.5] 771 // CHECK: 7: [B1.6] (CXXConstructExpr, class A) 772 // CHECK: 8: A a = A::make(); 773 // CHECK: 9: ~A() (Temporary object destructor) 774 // CHECK: 10: int b; 775 // CHECK: 11: [B1.8].~A() (Implicit destructor) 776 // CHECK: Preds (1): B2 777 // CHECK: Succs (1): B0 778 // CHECK: [B0 (EXIT)] 779 // CHECK: Preds (1): B1 780 // CHECK: [B2 (ENTRY)] 781 // CHECK: Succs (1): B1 782 // CHECK: [B1] 783 // CHECK: 1: A::make 784 // CHECK: 2: [B1.1] (ImplicitCastExpr, FunctionToPointerDecay, class A (*)(void)) 785 // CHECK: 3: [B1.2]() 786 // CHECK: 4: [B1.3] (BindTemporary) 787 // CHECK: 5: [B1.4] (ImplicitCastExpr, NoOp, const class A) 788 // CHECK: 6: [B1.5] 789 // CHECK: 7: const A &a = A::make(); 790 // CHECK: 8: foo 791 // CHECK: 9: [B1.8] (ImplicitCastExpr, FunctionToPointerDecay, void (*)(const class A &)) 792 // CHECK: 10: A::make 793 // CHECK: 11: [B1.10] (ImplicitCastExpr, FunctionToPointerDecay, class A (*)(void)) 794 // CHECK: 12: [B1.11]() 795 // CHECK: 13: [B1.12] (BindTemporary) 796 // CHECK: 14: [B1.13] (ImplicitCastExpr, NoOp, const class A) 797 // CHECK: 15: [B1.14] 798 // CHECK: 16: [B1.9]([B1.15]) 799 // CHECK: 17: ~A() (Temporary object destructor) 800 // CHECK: 18: int b; 801 // CHECK: 19: [B1.7].~A() (Implicit destructor) 802 // CHECK: Preds (1): B2 803 // CHECK: Succs (1): B0 804 // CHECK: [B0 (EXIT)] 805 // CHECK: Preds (1): B1 806 // CHECK: [B2 (ENTRY)] 807 // CHECK: Succs (1): B1 808 // CHECK: [B1] 809 // CHECK: 1: int a; 810 // CHECK: 2: A() (CXXConstructExpr, class A) 811 // CHECK: 3: [B1.2] (BindTemporary) 812 // CHECK: 4: [B1.3].operator int 813 // CHECK: 5: [B1.4]() 814 // CHECK: 6: [B1.5] (ImplicitCastExpr, UserDefinedConversion, int) 815 // CHECK: 7: a 816 // CHECK: 8: [B1.7] = [B1.6] 817 // CHECK: 9: ~A() (Temporary object destructor) 818 // CHECK: 10: int b; 819 // CHECK: Preds (1): B2 820 // CHECK: Succs (1): B0 821 // CHECK: [B0 (EXIT)] 822 // CHECK: Preds (1): B1 823 // CHECK: [B2 (ENTRY)] 824 // CHECK: Succs (1): B1 825 // CHECK: [B1] 826 // CHECK: 1: A() (CXXConstructExpr, class A) 827 // CHECK: 2: [B1.1] (BindTemporary) 828 // CHECK: 3: [B1.2].operator int 829 // CHECK: 4: [B1.3]() 830 // CHECK: 5: [B1.4] (ImplicitCastExpr, UserDefinedConversion, int) 831 // CHECK: 6: int([B1.5]) (CXXFunctionalCastExpr, NoOp, int) 832 // CHECK: 7: B() (CXXConstructExpr, class B) 833 // CHECK: 8: [B1.7] (BindTemporary) 834 // CHECK: 9: [B1.8].operator int 835 // CHECK: 10: [B1.9]() 836 // CHECK: 11: [B1.10] (ImplicitCastExpr, UserDefinedConversion, int) 837 // CHECK: 12: int([B1.11]) (CXXFunctionalCastExpr, NoOp, int) 838 // CHECK: 13: [B1.6] + [B1.12] 839 // CHECK: 14: a([B1.13]) (Member initializer) 840 // CHECK: 15: ~B() (Temporary object destructor) 841 // CHECK: 16: ~A() (Temporary object destructor) 842 // CHECK: 17: /*implicit*/int() 843 // CHECK: 18: b([B1.17]) (Member initializer) 844 // CHECK: Preds (1): B2 845 // CHECK: Succs (1): B0 846 // CHECK: [B0 (EXIT)] 847 // CHECK: Preds (1): B1 848 849