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" type trait names? It seems to 
me that if you replaced this function body with `return true;`, the diagnostic 
would automatically be able to handle cases such as

    static_assert(std::is_trivially_move_constructible<T>::value);  // not a 
builtin
    static_assert(folly::IsRelocatable<T>::value);  // not in namespace std

What would go wrong if you replaced this entire function body with `return 
true;`?


================
Comment at: lib/Sema/SemaTemplate.cpp:3109
+    // This might be `std::some_type_trait<U,V>::value`.
+    if (Var && Var->isStaticDataMember() && Var->getName() == "value" &&
+        prettyPrintTypeTrait(DR->getQualifier(), OS, PrintPolicy)) {
----------------
Again, why do you bother to check this? I would not expect the compiler to 
treat differently

    struct Trait { static constexpr bool value = true; }; 
static_assert(Trait::value);
    struct Trait { static constexpr bool wodget = true; }; 
static_assert(Trait::wodget);



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.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to