[clang] [llvm] [HLSL] Implement '__builtin_hlsl_is_intangible' type trait (PR #104544)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 13:19:46 PDT 2024


================
@@ -64,6 +64,10 @@ class SemaHLSL : public SemaBase {
 
   // HLSL Type trait implementations
   bool IsScalarizedLayoutCompatible(QualType T1, QualType T2) const;
+  bool IsIntangibleType(const QualType T1);
+
+private:
+  llvm::DenseMap<const Type *, bool> IsIntangibleTypeCache;
----------------
llvm-beanz wrote:

This is an odd way to cache the result. Generally other similar things get cached on the RecordDecl (see: https://github.com/llvm/llvm-project/blob/66927fb95abef9327b453d7213c5df7d641269be/clang/include/clang/AST/DeclBase.h#L1620), and for non-Record objects it is fast to re-compute. That should be way faster and less memory intensive than storing a `DenseMap`.

https://github.com/llvm/llvm-project/pull/104544


More information about the cfe-commits mailing list