[PATCH] D29930: Add `__reference_binds_to_temporary` trait for checking safe reference initialization.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 11 15:22:58 PST 2018


rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Please also document this trait in docs/LanguageExtensions.rst.



================
Comment at: include/clang/Basic/TypeTraits.h:91
+/// \brief Names for the array type traits.
+enum ArrayTypeTrait { ATT_ArrayRank, ATT_ArrayExtent };
 
----------------
Looks like you reformatted (and reindented) this whole file. If you meant to do that, please commit it as a separate change.


================
Comment at: lib/Parse/ParseDeclCXX.cpp:1407-1432
+  if (TagType == DeclSpec::TST_struct && Tok.isNot(tok::identifier) &&
+      !Tok.isAnnotation() && Tok.getIdentifierInfo() &&
+      Tok.isOneOf(
+          tok::kw___is_abstract, tok::kw___is_aggregate,
+          tok::kw___is_arithmetic, tok::kw___is_array, tok::kw___is_assignable,
+          tok::kw___is_base_of, tok::kw___is_class, tok::kw___is_complete_type,
+          tok::kw___is_compound, tok::kw___is_const, tok::kw___is_constructible,
----------------
This list should only contain keywords that libstdc++ or libc++ has at one point defined as class templates; your trait should not be added here.


================
Comment at: lib/Parse/ParseExpr.cpp:903
           REVERTIBLE_TYPE_TRAIT(__is_volatile);
+          REVERTIBLE_TYPE_TRAIT(__reference_binds_to_temporary);
 #undef REVERTIBLE_TYPE_TRAIT
----------------
Likewise.


https://reviews.llvm.org/D29930





More information about the cfe-commits mailing list