Commit ccc4732
[Clang] FunctionEffects: properly extract the type of a bound member member function from a CallExpr. (llvm#166101)
There's a bug illustrated by this example:
```
template <typename T>
struct Holder {
T value;
T& operator*() { return value; }
};
struct X {
using Dispatch = float (X::*)() [[clang::nonblocking]];
void fails(Holder<Dispatch>& holder) [[clang::nonblocking]]
{
(this->*(*holder))(); <<< the expression is incorrectly determined not to be nonblocking
}
void succeeds(Holder<Dispatch>& holder) [[clang::nonblocking]]
{
auto func = *holder;
(this->*func)();
}
};
```
In both cases we have a `CXXMemberCallExpr`. In `succeeds`, the
expression refers to a `Decl` (`func`) and gets a useful PTMF type. In
`fails`, the expression does not refer to a `Decl` and its type is
special, printed as `bound member function`. `Expr` provides a method
for extracting the true type so we can use that in this situation.
---------
Co-authored-by: Doug Wyatt <[email protected]>
Co-authored-by: Sirraide <[email protected]>1 parent f02b661 commit ccc4732
File tree
2 files changed
+36
-9
lines changed- clang
- lib/Sema
- test/Sema
2 files changed
+36
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1208 | 1208 | | |
1209 | 1209 | | |
1210 | 1210 | | |
1211 | | - | |
1212 | | - | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
1213 | 1221 | | |
1214 | 1222 | | |
1215 | 1223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
| 238 | + | |
240 | 239 | | |
241 | 240 | | |
242 | | - | |
243 | 241 | | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
248 | 267 | | |
249 | 268 | | |
250 | 269 | | |
| |||
0 commit comments