[llvm-dev] [llvm] r259255 - Need #include <cstdint> for uint64_t

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 29 18:27:01 PST 2016


The point I was trying to make here is that all things that DataTypes.h provides:
intXXX_t, uintXX_t, PRIdXX, INT64_MAX, HUGE_VAL, ssize_t ...
are all part of the C++11 standard and can be found in <cstdint>, <cmath> (except for ssize_t) so I wondered if there is still a need for llvm to provide this header since we require a C++11 compiler anyway nowadays.

In each case I changed my file to use DataTypes.h now.

- Matthias

> On Jan 29, 2016, at 5:08 PM, Craig Topper via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> DataTypes.h is transitively included through a lot of very common includes already. So its entirely possible AMDGPU and Hexagon are really including it.
> 
> On Fri, Jan 29, 2016 at 5:02 PM, mats petersson <mats at planetcatfish.com <mailto:mats at planetcatfish.com>> wrote:
> Sounds to me like including `DataTypes.h` would be the right choice, since it will include `stdint.h` if it exists - and error if it doesn't, along with a few other things. And it guarantees that the entire compiler uses the SAME definition, rather than, potentially, using different variants of the "same" type in different places.
> 
> I'd argue the other way around, that you probably should fix the other bits that use `cstdint` to use `DataTypes.h`.
> 
> --
> Mats
> 
> On 30 January 2016 at 00:33, Matthias Braun via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> Oh I did not know about DataTypes.h. However given that there are already two other files in llvm (in the AMDGPU and Hexagon targets) that #include <cstdint> since 2014, maybe we can loosen the requirement for DataTypes.h nowadays as #include <cstdint> seems to be working everywhere?
> 
> - Matthias
> 
>> On Jan 29, 2016, at 3:06 PM, Craig Topper <craig.topper at gmail.com <mailto:craig.topper at gmail.com>> wrote:
>> 
>> I think you may really want include/llvm/Support/DataTypes.h
>> 
>> On Fri, Jan 29, 2016 at 2:35 PM, Matthias Braun via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>> Author: matze
>> Date: Fri Jan 29 16:35:29 2016
>> New Revision: 259255
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=259255&view=rev <http://llvm.org/viewvc/llvm-project?rev=259255&view=rev>
>> Log:
>> Need #include <cstdint> for uint64_t
>> 
>> Modified:
>>     llvm/trunk/lib/IR/AttributeImpl.h
>> 
>> Modified: llvm/trunk/lib/IR/AttributeImpl.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AttributeImpl.h?rev=259255&r1=259254&r2=259255&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AttributeImpl.h?rev=259255&r1=259254&r2=259255&view=diff>
>> ==============================================================================
>> --- llvm/trunk/lib/IR/AttributeImpl.h (original)
>> +++ llvm/trunk/lib/IR/AttributeImpl.h Fri Jan 29 16:35:29 2016
>> @@ -19,8 +19,9 @@
>>  #include "llvm/ADT/FoldingSet.h"
>>  #include "llvm/IR/Attributes.h"
>>  #include "llvm/Support/TrailingObjects.h"
>> -#include <string>
>>  #include <climits>
>> +#include <cstdint>
>> +#include <string>
>> 
>>  namespace llvm {
>> 
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>> 
>> 
>> 
>> -- 
>> ~Craig
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
> 
> 
> 
> 
> 
> -- 
> ~Craig
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160129/5e2c3bac/attachment.html>


More information about the llvm-commits mailing list