NoBuiltin Attribute Patch

Michael Gottesman mgottesman at apple.com
Tue Jun 25 17:34:57 PDT 2013


Hey Richard!

Here is the promised patch. I took your original patch and made the following changes:

Actual Changes:
1. In order to make hasFnAttr(Attribute::NoBuiltin) assert like Chris requested, I had to extract out its implementation into a separate function called hasFnAttrImpl. The reason for this is that in isNoBuiltin, I can not use hasFnAttr(Attribute::NoBuiltin) to check for NoBuiltin since that would cause the assertion = p. I need to access said functionality therein, so it made sense to add a private helper method. Thus instead in isNoBuiltin I just invoke the hasFnAttrImpl function and in hasFnAttr I perform the assert and then call hasFnAttrImpl yielding the proper behavior.
2. Added code to lib/IR/Verifier.cpp to ensure that we do not accept the builtin attribute on function declarations/definitions.

Tests:
1. I added a test that tests that we accept builtin attributes on function call sites where the function has a nobuiltin attribute. It also tests that we can assembly/disassemble said builtin.
2. I added a test that tests that llvm-as fails if we have a builtin attribute on a function declaration.
3. I added a test that tests that llvm-as fails if we have a builtin attribute on a function definition.
3. I added a test that tests that llvm-as fails if we have a builtin attribute on a call site for a function that does not have  the nobuiltin attribute.

It is still mostly yours = ).

Please Review,
Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Added-support-for-the-Builtin-attribute.patch
Type: application/octet-stream
Size: 20860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130625/90b9abb0/attachment.obj>


More information about the llvm-commits mailing list