================ @@ -1277,14 +1277,75 @@ void CodeGenFunction::EmitAllocTokenHint(llvm::CallBase *CB, assert(SanOpts.has(SanitizerKind::AllocToken) && "Only needed with -fsanitize=alloc-token"); + llvm::MDBuilder MDB(getLLVMContext()); + + // Get unique type name. PrintingPolicy Policy(CGM.getContext().getLangOpts()); Policy.SuppressTagKeyword = true; Policy.FullyQualifiedName = true; std::string TypeName = AllocType.getCanonicalType().getAsString(Policy); - auto *TypeMDS = llvm::MDString::get(CGM.getLLVMContext(), TypeName); + auto *TypeNameMD = MDB.createString(TypeName); + + // Check if QualType contains a pointer. Implements a simple DFS to + // recursively check if a type contains a pointer type. + llvm::SmallPtrSet<const RecordDecl *, 4> VisitedRD; + bool IncompleteType = false; + auto TypeContainsPtr = [&](auto &&self, QualType T) -> bool { ---------------- fmayer wrote:
why don't we pull this into a helper? That would also avoid the clumsy self-reference https://github.com/llvm/llvm-project/pull/156840 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits