[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-08-27 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 456140. yihanaa added a comment. Keep same behavior with current clang, don't emit an error when 1st arg is volatile qualified. Ignore the implicit cast from user-written-type to 'const void *' on the 1st arg, because CodeGen need user-written-type to gener

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-08-27 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 456142. yihanaa added a comment. Format code and recovery builtin-functions.cpp(Wrongly modified in the last update) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131979/new/ https://reviews.llvm.org/D131979

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-08-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. pin~ Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131979/new/ https://reviews.llvm.org/D131979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-08-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. pin~ Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131979/new/ https://reviews.llvm.org/D131979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-08-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D131979#3756006 , @rjmccall wrote: > In D131979#3753358 , @yihanaa wrote: > >> In D131979#3752208 , @rjmccall >> wrote: >> >>> From the test c

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-08-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D131979#3753706 , @yihanaa wrote: > Keep same behavior with current clang, don't emit an error when 1st arg is > volatile qualified. > > Ignore the implicit cast from user-written-type to 'const void *' on the 1st > arg, beca

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-08-30 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 456646. yihanaa added a comment. Use custom seam checking on __builtin_assume_aligned. C++ not allow implicit cast from volatile void * to const void *, but C allowed and only emit a warning. This is a general case, volatile in __builtin_assume_aligned just

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-08-30 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D131979#3756474 , @rjmccall wrote: > In D131979#3756067 , @yihanaa wrote: > >> In D131979#3756006 , @rjmccall >> wrote: >> >>> In D131979#3753

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-08-30 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Now that parameter checking is generic, I think it would be better to use both common seam checking and custom sema checking, like Diff 456142 (https://reviews.llvm.org/differential/diff/456142/), what do you think about? Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-08-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Thanks for your review John, I'll try to fix these problem later which you point out. Comment at: clang/lib/Sema/SemaChecking.cpp:7659 + << 0 << 2 << TheCall->getNumArgs() << Callee->getSourceRange(); + } + rjmccall wrote: >

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-09-01 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:7671 + AllArgs, CallType)) +return true; + rjmccall wrote: > yihanaa wrote: > > rjmccall wrote: > > > You can just pull the argument expressions out of the

[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

2022-09-01 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:7671 + AllArgs, CallType)) +return true; + rjmccall wrote: > yihanaa wrote: > > rjmccall wrote: > > > yihanaa wrote: > > > > rjmccall wrote: > > > > > You c

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3402875 , @aaron.ballman wrote: > Thanks for the fix! Can you please add a release note as well? Okay, i try to add some test case for zero-width bitfield and unnamed bitfield, and add a release notes. Repository:

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 417687. yihanaa added a comment. 1. Support zero-width bitfield. 2. Supported unnamed bitfield. 3. Add a release notes. The builtin function __builtin_dump_struct behaves for zero-width bitfield and unnamed bitfield as follows void test8(void) { struc

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3402924 , @erichkeane wrote: > Seems reasonable to me. Obviously needs release notes + the tests that Aaron > did, but I think this looks right. Thank you for reminding,i have add a release notes entry and a test ca

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3403315 , @aaron.ballman wrote: > In D122248#3403143 , @yihanaa wrote: > >> 1. Support zero-width bitfield, named bitfield and unnamed bitfield. >> 2. Add a release notes. >> >

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3403349 , @erichkeane wrote: > In D122248#3403343 , @yihanaa wrote: > >> In D122248#3403315 , >> @aaron.ballman wrote: >> >>> In D122

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3403478 , @erichkeane wrote: > If it is ok, I think we should probably change the format of the 'dump' for > fields. Using the colon to split up the field from the value is unfortunate, > may I suggest replacing it

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3403518 , @aaron.ballman wrote: > In D122248#3403478 , @erichkeane > wrote: > >> If it is ok, I think we should probably change the format of the 'dump' for >> fields. Using

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3403637 , @erichkeane wrote: > In D122248#3403636 , @yihanaa wrote: > >> In D122248#3403518 , >> @aaron.ballman wrote: >> >>> In D122

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3403698 , @erichkeane wrote: >> I'm sorry I misunderstood what you meant @aaron.ballman. >> >> Can we follow the lead of LLVM IR?it use 'undef' >> for example: >> >> struct T6A { >> unsigned a : 1; >> uns

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-24 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3405166 , @erichkeane wrote: > In D122248#3405062 , @aaron.ballman > wrote: > >> In D122248#3403734 , @yihanaa >> wrote: >> >>> What

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-24 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 417990. yihanaa added a comment. Support dump bitwidth of bitfields, and unnamed bitfields. for example: struct Bar { unsigned c : 1; unsigned : 3; unsigned : 0; unsigned b; }; struct Bar { unsigned int c : 1 = 0 unsigned int : 3 = 0

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-24 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3405866 , @aaron.ballman wrote: > In D122248#3405644 , @yihanaa wrote: > >> In D122248#3405166 , @erichkeane >> wrote: >> >>> In D122

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-24 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa marked an inline comment as done. yihanaa added a comment. Maybe add the changes under "Attribute Changes in Clang"? Comment at: clang/docs/ReleaseNotes.rst:81 `Issue 50541 `_. - +- The builtin function __builtin_dum

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-24 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 417999. yihanaa marked an inline comment as done. yihanaa added a comment. Use ``FD->getDeclName().empty()`` instead of ``FD->getNameAsString().empty()`` Add a the format changes to release notes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTI

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-24 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Waitting for CI... Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122248/new/ https://reviews.llvm.org/D122248 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://list

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-24 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3406117 , @erichkeane wrote: > LGTM! Please give Aaron a few hours (perhaps until tomorrow?) to take 1 last > look before committing. > > Also, if you lack commit rights and need someone to commit for you, please >

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-24 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3406145 , @aaron.ballman wrote: > LGTM aside from a tiny nit with one of the release notes. I'd be happy to fix it In D122248#3406145 , @aaron.ballman wrote: > LGTM aside f

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-24 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 418008. yihanaa added a comment. Put the dump format changes under the "Non-comprehensive list of changes in this release" heading instead. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122248/new/ https://rev

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-24 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3406180 , @erichkeane wrote: > In D122248#3406162 , @yihanaa wrote: > >> In D122248#3406145 , >> @aaron.ballman wrote: >> >>> LGTM as

[PATCH] D122662: [Clang][CodeGen] Add constant array support for __builtin_dump_sturct, and beautify dump format

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa created this revision. yihanaa added reviewers: erichkeane, aaron.ballman. yihanaa added projects: LLVM, clang. Herald added a project: All. yihanaa requested review of this revision. Herald added a subscriber: cfe-commits. 1. Add constant array support for __builtin_dump_sturct, the style

[PATCH] D122662: [Clang][CodeGen] Add constant array support for __builtin_dump_sturct, and beautify dump format

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 418895. yihanaa added a comment. Remove unnecessary code format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122662/new/ https://reviews.llvm.org/D122662 Files: clang/docs/LanguageExtensions.rst clang/doc

[PATCH] D122662: [Clang][CodeGen] Add constant array support for __builtin_dump_sturct, and beautify dump format

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Thanks for review @erichkeane ,maybe i should split this patch. Comment at: clang/docs/ReleaseNotes.rst:93 and `51641 `_. +- The builtin function __builtin_dump_struct would crash clang when the targ

[PATCH] D122662: [Clang][CodeGen] Add constant array support for __builtin_dump_sturct, and beautify dump format

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 418901. yihanaa added a comment. split another patch to fix ReleaseNotes. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122662/new/ https://reviews.llvm.org/D122662 Files: clang/docs/ReleaseNotes.rst clang

[PATCH] D122662: [Clang][CodeGen] Add constant array support for __builtin_dump_sturct, and beautify dump format

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122662#3414199 , @erichkeane wrote: > This looks to be quite the large patch, can you split this up into individual > patches? It isn't clear to me what all is going on everywhere. Thanks @erichkeane ,i have splited this p

[PATCH] D122662: [Clang][CodeGen] Add constant array support for __builtin_dump_sturct, and beautify dump format

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122662#3414284 , @erichkeane wrote: > I'd also suggest splitting into the '3' things that you're trying to > accomplish above. The CGBuiltin.cpp code has way too much going on to > reasonably review. These three things ar

[PATCH] D122662: [Clang][CodeGen] Add constant array support for __builtin_dump_sturct, and beautify dump format

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122662#3414284 , @erichkeane wrote: > I'd also suggest splitting into the '3' things that you're trying to > accomplish above. The CGBuiltin.cpp code has way too much going on to > reasonably review. In D122662#3414284

[PATCH] D122662: [Clang][CodeGen] Add constant array support for __builtin_dump_sturct, and beautify dump format

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122662#3414364 , @erichkeane wrote: > In D122662#3414319 , @yihanaa wrote: > >> In D122662#3414284 , @erichkeane >> wrote: >> >>> I'd also s

[PATCH] D122668: [Clang][doc][NFC]Remove duplicate items in ReleaseNotes

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa created this revision. yihanaa added reviewers: erichkeane, aaron.ballman. Herald added a project: All. yihanaa requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Remove duplicate items in ReleaseNotes for __builtin_dump_struct, the co

[PATCH] D122668: [Clang][doc][NFC]Remove duplicate items in ReleaseNotes

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 418920. yihanaa added a comment. Fixed "Description" issue and removed useless newlines Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122668/new/ https://reviews.llvm.org/D122668 Files: clang/docs/ReleaseNot

[PATCH] D122668: [Clang][doc][NFC]Remove duplicate items in ReleaseNotes

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa marked 2 inline comments as done. yihanaa added a comment. In D122668#3414445 , @erichkeane wrote: > 2 small bits, otherwise LGTM. Thanks for review @erichkeane ,i have update the diff, but i don’t have commit access, can you land this patch fo

[PATCH] D122670: [Clang][CodeGen]Remove anonymous tag locations

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa created this revision. yihanaa added reviewers: erichkeane, aaron.ballman. Herald added a project: All. yihanaa requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Remove anonymous tag locations, powered by 'PrintingPolicy', @aaron.ball

[PATCH] D122670: [Clang][CodeGen]Remove anonymous tag locations

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122670#3414549 , @erichkeane wrote: > I think Aaron wants release notes for just about everything :) Mind tossing > one on this patch? I'll commit for you after that. Thanks @erichkeane ,i try to add this change into Rele

[PATCH] D122670: [Clang][CodeGen]Remove anonymous tag locations

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 418929. yihanaa added a comment. Add this change into ReleaseNotes. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122670/new/ https://reviews.llvm.org/D122670 Files: clang/docs/ReleaseNotes.rst clang/lib/C

[PATCH] D122670: [Clang][CodeGen]Remove anonymous tag locations

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122670#3414574 , @erichkeane wrote: > Still LGTM. Thank you! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122670/new/ https://reviews.llvm.org/D122670 _

[PATCH] D122704: [Clang][CodeGen]Beautify dump format, add indent for nested struct and struct members

2022-03-29 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa created this revision. yihanaa added reviewers: erichkeane, aaron.ballman. yihanaa added a project: clang. Herald added a project: All. yihanaa requested review of this revision. Herald added a subscriber: cfe-commits. Beautify dump format, add indent for nested struct and struct members,

[PATCH] D122704: [Clang][CodeGen]Beautify dump format, add indent for nested struct and struct members

2022-03-30 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122704#3416538 , @erichkeane wrote: > This seems fine to me. I won't likely have time to commit this for a while, > but you should be able to apply for commit-rights now and do it yourself. Sorry for taking so long to repl

[PATCH] D122704: [Clang][CodeGen]Beautify dump format, add indent for nested struct and struct members

2022-03-30 Thread Wang Yihan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG907d3acefc3b: [Clang][CodeGen]Beautify dump format, add indent for nested struct and struct… (authored by yihanaa). Repository: rG LLVM Github Mon

[PATCH] D122704: [Clang][CodeGen]Beautify dump format, add indent for nested struct and struct members

2022-03-30 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Thank you for the reviews @erichkeane. I've applied for commit access and commit in 907d3acefc3bdd6eb83f21589c6473ca7e88b3eb . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION http

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa created this revision. yihanaa added reviewers: aaron.ballman, erichkeane, MaskRay. yihanaa added a project: clang. Herald added a subscriber: StephenFan. Herald added a project: All. yihanaa requested review of this revision. Herald added a subscriber: cfe-commits. Add constant array supp

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Thanks for your suggestion @erichkeane ! Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2048 + QualType Type) { + static llvm::DenseMap Types; if (Types.empty()) { erichkeane wrote: > Instea

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2071 + if (Types.find(Type) == Types.end()) +return Types[Context.VoidPtrTy]; + return Types[Type]; erichkeane wrote: > yihanaa wrote: > > erichkeane wrote: > > > When can we hit thi

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. There is another question, which way should I print for an empty array? #1: Same as non empty array int[0] a = [ ] #2: int[0] a = [] The #1's format is more uniform, and the #2 maybe looks a little clearer. What do you think? @erichkeane Repository: rG LLVM

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2048 + QualType Type) { + static llvm::DenseMap Types; if (Types.empty()) { erichkeane wrote: > yihanaa wrote: > > erichkeane wrote: > > >

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2048 + QualType Type) { + static llvm::DenseMap Types; if (Types.empty()) { erichkeane wrote: > yihanaa wrote: > > erichkeane wrote: > > >

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2048 + QualType Type) { + static llvm::DenseMap Types; if (Types.empty()) { yihanaa wrote: > erichkeane wrote: > > yihanaa wrote: > > > eri

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2048 + QualType Type) { + static llvm::DenseMap Types; if (Types.empty()) { erichkeane wrote: > yihanaa wrote: > > yihanaa wrote: > > > eri

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122822#3420162 , @rsmith wrote: > I'm concerned about the direction of this patch given @rjmccall's comments on > https://reviews.llvm.org/D112626 -- presumably the way we'd want to address > those comments would be to conve

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2048 + QualType Type) { + static llvm::DenseMap Types; if (Types.empty()) { erichkeane wrote: > yihanaa wrote: > > erichkeane wrote: > > >

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2048 + QualType Type) { + static llvm::DenseMap Types; if (Types.empty()) { erichkeane wrote: > yihanaa wrote: > > erichkeane wrote: > > >

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-03-31 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. I also agree that this is a useful debugging builtin, and no program logic should be forced to depend on the output of this builtin. It's just used to print out some useful debugging information Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https:/

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-04-01 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2052 Types[Context.BoolTy] = "%d"; Types[Context.SignedCharTy] = "%hhd"; Types[Context.UnsignedCharTy] = "%hhu"; I think this types should have been promoted according to th

[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

2022-04-01 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122822#3422463 , @erichkeane wrote: > In D122822#3421089 , @yihanaa wrote: > >> I also agree that this is a useful debugging builtin, and no program logic >> should be forced to depe

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-04-01 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa marked 3 inline comments as done. yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2113-2117 if (CanonicalType->isRecordType()) { - TmpRes = dumpRecord(CGF, CanonicalType, FieldPtr, Align, Func, Lvl + 1); + TmpRes = dumpRecord(CGF,

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-04-01 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2113-2117 if (CanonicalType->isRecordType()) { - TmpRes = dumpRecord(CGF, CanonicalType, FieldPtr, Align, Func, Lvl + 1); + TmpRes = dumpRecord(CGF, CanonicalType, FieldLV, Align, Func, Lvl

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-01 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa created this revision. yihanaa added reviewers: rsmith, erichkeane, aaron.ballman. yihanaa added a project: clang. Herald added a project: All. yihanaa requested review of this revision. Herald added a subscriber: cfe-commits. Thanks for @rsmith to point this. I'm sorry for introducing thi

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-01 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 419923. yihanaa added a comment. Reformat code. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122920/new/ https://reviews.llvm.org/D122920 Files: clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGen/dump-str

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-01 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 419928. yihanaa added a comment. Reformat code Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122920/new/ https://reviews.llvm.org/D122920 Files: clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGen/dump-stru

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-04-03 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa marked an inline comment as done. yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2113-2117 if (CanonicalType->isRecordType()) { - TmpRes = dumpRecord(CGF, CanonicalType, FieldPtr, Align, Func, Lvl + 1); + TmpRes = dumpRecord(CGF,

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-04 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Can you guys please help me review this patch? 😁 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122920/new/ https://reviews.llvm.org/D122920 ___ cfe-commits mailing list cfe-comm

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-04 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122920#3426556 , @erichkeane wrote: > I don't particularly get what the 'fix' is here to Richard's issue. > Additionally, I think this is showing me the absolute desperate need we have > for some sort of 'text-checking' te

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-04 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2048 LValue RecordLV, CharUnits Align, - llvm::FunctionCallee Func, int Lvl) { + bool dumpTypeName, llvm::Functio

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-04 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2048 LValue RecordLV, CharUnits Align, - llvm::FunctionCallee Func, int Lvl) { + bool dumpTypeName, llvm::Functio

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-04 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. I'll just add that in the recursive call, for record type, it will just print what's between {...} Eg: int printf(const char *, ...); struct A { int x; }; struct B { struct A a; struct C { int b; union X { int i;

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-04 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2048 LValue RecordLV, CharUnits Align, - llvm::FunctionCallee Func, int Lvl) { + bool dumpTypeName, llvm::Functio

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-04 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 420254. yihanaa added a comment. Improve comment Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122920/new/ https://reviews.llvm.org/D122920 Files: clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGen/dump-st

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-22 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 417435. yihanaa added a reviewer: xbolva00. yihanaa added a comment. Remove code formatting changes. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122248/new/ https://reviews.llvm.org/D122248 Files: clang/li

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-22 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122248#3400408 , @xbolva00 wrote: >>> the remaining changes are code formatting > > Please remove code formatting changes. Okay, i have removed. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://rev

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-03-22 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 417439. yihanaa added a comment. Remove useless comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122248/new/ https://reviews.llvm.org/D122248 Files: clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGe

[PATCH] D122248: [clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct

2022-04-07 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2113-2117 if (CanonicalType->isRecordType()) { - TmpRes = dumpRecord(CGF, CanonicalType, FieldPtr, Align, Func, Lvl + 1); + TmpRes = dumpRecord(CGF, CanonicalType, FieldLV, Align, Func, Lvl

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-13 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Could you please help me review the code?@rsmith,thanks😊 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122920/new/ https://reviews.llvm.org/D122920 ___ cfe-commits mailing list c

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2046-2048 static llvm::Value *dumpRecord(CodeGenFunction &CGF, QualType RType, LValue RecordLV, CharUnits Align, + bool dumpTypeName, llvm::Fu

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 424718. yihanaa added a comment. Optimize the code according to @ rsmith's suggestion, and use analyze_printf::PrintfSpecifier::fixType instead of this static DenseMap to find the printf format specifier. Repository: rG LLVM Github Monorepo CHANGES SINC

[PATCH] D124221: Add new builtin __builtin_reflect_struct.

2022-04-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:420 +auto *FD = IFD ? IFD->getAnonField() : dyn_cast(D); +if (!FD || (FD->isUnnamedBitfield() || FD->isAnonymousStructOrUnion())) + continue; erichkeane wrote: > rsmith wrote:

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-23 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Should we use PrintingPolicy.Indentation instead of 4 hardcoded in dumpRecord? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122920/new/ https://reviews.llvm.org/D122920 ___ cfe-

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-25 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122920#3471654 , @erichkeane wrote: > @yihanaa : I'd suggest seeing the conversation that @rsmith @aaron.ballman > and I are having about this builtin here: https://reviews.llvm.org/D124221 > > In general it looks like the t

[PATCH] D124221: Add new builtin __builtin_reflect_struct.

2022-04-25 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Thank you for inviting me to a discussion on this topic. I have something very confusing as follows: - If the developer already knows all fields info in some struct, wyh doesn't he write a simple function to do the printing(like: print_struct_foo(const struct foo *); )

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-26 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122920#3472379 , @asoffer wrote: > In D122920#3471865 , @yihanaa wrote: > >> In D122920#3471654 , @erichkeane >> wrote: >> >>> @yihanaa : I'd

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-26 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. In D122920#3472379 , @asoffer wrote: > In D122920#3471865 , @yihanaa wrote: > >> In D122920#3471654 , @erichkeane >> wrote: >> >>> @yihanaa : I'd

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-27 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. > While we'd usually be happy to take the fix-in-hand and apply it, part of the > discussion on the other thread is whether to remove `__builtin_dump_struct` > entirely. Because of that, I don't think we should make substantial changes > in this area until it's clear we

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-28 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa updated this revision to Diff 425861. yihanaa added a comment. Add the newline back to the end of the test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122920/new/ https://reviews.llvm.org/D122920 Files: clang/lib/CodeGen/CGBuiltin.cpp

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-28 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa marked an inline comment as done. yihanaa added a comment. Thanks for review @erichkeane and @aaron.ballman , I have add a newline back to the end of the test, and waiting for ci Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122920/new/

[PATCH] D122920: [Clang][CodeGen]Fix __builtin_dump_struct missing record type field name

2022-04-28 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Thank you all commit in eaca933c59fd61b3df4697b5fae0eeec67acfaeb Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122920/new/ https://reviews.llvm.org/D122

[PATCH] D124221: Reimplement `__builtin_dump_struct` in Sema.

2022-05-02 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:427 +llvm::SmallString<32> Indent; +Indent.resize(Depth * 4, ' '); +return getStringLiteral(Indent); What do you think of PrintingPolicy.Indentation here? Co

[PATCH] D124221: Reimplement `__builtin_dump_struct` in Sema.

2022-05-02 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/docs/ReleaseNotes.rst:174 - Improve the dump format, dump both bitwidth(if its a bitfield) and field value. - - Remove anonymous tag locations. - - Beautify dump format, add indent for nested struct and struct members. + - R

[PATCH] D124221: Reimplement `__builtin_dump_struct` in Sema.

2022-05-02 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. This implementation looks good to me😁 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124221/new/ https://reviews.llvm.org/D124221 ___ cfe-commits mailing list cfe-commits@lists.ll

[PATCH] D124221: Reimplement `__builtin_dump_struct` in Sema.

2022-05-02 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:573 + // We don't know how to print this field. Print out its address + // with a format specifier that a smart tool will be able to + // recognize and treat specially. -

[PATCH] D124221: Reimplement `__builtin_dump_struct` in Sema.

2022-05-02 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added a comment. Do we need to do argument promotion here,ahh...maybe i understood wrong Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124221/new/ https://reviews.llvm.org/D124221 ___ cfe-commits

[PATCH] D124221: Reimplement `__builtin_dump_struct` in Sema.

2022-05-04 Thread Wang Yihan via Phabricator via cfe-commits
yihanaa added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:433 + + llvm::StringRef getFormatSpecifier(QualType T) { +if (auto *BT = T->getAs()) { rsmith wrote: > rsmith wrote: > > aaron.ballman wrote: > > > yihanaa wrote: > > > > I think this

  1   2   >