[clang] [clang][Index] Use canonical function parameter types in USRs (PR #68222)
Krystian Stasiowski via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 15 12:53:56 PDT 2024
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/68222
>From 8022677bd92d4074ccaebda687f43066ce33d152 Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski <sdkrystian at gmail.com>
Date: Wed, 4 Oct 2023 10:06:28 -0400
Subject: [PATCH] [clang][Index] Use canonical function parameter types in USRs
---
clang/lib/Index/USRGeneration.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/lib/Index/USRGeneration.cpp
index 5acc86191f8f9c..31c4a3345c09d1 100644
--- a/clang/lib/Index/USRGeneration.cpp
+++ b/clang/lib/Index/USRGeneration.cpp
@@ -267,10 +267,13 @@ void USRGenerator::VisitFunctionDecl(const FunctionDecl *D) {
Out << '>';
}
+ QualType CanonicalType = D->getType().getCanonicalType();
// Mangle in type information for the arguments.
- for (auto *PD : D->parameters()) {
- Out << '#';
- VisitType(PD->getType());
+ if (const auto *FPT = CanonicalType->getAs<FunctionProtoType>()) {
+ for (QualType PT : FPT->param_types()) {
+ Out << '#';
+ VisitType(PT);
+ }
}
if (D->isVariadic())
Out << '.';
More information about the cfe-commits
mailing list