[llvm-commits] Extend Attributes to 64 bits (wrapped in a class), add one more attribute for address safety checking

Owen Anderson resistor at mac.com
Wed Jan 18 16:16:36 PST 2012


Kostya,

This looks fine to me.  Unless you hear other objections,  I'm fine you applying this.

--Owen

On Jan 13, 2012, at 2:15 PM, Kostya Serebryany wrote:

> Hello, 
> 
> Please consider the following patches (llvm and clang). 
> 
> Problem: LLVM needs more function attributes than currently available (32 bits).
> One such proposed attribute is "address_safety", which shows that a function is being checked for address safety (by AddressSanitizer, SAFECode, etc).
> 
> Solution: 
>    - extend the Attributes from 32 bits to 64-bits
>    - wrap the object into a class so that unsigned is never erroneously used instead
>    - change "unsigned" to "Attributes" throughout the code, including one place in clang. 
>    - the class has no "operator uint64 ()", but it has "uint64_t Raw() " to support packing/unpacking. 
>    - the class has "safe operator bool()" to support the common idiom:  if (Attributes attr = getAttrs()) useAttrs(attr);
>    - The CTOR from uint64_t is marked explicit, so I had to add a few explicit CTOR calls
>    - Add the new attribute "address_safety". Doing it in the same commit to check that attributes beyond first 32 bits actually work. 
>    - Some of the functions from the Attribute namespace are worth moving inside the class, but I'd prefer to have it as a separate commit. 
> 
> Tested: 
>    "make check" on Linux and Mac (10.6)
>    built/run spec CPU 2006 on Linux with clang -O2. 
> 
> The patches are attached, the llvm patch is also published here: http://codereview.appspot.com/5544058/
> 
> Thanks, 
> 
> --kcc 
>   
> <attr_clang.patch><attr_llvm.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120118/23ae3981/attachment.html>


More information about the llvm-commits mailing list