[cfe-dev] clang::Qualifiers::TQ flags are not in sync with DeclSpec::TQ flags

Vladimir Voskresensky via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 9 13:51:20 PDT 2017


Ping,

Could someone comment, please, if clang::Qualifiers::TQ intentionally 
reduces number of flags from 5 to 3?

Thanks,
Vladimir.

On 07.08.2017 16:06, Vladimir Voskresensky via cfe-dev wrote:
> Hello,
>
> clang::Qualifiers::TQ has 3 flags and CVRMask mask. Also it has the note:
> // NOTE: These flags must be kept in sync with DeclSpec::TQ.
>
> But
> DeclSpec::TQ has 5 flags (so  TQ_unaligned = 8, TQ_atomic = 16 are 
> missed in clang::Qualifiers::TQ)
>
> This inconsistency can be found by debugging test 
> llvm/tools/clang/test/Sema/MicrosoftExtensions.c on the last declaration:
> void test_unaligned2(int x[__unaligned 4]) {}
>
> Array type is created incorrectly here, because '__unaligned' is lost 
> in the ArrayType constructor at line:
> ArrayTypeBits.IndexTypeQuals = tq;
> tq has value 8 (TQ_unaligned) while IndexTypeQuals is declared to use 
> ":3" bits only, so IndexTypeQuals is zero after assign.
>
> Usually TQ fields are 5 bits (see i.e. DeclSpec::TypeQualifiers), so
> declaration Type::ArrayTypeBitfields::IndexTypeQuals must be fixed as 
> well
>
> Hope it helps,
> Vladimir.
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list