[cfe-dev] clang builtin function attributes
Taewook Oh via cfe-dev
cfe-dev at lists.llvm.org
Tue Apr 5 11:56:06 PDT 2016
Thank you for your reply. I wonder if clang does not support "pure" attribute at all, or has a different name for it.
Thanks,
Taewook
From: <metafoo at gmail.com<mailto:metafoo at gmail.com>> on behalf of Richard Smith <richard at metafoo.co.uk<mailto:richard at metafoo.co.uk>>
Date: Tuesday, April 5, 2016 at 11:48 AM
To: Taewook Oh <twoh at fb.com<mailto:twoh at fb.com>>
Cc: via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>
Subject: Re: [cfe-dev] clang builtin function attributes
On Tue, Apr 5, 2016 at 11:28 AM, Taewook Oh via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> wrote:
Hello,
Unlike gcc, clang does not provide builtin functions for functions in ctype.h, such as tolower. To generated better optimized code, I'm planning to add these functions as builtins with attributes. Regarding this, I have a few questions:
1. In "Attributes in Clang" page (http://clang.llvm.org/docs/AttributeReference.html<https://urldefense.proofpoint.com/v2/url?u=http-3A__clang.llvm.org_docs_AttributeReference.html&d=CwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=kOsLCgQzH7N8ptZ7diJD9g&m=Q2Jov6ZReuDh4daoAqk_HH2uEZ3C0Cg4ZSEOO63immU&s=vAgJMXrR_WQXR4r2P0R6gFK9E5X6s94A6CfBHEaOhOI&e=>), "nothrow" and "const" are not in the list while they are still used in Builtins.def. Are these attributes deprecated?
No, they're just not documented yet. (We'd appreciate patches to include/clang/AttrDocs.td and include/clang/Attr.td if you're feeling enthusiastic, but note that this needs to be original documentation -- it wouldn't be acceptable to copy documentation from GCC due to license differences.)
1. (Assuming they are not deprecated) Is there a place that I can find definitions for attributes used in builtins.def? In particular, I wonder if "const" attributes of clang has same meaning with gcc's "const" attribute, as it seems that clang does not support "pure" attribute.
Yes, the attributes listed in clang's Builtins.def are the __attribute__((X)) form, which generally mean the same thing to Clang as they do to GCC (with rare exceptions).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160405/69fa234f/attachment.html>
More information about the cfe-dev
mailing list