[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-08-24 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 553070. MitalAshok added a comment. Remove accidental unrelated changelog Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156032/new/ https://reviews.llvm.org/D156032 Files: clang/docs/ReleaseNotes.rst

[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-08-24 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 553069. MitalAshok added a comment. rebased onto fast-forwarded main branch (trying to fix seemingly unrelated CI build failure) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156032/new/

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-24 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added inline comments. Comment at: clang/test/SemaCXX/varargs.cpp:34 enum Unscoped1 { One = 0x7FFF }; - (void)__builtin_va_arg(ap, Unscoped1); // ok + (void)__builtin_va_arg(ap, Unscoped1); // expected-warning {{second argument to 'va_arg' is of promotable

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-24 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 553056. MitalAshok added a comment. clang-format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156054/new/ https://reviews.llvm.org/D156054 Files: clang/docs/ReleaseNotes.rst

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-24 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 553055. MitalAshok added a comment. enums now considered compatible with unsigned/signed versions of their underlying type for the purposes of -Wvarargs Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-23 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok marked an inline comment as not done. MitalAshok added inline comments. Comment at: clang/test/SemaCXX/varargs.cpp:34 enum Unscoped1 { One = 0x7FFF }; - (void)__builtin_va_arg(ap, Unscoped1); // ok + (void)__builtin_va_arg(ap, Unscoped1); // expected-warning

[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-08-22 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 552477. MitalAshok added a comment. Address comments; better implementation for elision (check after considering only initializer list constructors) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156032/new/

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-22 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok marked an inline comment as done. MitalAshok added inline comments. Comment at: clang/test/SemaCXX/varargs.cpp:34 enum Unscoped1 { One = 0x7FFF }; - (void)__builtin_va_arg(ap, Unscoped1); // ok + (void)__builtin_va_arg(ap, Unscoped1); // expected-warning

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-22 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 552357. MitalAshok added a comment. clang-format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156054/new/ https://reviews.llvm.org/D156054 Files: clang/docs/ReleaseNotes.rst

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-22 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 552356. MitalAshok added a comment. Use C's definition of type compatibility even in C++ mode (to not warn about enums promoted to their underlying types) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-10 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 549177. MitalAshok added a comment. clang-format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156054/new/ https://reviews.llvm.org/D156054 Files: clang/docs/ReleaseNotes.rst

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-10 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 549176. MitalAshok added a comment. Address feedback; Reuse DefaultArgumentPromotion instead of duplicating its functionality when building VaArgExpr There is the added bonus for it working with dependent types somewhat (`template __builtin_va_arg(ap,

[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-08-10 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok marked 2 inline comments as done and an inline comment as not done. MitalAshok added a comment. It seems there were two places which relied on `T x = { xvalue_of_type_T }` being a copy-initialization: The test at https://reviews.llvm.org/D156032#inline-1509544 and that one pair

[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-08-10 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 549145. MitalAshok added a comment. Herald added a project: libc++. Herald added a subscriber: libcxx-commits. Herald added a reviewer: libc++. Fix broken libc++ pair constructor test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-07 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added inline comments. Comment at: clang/test/Sema/format-pointer.c:39 + printf("%p", np); + scanf("%p", ); // expected-warning {{format specifies type 'void **' but the argument has type 'nullptr_t *'}} + scanf("%p", ); // pedantic-warning {{format specifies

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-07 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 547874. MitalAshok marked an inline comment as done. MitalAshok added a comment. Fix scanf("%p", (char**)ptr) for -Wformat-pedantic Also added more tests for %p and -Wformat Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-04 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 547353. MitalAshok added a comment. C99 7.15.1.1p2 explicitly allows a char* to be retrieved as a void* with va_arg, so the -Wformat-pedantic warning was incorrect. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-08-04 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 547311. MitalAshok added a comment. No longer warn on printf("%p", nullptr) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156054/new/ https://reviews.llvm.org/D156054 Files: clang/docs/ReleaseNotes.rst

[PATCH] D156064: [SemaCXX] Recognise initializer_list injected-class-name types as initializer_lists

2023-07-27 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 544673. MitalAshok added a comment. wording of changelog Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156064/new/ https://reviews.llvm.org/D156064 Files: clang/docs/ReleaseNotes.rst

[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-07-25 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 544078. MitalAshok added a comment. Target clang 18 instead; add entry to release notes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156032/new/ https://reviews.llvm.org/D156032 Files:

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-07-25 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 544073. MitalAshok added a comment. Target clang 18 instead Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156054/new/ https://reviews.llvm.org/D156054 Files: clang/docs/ReleaseNotes.rst

[PATCH] D154838: [analyzer] Add check for null pointer passed to %p of printf family

2023-07-25 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added a comment. Instead of checking for hard-coded names, you can check functions with the format(printf, x, y) attribute: if (auto *Format = FD->getAttr()) CheckPrintfPointerConversionSpecifierNULL(C, CE,

[PATCH] D156064: [SemaCXX] Recognise initializer_list injected-class-name types as initializer_lists

2023-07-25 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 544046. MitalAshok added a comment. Rebase changelog to clang 18, add more tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156064/new/ https://reviews.llvm.org/D156064 Files:

[PATCH] D154951: [clang][Interp] __builtin_bit_cast, Take 2

2023-07-25 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added inline comments. Comment at: clang/lib/AST/Interp/Boolean.h:113 + static Boolean bitcastFromMemory(const std::byte *Buff) { +bool Val = static_cast(*Buff); +return Boolean(Val); Does this handle padding bits correctly? E.g.,

[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-07-24 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 543699. MitalAshok added a comment. Add CWG2311 fix too Too much code and tests rely on elision of `T{ T_prvalue }` in C++17, so add change to allow that to be elided when this does not pick a initializer-list constructor. Repository: rG LLVM Github

[PATCH] D156064: [SemaCXX] Recognise initializer_list injected-class-name types as initializer_lists

2023-07-24 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 543697. MitalAshok added a comment. Remove now unneeded FIXME Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156064/new/ https://reviews.llvm.org/D156064 Files: clang/docs/ReleaseNotes.rst

[PATCH] D156063: [Clang] Reject programs declaring namespace std to be inline

2023-07-24 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok accepted this revision. MitalAshok added a comment. This revision is now accepted and ready to land. Looks good! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156063/new/ https://reviews.llvm.org/D156063 ___ cfe-commits mailing

[PATCH] D156063: [Clang] Reject programs declaring namespace std to be inline

2023-07-24 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok requested changes to this revision. MitalAshok added a comment. This revision now requires changes to proceed. This does currently break `namespace foo { inline namespace std {} }`, `namespace foo::inline std {}`, etc. Comment at:

[PATCH] D155776: [NFC] Add checks for self-assignment.

2023-07-24 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added a comment. This doesn't compile, could you fix this or revert 8ac137acefc01caf636db5f95eb0977c97def1ba ? Comment at: clang/lib/AST/APValue.cpp:393 APValue ::operator=(APValue &) { - if

[PATCH] D156064: [SemaCXX] Recognise initializer_list injected-class-name types as initializer_lists

2023-07-23 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok created this revision. Herald added a project: All. MitalAshok added reviewers: EricWF, CornedBee, erichkeane. MitalAshok published this revision for review. MitalAshok added a comment. Herald added a project: clang. Herald added a subscriber: cfe-commits. The implicitly-generated

[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-07-23 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:4249-4250 InitializedEntity::EK_LambdaToBlockConversionBlockElement && - UnwrappedArgs.size() == 1 && UnwrappedArgs[0]->isPRValue() && -

[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-07-23 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added inline comments. Comment at: clang/test/CXX/drs/dr14xx.cpp:433 -S s1; -S s2 = {s1}; // ok, not list-initialization so we pick the non-explicit constructor - } This relies on the old wording. "If T is a class type and the initializer

[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-07-23 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 543301. MitalAshok edited the summary of this revision. MitalAshok added a comment. Removing "SelfInitIsNotListInit" test case: copy-list-init for non-aggregate classes remains as copy-list-inits, only aggregates copies are converted into copy-inits

[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

2023-07-23 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok created this revision. Herald added a project: All. MitalAshok added a comment. MitalAshok added a reviewer: aaron.ballman. MitalAshok published this revision for review. Herald added subscribers: cfe-commits, wangpc. Herald added a project: clang. There is one observable difference by

[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

2023-07-22 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok created this revision. Herald added a project: All. MitalAshok updated this revision to Diff 543217. MitalAshok added a comment. MitalAshok edited the summary of this revision. MitalAshok added a reviewer: rsmith. MitalAshok published this revision for review. Herald added a project:

[PATCH] D154716: [SemaCXX] Fix bug where unexpanded lambda captures where assumed to be expanded

2023-07-22 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok marked an inline comment as done. MitalAshok added inline comments. Comment at: clang/lib/Sema/TreeTransform.h:13323 // If this is an init-capture pack, consider expanding the pack now. if (OldVD->isParameterPack()) { shafik wrote: > Based

[PATCH] D154716: [SemaCXX] Fix bug where unexpanded lambda captures where assumed to be expanded

2023-07-22 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 543183. MitalAshok edited the summary of this revision. MitalAshok added a comment. Added entry to changelog and the test from the bug report Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154716/new/

[PATCH] D154716: [SemaCXX] Fix bug where unexpanded lambda captures where assumed to be expanded

2023-07-07 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok created this revision. Herald added a project: All. MitalAshok edited the summary of this revision. MitalAshok added reviewers: rsmith, cor3ntin. MitalAshok published this revision for review. Herald added a project: clang. Herald added a subscriber: cfe-commits. When instantiating the

[PATCH] D154301: Fix aggregate CTAD with string literals adding extra const

2023-07-02 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 536648. MitalAshok edited the summary of this revision. MitalAshok added a comment. Add status for CWG2681 and fixed aggregate-deduction-candidate test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D154301: Fix aggregate CTAD with string literals adding extra const

2023-07-02 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok created this revision. Herald added a project: All. MitalAshok edited the summary of this revision. MitalAshok added reviewers: ychen, aaron.ballman, cor3ntin. MitalAshok added a subscriber: cfe-commits. MitalAshok retitled this revision from "Fix CTAD with string literals adding extra

[PATCH] D126937: Fix memleak in VarTemplateSpecializationDecl

2022-06-02 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok planned changes to this revision. MitalAshok added a comment. Appears that more things need to be changed, I'll get that done soon Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126937/new/ https://reviews.llvm.org/D126937

[PATCH] D126937: Fix memleak in VarTemplateSpecializationDecl

2022-06-02 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added inline comments. Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5561 Var = cast_or_null(Instantiator.VisitVarTemplateSpecializationDecl( VarSpec->getSpecializedTemplate(), Def, VarSpec->getTemplateArgsInfo(),

[PATCH] D126937: Fix memleak in VarTemplateSpecializationDecl

2022-06-02 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok created this revision. Herald added a project: All. MitalAshok added reviewers: akyrtzi, aaron.ballman, erichkeane, browneee. MitalAshok published this revision for review. MitalAshok added a project: LLVM. MitalAshok added a comment. Herald added a project: clang. Herald added a

[PATCH] D125802: Fix std::has_unique_object_representations for _BitInt types with padding bits

2022-05-28 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added a comment. @aaron.ballman yes, with the author "Mital Ashok ". (replacing the [AT]) Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125802/new/ https://reviews.llvm.org/D125802

[PATCH] D125802: Fix std::has_unique_object_representations for _BitInt types with padding bits

2022-05-28 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 432699. MitalAshok added a comment. Rebase release notes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125802/new/ https://reviews.llvm.org/D125802 Files: clang/docs/ReleaseNotes.rst

[PATCH] D125802: Fix std::has_unique_object_representations for _BitInt types with padding bits

2022-05-18 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 430373. MitalAshok added a comment. Removed useless isReferenceType check Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125802/new/ https://reviews.llvm.org/D125802 Files: clang/docs/ReleaseNotes.rst

[PATCH] D125802: Fix std::has_unique_object_representations for _BitInt types with padding bits

2022-05-17 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 430186. MitalAshok edited the summary of this revision. MitalAshok added a comment. Added release note and missing test for struct with reference member Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D125802: Fix std::has_unique_object_representations for _BitInt types with padding bits

2022-05-17 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added inline comments. Comment at: clang/lib/AST/ASTContext.cpp:2697 int64_t FieldSizeInBits = Context.toBits(Context.getTypeSizeInChars(Field->getType())); if (Field->isBitField()) { erichkeane wrote: > This answer ends up being wrong in

[PATCH] D125802: Fix std::has_unique_object_representations for _BitInt types with padding bits

2022-05-17 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok created this revision. Herald added a project: All. MitalAshok retitled this revision from "Fix std::has_unique_object_representations for _BitInt types with padding" to "Fix std::has_unique_object_representations for _BitInt types with padding bits". MitalAshok edited the summary of