Commit b02d970
committed
[clang][sema] Generate builtin operator overloads for (volatile) _Atomic types
We observed a failed assert in overloaded compound-assignment operator resolution:
```
Assertion failed: (Result.isInvalid() && "C++ binary operator overloading is missing candidates!"), function CreateOverloadedBinOp, file SemaOverload.cpp, line 13944.
...
frame rust-lang#4: clang` clang::Sema::CreateOverloadedBinOp(..., Opc=BO_OrAssign, ..., PerformADL=true, AllowRewrittenCandidates=false, ...) at SemaOverload.cpp:13943
frame rust-lang#5: clang` BuildOverloadedBinOp(..., Opc=BO_OrAssign, ...) at SemaExpr.cpp:15228
frame rust-lang#6: clang` clang::Sema::BuildBinOp(..., Opc=BO_OrAssign, ...) at SemaExpr.cpp:15330
frame rust-lang#7: clang` clang::Sema::ActOnBinOp(..., Kind=pipeequal, ...) at SemaExpr.cpp:15187
frame rust-lang#8: clang` clang::Parser::ParseRHSOfBinaryExpression(..., MinPrec=Assignment) at ParseExpr.cpp:629
frame rust-lang#9: clang` clang::Parser::ParseAssignmentExpression(..., isTypeCast=NotTypeCast) at ParseExpr.cpp:176
frame rust-lang#10: clang` clang::Parser::ParseExpression(... isTypeCast=NotTypeCast) at ParseExpr.cpp:124
frame rust-lang#11: clang` clang::Parser::ParseExprStatement(...) at ParseStmt.cpp:464
```
A simple reproducer is:
```
_Atomic unsigned an_atomic_uint;
enum { an_enum_value = 1 };
void enum1() { an_atomic_uint += an_enum_value; }
```
This patch fixes the issue by generating builtin operator overloads for (volatile) _Atomic types.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D1253491 parent f125518 commit b02d970
File tree
4 files changed
+191
-25
lines changed- clang
- include/clang/AST
- lib/Sema
- test
- CodeGenCXX
- SemaCXX
4 files changed
+191
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
268 | 273 | | |
269 | 274 | | |
270 | 275 | | |
271 | 276 | | |
272 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
273 | 283 | | |
274 | 284 | | |
275 | 285 | | |
276 | 286 | | |
277 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
278 | 293 | | |
279 | 294 | | |
280 | 295 | | |
| |||
609 | 624 | | |
610 | 625 | | |
611 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
612 | 668 | | |
613 | 669 | | |
614 | 670 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8200 | 8200 | | |
8201 | 8201 | | |
8202 | 8202 | | |
| 8203 | + | |
| 8204 | + | |
| 8205 | + | |
| 8206 | + | |
| 8207 | + | |
| 8208 | + | |
| 8209 | + | |
| 8210 | + | |
| 8211 | + | |
| 8212 | + | |
| 8213 | + | |
| 8214 | + | |
| 8215 | + | |
| 8216 | + | |
| 8217 | + | |
| 8218 | + | |
| 8219 | + | |
| 8220 | + | |
| 8221 | + | |
| 8222 | + | |
| 8223 | + | |
| 8224 | + | |
| 8225 | + | |
| 8226 | + | |
| 8227 | + | |
| 8228 | + | |
| 8229 | + | |
| 8230 | + | |
| 8231 | + | |
| 8232 | + | |
| 8233 | + | |
| 8234 | + | |
| 8235 | + | |
| 8236 | + | |
| 8237 | + | |
| 8238 | + | |
| 8239 | + | |
| 8240 | + | |
| 8241 | + | |
| 8242 | + | |
| 8243 | + | |
| 8244 | + | |
| 8245 | + | |
8203 | 8246 | | |
8204 | 8247 | | |
8205 | 8248 | | |
| |||
8210 | 8253 | | |
8211 | 8254 | | |
8212 | 8255 | | |
8213 | | - | |
| 8256 | + | |
8214 | 8257 | | |
8215 | 8258 | | |
8216 | 8259 | | |
| |||
8334 | 8377 | | |
8335 | 8378 | | |
8336 | 8379 | | |
8337 | | - | |
| 8380 | + | |
8338 | 8381 | | |
8339 | 8382 | | |
8340 | 8383 | | |
| |||
8955 | 8998 | | |
8956 | 8999 | | |
8957 | 9000 | | |
8958 | | - | |
8959 | | - | |
8960 | | - | |
8961 | | - | |
8962 | 9001 | | |
8963 | | - | |
8964 | | - | |
8965 | | - | |
8966 | | - | |
8967 | | - | |
8968 | | - | |
8969 | | - | |
| 9002 | + | |
| 9003 | + | |
| 9004 | + | |
| 9005 | + | |
| 9006 | + | |
| 9007 | + | |
| 9008 | + | |
8970 | 9009 | | |
8971 | 9010 | | |
8972 | 9011 | | |
| |||
9013 | 9052 | | |
9014 | 9053 | | |
9015 | 9054 | | |
9016 | | - | |
9017 | | - | |
9018 | | - | |
9019 | | - | |
9020 | | - | |
9021 | | - | |
9022 | | - | |
9023 | | - | |
9024 | | - | |
9025 | | - | |
| 9055 | + | |
| 9056 | + | |
| 9057 | + | |
| 9058 | + | |
| 9059 | + | |
| 9060 | + | |
| 9061 | + | |
9026 | 9062 | | |
9027 | 9063 | | |
9028 | 9064 | | |
| |||
9186 | 9222 | | |
9187 | 9223 | | |
9188 | 9224 | | |
9189 | | - | |
| 9225 | + | |
9190 | 9226 | | |
9191 | | - | |
| 9227 | + | |
9192 | 9228 | | |
| 9229 | + | |
| 9230 | + | |
| 9231 | + | |
9193 | 9232 | | |
9194 | 9233 | | |
9195 | 9234 | | |
| |||
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
0 commit comments