[clang] 7508438 - [BoundsSafety] Minor fixes on counted_by (#87559)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 3 16:35:14 PDT 2024
Author: Yeoul Na
Date: 2024-04-03T16:35:11-07:00
New Revision: 750843875254b1d493f4d7c3d3921c1bced55b7c
URL: https://github.com/llvm/llvm-project/commit/750843875254b1d493f4d7c3d3921c1bced55b7c
DIFF: https://github.com/llvm/llvm-project/commit/750843875254b1d493f4d7c3d3921c1bced55b7c.diff
LOG: [BoundsSafety] Minor fixes on counted_by (#87559)
DeclRef to field must be marked as LValue to be consistent with how the
field decl will be evaluated.
T->desugar() is unnecessary to call ->isArrayType().
Added:
Modified:
clang/lib/AST/TypePrinter.cpp
clang/lib/Sema/SemaExpr.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp
index d0771eb55e2785..075c8aba11fcb9 100644
--- a/clang/lib/AST/TypePrinter.cpp
+++ b/clang/lib/AST/TypePrinter.cpp
@@ -1763,14 +1763,14 @@ static void printCountAttributedImpl(const CountAttributedType *T,
void TypePrinter::printCountAttributedBefore(const CountAttributedType *T,
raw_ostream &OS) {
printBefore(T->desugar(), OS);
- if (!T->desugar()->isArrayType())
+ if (!T->isArrayType())
printCountAttributedImpl(T, OS, Policy);
}
void TypePrinter::printCountAttributedAfter(const CountAttributedType *T,
raw_ostream &OS) {
printAfter(T->desugar(), OS);
- if (T->desugar()->isArrayType())
+ if (T->isArrayType())
printCountAttributedImpl(T, OS, Policy);
}
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 80b4257d9d83ed..6b2eb245d58263 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -2751,7 +2751,7 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
QualType type = VD->getType().getNonReferenceType();
// This will eventually be translated into MemberExpr upon
// the use of instantiated struct fields.
- return BuildDeclRefExpr(VD, type, VK_PRValue, NameLoc);
+ return BuildDeclRefExpr(VD, type, VK_LValue, NameLoc);
}
}
}
More information about the cfe-commits
mailing list