aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorVlad Serebrennikov <serebrennikov.vladislav@gmail.com>2023-11-02 16:17:17 +0400
committerGitHub <noreply@github.com>2023-11-02 16:17:17 +0400
commit98da18344eed96cabfd2214131185686b1983412 (patch)
treed19a83db518432c2cb65772c76e806ed386166a4 /clang/lib
parent43e13fdc9e8edd425f640c424071377879c07822 (diff)
downloadllvm-98da18344eed96cabfd2214131185686b1983412.zip
llvm-98da18344eed96cabfd2214131185686b1983412.tar.gz
llvm-98da18344eed96cabfd2214131185686b1983412.tar.bz2
[clang] Remove diagnostic that came with `[[clang::preferred_type]]` (#70632)
https://github.com/llvm/llvm-project/pull/69104 introduce a diagnostic that checked underlying type of an enum against type of bit-field that is annotated with `[[clang::preferred_type]]`. When I tried to introduce this annotation in https://github.com/llvm/llvm-project/pull/70349, it turned out to be too chatty, despite effort to avoid that.
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp22
1 files changed, 0 insertions, 22 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 5e43f66..842a01a 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -5928,28 +5928,6 @@ static void handlePreferredTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
S.RequireCompleteType(ParmTSI->getTypeLoc().getBeginLoc(), QT,
diag::err_incomplete_type);
- if (QT->isEnumeralType()) {
- auto IsCorrespondingType = [&](QualType LHS, QualType RHS) {
- assert(LHS != RHS);
- if (LHS->isSignedIntegerType())
- return LHS == S.getASTContext().getCorrespondingSignedType(RHS);
- return LHS == S.getASTContext().getCorrespondingUnsignedType(RHS);
- };
- QualType BitfieldType =
- cast<FieldDecl>(D)->getType()->getCanonicalTypeUnqualified();
- QualType EnumUnderlyingType = QT->getAs<EnumType>()
- ->getDecl()
- ->getIntegerType()
- ->getCanonicalTypeUnqualified();
- if (EnumUnderlyingType != BitfieldType &&
- !IsCorrespondingType(EnumUnderlyingType, BitfieldType)) {
- S.Diag(ParmTSI->getTypeLoc().getBeginLoc(),
- diag::warn_attribute_underlying_type_mismatch)
- << EnumUnderlyingType << QT << BitfieldType;
- return;
- }
- }
-
D->addAttr(::new (S.Context) PreferredTypeAttr(S.Context, AL, ParmTSI));
}