[cfe-dev] CanQualType for ssize_t
Александр Шапошников via cfe-dev
cfe-dev at lists.llvm.org
Tue Jul 11 19:01:26 PDT 2017
On Tue, Jul 11, 2017 at 5:19 PM, Alexander Shaposhnikov <shal1t712 at gmail.com
> wrote:
> Hi,
> I have a question regarding the right way to get CanQualType/QualType for
> "ssize_t".
>
> The class ASTContext
> <https://clang.llvm.org/doxygen/classclang_1_1ASTContext.html#a7c89acd533ffea38c5011885d8d029e4>
> (https://clang.llvm.org/doxygen/ASTContext_8cpp_source.html#l04524)
> has a number of methods: getIntMaxType, getUintMaxType, getSizeType etc
> but if i am not mistaken it doesn't have the counterpart for "ssize_t".
> After looking at the implementation of those methods i see that it's
> missing in the class TargetInfo
> <https://clang.llvm.org/doxygen/classclang_1_1TargetInfo.html> either.
> https://clang.llvm.org/doxygen/include_2clang_2Basic_
> 2TargetInfo_8h_source.html#l00228 .
>
> Some context:
>
> in PrintfSpecifier::getArgType (in ./lib/Analysis/PrintfFormatString.cpp)
> there is a FIXME:
>
> case LengthModifier::AsSizeT:
> return ArgType(); // FIXME: ssize_t
>
> as a result Clang doesn't analyze the format string "%zd" correctly
> and doesn't warn on the following (broken) code:
>
> int main() {
> printf("%zd", 12.2);
> return 0;
> }
>
> Kind regards,
> Alexander Shaposhnikov
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170711/9c22ef74/attachment.html>
More information about the cfe-dev
mailing list