[cfe-dev] Why is "..." printed 'After' the arg name in TypePrinter?

Aaron Ballman aaron at aaronballman.com
Mon Sep 15 08:24:57 PDT 2014


I've fixed this in r217771 -- however, pretty printing of attributes
in general still needs a lot of work. For instance, attributes on tag
declarations are never printed via -ast-print, which obviously needs
to be fixed still.

Thank you for pointing this out!

~Aaron

On Mon, Sep 15, 2014 at 9:11 AM, Vassil Vassilev
<vasil.georgiev.vasilev at cern.ch> wrote:
> On 09/15/2014 03:09 PM, Aaron Ballman wrote:
>>
>> On Mon, Sep 15, 2014 at 5:45 AM, Vassil Vassilev
>> <vasil.georgiev.vasilev at cern.ch> wrote:
>>>
>>> On 08/01/2014 03:58 PM, Aaron Ballman wrote:
>>>>
>>>> On Fri, Aug 1, 2014 at 9:34 AM, Aaron Ballman <aaron at aaronballman.com>
>>>> wrote:
>>>>>
>>>>> On Fri, Aug 1, 2014 at 9:26 AM, Vassil Vassilev
>>>>> <vasil.georgiev.vasilev at cern.ch> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>     Thanks for fixing this issue:
>>>>>>     There seem to be another issue with recent clang when printing:
>>>>>>     cat T.h
>>>>>>     typedef struct { } __pthread_unwind_buf_t __attribute__
>>>>>> ((__aligned__));
>>>>>>
>>>>>>     clang -cc1  -x c++ -fsyntax-only T.h -ast-print
>>>>>> struct {
>>>>>> } typedef __pthread_unwind_buf_t __attribute__((aligned(clang:
>>>>>>
>>>>>>
>>>>>> /home/vvassilev/workspace/llvm-github/obj/tools/clang/lib/AST/../../include/clang/AST/AttrImpl.inc:294:
>>>>>> virtual void clang::AlignedAttr::printPretty(llvm::raw_ostream &,
>>>>>> const
>>>>>> clang::PrintingPolicy &) const: Assertion `isalignmentExpr &&
>>>>>> alignmentExpr
>>>>>> != nullptr' failed.
>>>>>
>>>>> This is a problem with the way we tablegen attribute helper methods.
>>>>> I'll look into it, thank you for bringing it to my attention!
>>>>
>>>> This should be resolved in r214513.
>>>
>>> (Sorry for reusing the thread)
>>> template<typename, unsigned = 0>
>>> struct __attribute__((type_visibility("default"))) extent;
>>>
>>> gets printed as:
>>>
>>> template<typename, unsigned = 0>
>>> struct __attribute__((type_visibility(0))) extent;
>>>
>>> (and it doesn't compiler because a string is expected) Is that by design
>>> or
>>> a bug?
>>
>> That seems like a bug to me. Enumerations print their integral value,
>> not their enumerator identifier, which is what causes the issue. It
>> shouldn't be too hard to fix, I'll look into it today.
>
> Thanks! It seems that printPretty would need to reuse (somehow?) the
> implementation of ASTDumper::dumpAttr... I am not sure if this can be done
> without a lot of changes to table gen...
>
> Vassil
>>
>>
>> Thanks!
>>
>> ~Aaron
>
>



More information about the cfe-dev mailing list