dougsonos wrote:

> > * Conversions between functions / function pointers with and without the 
> > attribute work in C++ but not in C and I'm a bit lost (there's a bunch of 
> > debug logging around this e.g. Sema::IsFunctionConversion and 
> > Sema::ImpCastExprToType)

I've probably been staring at this way too long, but here's what's going on. My 
test is:

```
void nolock(int) [[clang::nolock]];
void x() {
        void (*fp_plain)(int);
        fp_plain = nolock;
}
```

At the bottom of `checkPointerTypesForAssignment`:
```
  llvm::outs() << "checkPointerTypesForAssignment calling IsFunctionConversion 
LHS " << ltrans << "   RHS " << rtrans << "\n";
  if (!S.getLangOpts().CPlusPlus &&
      S.IsFunctionConversion(ltrans, rtrans, ltrans))
```
This prints `LHS void (int)   RHS void (int) __attribute__((clang_nolock))`

Then inside isFunctionConversion, I immediately log:
```
  llvm::outs() << "IsFunctionConversion: " << FromType << " -> " << ToType
               << "\n";
```
and it's `void (int) -> void (int) __attribute__((clang_nolock))`

Reconciliation of the FunctionEffectSets on the two types is needed, but I'm 
confused right from the beginning here; the naming of "From" and "To" seems 
backwards. Would appreciate any pointers.

https://github.com/llvm/llvm-project/pull/84983
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to