summaryrefslogtreecommitdiff
path: root/clang/lib/AST/FormatString.cpp
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-09-10 15:25:31 -0700
committerGitHub <noreply@github.com>2025-09-10 15:25:31 -0700
commit1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch)
tree57f4b1f313c8cf74eed8819870f39c36ea263c68 /clang/lib/AST/FormatString.cpp
parent898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff)
parentb8cefcb601ddaa18482555c4ff363c01a270c2fe (diff)
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'clang/lib/AST/FormatString.cpp')
-rw-r--r--clang/lib/AST/FormatString.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/AST/FormatString.cpp b/clang/lib/AST/FormatString.cpp
index 502a3e6b145e..d4cb89b43ae8 100644
--- a/clang/lib/AST/FormatString.cpp
+++ b/clang/lib/AST/FormatString.cpp
@@ -413,14 +413,13 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const {
return Match;
case AnyCharTy: {
- if (const auto *ETy = argTy->getAs<EnumType>()) {
+ if (const auto *ED = argTy->getAsEnumDecl()) {
// If the enum is incomplete we know nothing about the underlying type.
// Assume that it's 'int'. Do not use the underlying type for a scoped
// enumeration.
- const EnumDecl *ED = ETy->getOriginalDecl()->getDefinitionOrSelf();
if (!ED->isComplete())
return NoMatch;
- if (ETy->isUnscopedEnumerationType())
+ if (!ED->isScoped())
argTy = ED->getIntegerType();
}
@@ -463,14 +462,13 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const {
return matchesSizeTPtrdiffT(C, argTy, T);
}
- if (const EnumType *ETy = argTy->getAs<EnumType>()) {
+ if (const auto *ED = argTy->getAsEnumDecl()) {
// If the enum is incomplete we know nothing about the underlying type.
// Assume that it's 'int'. Do not use the underlying type for a scoped
// enumeration as that needs an exact match.
- const EnumDecl *ED = ETy->getOriginalDecl()->getDefinitionOrSelf();
if (!ED->isComplete())
argTy = C.IntTy;
- else if (ETy->isUnscopedEnumerationType())
+ else if (!ED->isScoped())
argTy = ED->getIntegerType();
}
@@ -655,7 +653,7 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const {
// to Objective-C objects. Since the compiler doesn't know which
// structs can be toll-free bridged, we just accept them all.
QualType pointee = PT->getPointeeType();
- if (pointee->getAsStructureType() || pointee->isVoidType())
+ if (pointee->isStructureType() || pointee->isVoidType())
return Match;
}
return NoMatch;