[llvm-branch-commits] [Clang] Refactor allocation type inference logic (PR #163636)
Marco Elver via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Oct 18 01:50:48 PDT 2025
================
@@ -148,21 +150,19 @@ QualType inferPossibleTypeFromVarInitSizeofExpr(const Expr *E) {
///
/// MyType *x = (MyType *)malloc(4096); // infers 'MyType'
///
-QualType inferPossibleTypeFromCastExpr(const CallExpr *CallE,
- const CastExpr *CastE) {
+static QualType inferPossibleTypeFromCastExpr(const CallExpr *CallE,
+ const CastExpr *CastE) {
if (!CastE)
return QualType();
QualType PtrType = CastE->getType();
if (PtrType->isPointerType())
return PtrType->getPointeeType();
return QualType();
}
-} // anonymous namespace
-
-namespace infer_alloc {
-QualType inferPossibleType(const CallExpr *E, const ASTContext &Ctx,
- const CastExpr *CastE) {
+QualType clang::infer_alloc::inferPossibleType(const CallExpr *E,
----------------
melver wrote:
Thought that's what https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions is trying to tell me - but I guess I can drop the clang:: here.
https://github.com/llvm/llvm-project/pull/163636
More information about the llvm-branch-commits
mailing list