[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-12-04 Thread Clement Courbet via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL348239: [WIP][Sema] Improve static_assert diagnostics for type traits. (authored by courbet, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM CHANGES SINCE LAST ACTION htt

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-12-03 Thread Clement Courbet via Phabricator via cfe-commits
courbet added a comment. Thank you both for the review ! Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54903/new/ https://reviews.llvm.org/D54903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.l

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-12-03 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM! Comment at: lib/Sema/SemaTemplate.cpp:3055 +// Print a diagnostic for the failing static_assert expression. Defaults to +// pretty-printing the expressi

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-12-03 Thread Clement Courbet via Phabricator via cfe-commits
courbet marked an inline comment as done. courbet added inline comments. Comment at: lib/Sema/SemaTemplate.cpp:3055 +// Print a diagnostic for the failing static_assert expression. Defaults to +// pretty-printing the expression. aaron.ballman wrote: > courbet w

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-12-03 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: lib/Sema/SemaTemplate.cpp:3055 +// Print a diagnostic for the failing static_assert expression. Defaults to +// pretty-printing the expression. courbet wrote: > aaron.ballman wrote: > > Comment is a bit out of da

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-12-03 Thread Clement Courbet via Phabricator via cfe-commits
courbet marked an inline comment as done. courbet added inline comments. Comment at: lib/Sema/SemaTemplate.cpp:3055 +// Print a diagnostic for the failing static_assert expression. Defaults to +// pretty-printing the expression. aaron.ballman wrote: > Comment i

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-12-03 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: lib/Sema/SemaTemplate.cpp:3055 +// Print a diagnostic for the failing static_assert expression. Defaults to +// pretty-printing the expression. Comment is a bit out of date as this is no longer specific to `stati

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-12-03 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 176320. courbet added a comment. - Fix spurious formating changes - Add tests - Improve readability. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54903/new/ https://reviews.llvm.org/D54903 Files: include/clang/AST/NestedN

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-12-03 Thread Clement Courbet via Phabricator via cfe-commits
courbet marked 4 inline comments as done. courbet added inline comments. Comment at: lib/AST/NestedNameSpecifier.cpp:308-310 +if (ResolveTemplateArguments && getAsRecordDecl()) { + if (const auto *Record = + dyn_cast(getAsRecordDecl())) { aa

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-12-01 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: include/clang/AST/NestedNameSpecifier.h:220 + void print(raw_ostream &OS, const PrintingPolicy &Policy, + bool ResolveTemplateArguments = false) const; Quuxplusone wrote: > Peanut gallery says: Shoul

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-30 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added a comment. Looks fine to me; please don't let //me// block this any further. :) Someone else, e.g. @aaron.ballman, should be the one to accept it, though. Comment at: include/clang/AST/NestedNameSpecifier.h:220 + void print(raw_ostream &OS, const PrintingPol

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: lib/AST/NestedNameSpecifier.cpp:308-310 +if (ResolveTemplateArguments && getAsRecordDecl()) { + if (const auto *Record = + dyn_cast(getAsRecordDecl())) { I'd remove the `getAsRecordDecl()` fro

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-29 Thread Clement Courbet via Phabricator via cfe-commits
courbet added a comment. Thanks Comment at: lib/Sema/SemaTemplate.cpp:3064 +// If this is a qualified name, expand the template arguments in nested +// qualifiers. +DR->getQualifier()->print(OS, PrintPolicy, true); Quuxplusone wrote: > I don't under

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-29 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 175855. courbet marked 5 inline comments as done. courbet added a comment. - add more tests - handle c++17 constructs - add c++17 tests in static-assert-cxx17.cpp Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54903/new/ https

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments. Comment at: lib/Sema/SemaTemplate.cpp:3064 +// If this is a qualified name, expand the template arguments in nested +// qualifiers. +DR->getQualifier()->print(OS, PrintPolicy, true); I don't understand this code enou

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 175710. courbet marked 2 inline comments as done. courbet added a comment. expand types in all qualifiers, not only type traits. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54903/new/ https://reviews.llvm.org/D54903 Files:

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet marked 2 inline comments as done. courbet added inline comments. Comment at: lib/Sema/SemaTemplate.cpp:3061 +#define TYPE_TRAIT_N(Spelling, Name, Key) RecordName == (#Spelling + 2) || +#include "clang/Basic/TokenKinds.def" +#undef TYPE_TRAIT_1 Quuxplusone

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 175679. courbet added a comment. Replace custom printing code with clang helper. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54903/new/ https://reviews.llvm.org/D54903 Files: lib/Sema/SemaTemplate.cpp test/SemaCXX/stat

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments. Comment at: lib/Sema/SemaTemplate.cpp:3061 +#define TYPE_TRAIT_N(Spelling, Name, Key) RecordName == (#Spelling + 2) || +#include "clang/Basic/TokenKinds.def" +#undef TYPE_TRAIT_1 Why do you bother to check a whitelist of "known"

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 175673. courbet added a comment. Add unit test with dependent types. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54903/new/ https://reviews.llvm.org/D54903 Files: lib/Sema/SemaTemplate.cpp test/SemaCXX/static-assert.cp

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet marked an inline comment as done. courbet added inline comments. Comment at: test/SemaCXX/static-assert.cpp:111 +static_assert(std::is_same::value, "message"); // expected-error{{static_assert failed due to requirement 'std::is_same::value' "message"}} +static_assert(st

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments. Comment at: test/SemaCXX/static-assert.cpp:111 +static_assert(std::is_same::value, "message"); // expected-error{{static_assert failed due to requirement 'std::is_same::value' "message"}} +static_assert(std::is_const::value, "message");

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 175669. courbet added a comment. fix variable name in comment Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54903/new/ https://reviews.llvm.org/D54903 Files: lib/Sema/SemaTemplate.cpp test/SemaCXX/static-assert.cpp Inde

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet added inline comments. Comment at: lib/Sema/SemaTemplate.cpp:3076 +return false; + const RecordDecl * Record = NNS->getAsRecordDecl(); + // In namespace "::std". aaron.ballman wrote: > Formatting is incorrect here; you should run the patch through c

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 175668. courbet marked 2 inline comments as done. courbet added a comment. harden against null getAsRecordDecl(). Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54903/new/ https://reviews.llvm.org/D54903 Files: lib/Sema/Sem

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 175667. courbet added a comment. clang-formant patch Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54903/new/ https://reviews.llvm.org/D54903 Files: lib/Sema/SemaTemplate.cpp test/SemaCXX/static-assert.cpp Index: test/S

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: lib/Sema/SemaTemplate.cpp:3076 +return false; + const RecordDecl * Record = NNS->getAsRecordDecl(); + // In namespace "::std". Formatting is incorrect here; you should run the patch through clang-format. Can

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet marked an inline comment as done. courbet added a comment. Thanks for the comments. Comment at: lib/Sema/SemaTemplate.cpp:3070 +// and returns true. +static bool prettyPrintTypeTrait(const NestedNameSpecifier *const NNS, + llvm::raw_strin

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-28 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 175638. courbet marked 5 inline comments as done. courbet edited the summary of this revision. courbet added a comment. Address Aaron's comments. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54903/new/ https://reviews.llvm.o

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-27 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments. Comment at: test/SemaCXX/static-assert.cpp:111 +static_assert(std::is_same::value, "message"); // expected-error{{static_assert failed due to requirement 'std::is_same::value' "message"}} +static_assert(std::is_const::value, "message");

[PATCH] D54903: [Sema] Improve static_assert diagnostics.

2018-11-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: lib/Sema/SemaTemplate.cpp:3070 +// and returns true. +static bool prettyPrintTypeTrait(const NestedNameSpecifier *const NNS, + llvm::raw_string_ostream &OS, No need for the pointer i