JonPsson1 wrote:

Looking at this comment in CallingConv.h:

```
  enum {
    /// The default llvm calling convention, compatible with C. This convention
    /// is the only one that supports varargs calls. As with typical C calling
    /// conventions, the callee/caller have to tolerate certain amounts of
    /// prototype mismatch.
    C = 0,

    // Generic LLVM calling conventions. None of these support varargs calls,
    // and all assume that the caller and callee prototype exactly match.

    /// Attempts to make calls as fast as possible (e.g. by passing things in
    /// registers).
    Fast = 8,
...

```

So, like @nikic hinted at previously, it seems that with any other calling 
convention than "C", the extension attribute is present either on both or 
neither of the caller/callee arguemnts.

Patch updated to check only calls/functions with the C calling convention and 
remove the previous isInternal() heuristic.

It would be possible to also check a call to an internal function to see that 
the call and definition extensions match. However, when trying this with a 
simple (fastcc) test case the caller will actually do the extension even if 
there only is the extension attribute in the function definition. I suppose 
this makes sense as they are assumed (per comment above) to exactly match, and 
if the Callee has the attribute that would be the reasonable assumption to 
follow.

@uweigand

https://github.com/llvm/llvm-project/pull/223755
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to