The WebAssembly backend in particular benefits from being
able to distinguish between varargs functions (...) and prototype-less
C functions.
Details
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 19590 Build 19590: arc lint + arc unit
Event Timeline
Looks very reasonable and straightforward. LGTM in spirit, but I'll wait for someone who knows Clang better.
lib/CodeGen/CGCall.cpp | ||
---|---|---|
1850 | Would it make sense to put this in AddAttributesFormFunctionProtoType Does this have the same effect as that would? For that matter, what's the practical difference between this call and the one on line 1826? |
lib/CodeGen/CGCall.cpp | ||
---|---|---|
1849 | Is there a reason why this is not something like llvm::Attribute::NoPrototype like other attributes? |
lib/CodeGen/CGCall.cpp | ||
---|---|---|
1849 | Target-independent attributes get enums, and target-specific attributes are just strings: https://llvm.org/docs/LangRef.html#attribute-groups |
lib/CodeGen/CGCall.cpp | ||
---|---|---|
1849 | Actually, I just noticed that we don't appear to have made this actually target-dependent (the test uses X86). So we should either make this attribute actually wasm-only, or make it an enum. |
I haven't thought through all the possibilities related to !FD->doesThisDeclarationHaveABody(), but overall this looks good.
Without the check for doesThisDeclarationHaveABody() the attribute will also be added to baz which is IIRC is not what we want since the C notions of "prototypeless" only applies to forward declarations I think.
Is there a reason why this is not something like llvm::Attribute::NoPrototype like other attributes?