-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[Clang][NFC] remove getUnqualifiedType() when it's already unqualified #172504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rosefromthedead
wants to merge
1
commit into
llvm:main
Choose a base branch
from
rosefromthedead:gctu-review
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+9
−17
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since 8c49509, getCanonicalTypeUnqualified() calls getUnqualifiedType(), so there's no point in calling that again on its return value.
Contributor
Author
Member
|
@llvm/pr-subscribers-clangir @llvm/pr-subscribers-clang Author: Rose Hudson (rosefromthedead) ChangesSince 8c49509, getCanonicalTypeUnqualified() calls getUnqualifiedType(), so there's no point in calling that again on its return value. Full diff: https://github.com/llvm/llvm-project/pull/172504.diff 4 Files Affected:
diff --git a/clang/lib/Analysis/FlowSensitive/SmartPointerAccessorCaching.cpp b/clang/lib/Analysis/FlowSensitive/SmartPointerAccessorCaching.cpp
index d87b2e6f03857..5642abeb78ba0 100644
--- a/clang/lib/Analysis/FlowSensitive/SmartPointerAccessorCaching.cpp
+++ b/clang/lib/Analysis/FlowSensitive/SmartPointerAccessorCaching.cpp
@@ -26,18 +26,14 @@ using ast_matchers::returns;
CanQualType getLikeReturnType(QualType RT) {
if (!RT.isNull() && RT->isPointerType()) {
- return RT->getPointeeType()
- ->getCanonicalTypeUnqualified()
- .getUnqualifiedType();
+ return RT->getPointeeType()->getCanonicalTypeUnqualified();
}
return {};
}
CanQualType valueLikeReturnType(QualType RT) {
if (!RT.isNull() && RT->isReferenceType()) {
- return RT.getNonReferenceType()
- ->getCanonicalTypeUnqualified()
- .getUnqualifiedType();
+ return RT.getNonReferenceType()->getCanonicalTypeUnqualified();
}
return {};
}
diff --git a/clang/lib/CIR/CodeGen/CIRGenCall.cpp b/clang/lib/CIR/CodeGen/CIRGenCall.cpp
index 17f0c6dbab35c..f00cd33a0f27d 100644
--- a/clang/lib/CIR/CodeGen/CIRGenCall.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenCall.cpp
@@ -317,9 +317,7 @@ arrangeFreeFunctionLikeCall(CIRGenTypes &cgt, CIRGenModule &cgm,
for (const CallArg &arg : args)
argTypes.push_back(cgt.getASTContext().getCanonicalParamType(arg.ty));
- CanQualType retType = fnType->getReturnType()
- ->getCanonicalTypeUnqualified()
- .getUnqualifiedType();
+ CanQualType retType = fnType->getReturnType()->getCanonicalTypeUnqualified();
assert(!cir::MissingFeatures::opCallFnInfoOpts());
return cgt.arrangeCIRFunctionInfo(retType, argTypes, required);
@@ -381,10 +379,9 @@ const CIRGenFunctionInfo &CIRGenTypes::arrangeCXXMethodCall(
argTypes.push_back(astContext.getCanonicalParamType(arg.ty));
assert(!cir::MissingFeatures::opCallFnInfoOpts());
- return arrangeCIRFunctionInfo(proto->getReturnType()
- ->getCanonicalTypeUnqualified()
- .getUnqualifiedType(),
- argTypes, required);
+ return arrangeCIRFunctionInfo(
+ proto->getReturnType()->getCanonicalTypeUnqualified(), argTypes,
+ required);
}
const CIRGenFunctionInfo &
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 4a9025b6e0b0f..d7bdeb3981cf8 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -150,7 +150,7 @@ static CanQual<FunctionProtoType> GetFormalType(const CXXMethodDecl *MD) {
/// and it makes ABI code a little easier to be able to assume that
/// all parameter and return types are top-level unqualified.
static CanQualType GetReturnType(QualType RetTy) {
- return RetTy->getCanonicalTypeUnqualified().getUnqualifiedType();
+ return RetTy->getCanonicalTypeUnqualified();
}
/// Arrange the argument and result information for a value of the given
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 001d15a51a58e..4a9340965c645 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -6170,7 +6170,7 @@ struct CheckAbstractUsage {
Sel = Sema::AbstractArrayType;
T = Info.S.Context.getBaseElementType(T);
}
- CanQualType CT = T->getCanonicalTypeUnqualified().getUnqualifiedType();
+ CanQualType CT = T->getCanonicalTypeUnqualified();
if (CT != Info.AbstractType) return;
// It matched; do some magic.
@@ -13008,8 +13008,7 @@ static CXXBaseSpecifier *findDirectBaseWithType(CXXRecordDecl *Derived,
QualType DesiredBase,
bool &AnyDependentBases) {
// Check whether the named type is a direct base class.
- CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified()
- .getUnqualifiedType();
+ CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified();
for (auto &Base : Derived->bases()) {
CanQualType BaseType = Base.getType()->getCanonicalTypeUnqualified();
if (CanonicalDesiredBase == BaseType)
|
cor3ntin
approved these changes
Dec 16, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:analysis
clang:codegen
IR generation bugs: mangling, exceptions, etc.
clang:dataflow
Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
clang
Clang issues not falling into any other category
ClangIR
Anything related to the ClangIR project
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since 8c49509, getCanonicalTypeUnqualified() calls getUnqualifiedType(), so there's no point in calling that again on its return value.