[PATCH] D135341: adds `__reference_constructs_from_temporary`

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 12 00:42:35 PDT 2023


cor3ntin added inline comments.


================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:33
 #include "clang/Basic/TypeTraits.h"
+#include "clang/Basic/TokenKinds.h"
 #include "clang/Lex/Preprocessor.h"
----------------
Superfluous change


================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:5513
+
+      QualType TPtr = S.BuiltinAddPointer(S.BuiltinRemoveReference(T, UnaryTransformType::RemoveCVRef, {}), {});
+      QualType UPtr = S.BuiltinAddPointer(S.BuiltinRemoveReference(U, UnaryTransformType::RemoveCVRef, {}), {});
----------------
`BuiltinRemoveReference` is nice here as I don't think we have a way to remove all cv and ref in one go at the ASTContext/QualType level.
However `BuiltinAddPointer` does nothing for us over `Context.getPointerType()`, so I'd rather we used that.


================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:5515
+      QualType UPtr = S.BuiltinAddPointer(S.BuiltinRemoveReference(U, UnaryTransformType::RemoveCVRef, {}), {});
+      return EvaluateBinaryTypeTrait(S, TypeTrait::BTT_IsConvertibleTo, UPtr, TPtr, RParenLoc);
     }
----------------
Could you put the implementation of `BTT_IsConvertibleTo` in its own function?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135341/new/

https://reviews.llvm.org/D135341



More information about the cfe-commits mailing list