summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Liew <delcypher@gmail.com>2024-04-03 16:28:54 -0700
committerGitHub <noreply@github.com>2024-04-03 16:28:54 -0700
commit5e3da75c80db749b3000c4a9e930da4784bcfc6f (patch)
tree494355aa99f013b5f3efb77e2ef494f0890f33d9
parent66fed33db014bd705433e4b4f1ea766a8d71cadf (diff)
[Bounds-Safety][NFC] Clean up leading space emission for CountAttributedType (#87582)
Previously the leading space was added in each string constant. This patch moves the leading space out of the string constants and is instead explicitly added to add clarity to the code.
-rw-r--r--clang/lib/AST/TypePrinter.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp
index 9d551ff83151..d0771eb55e27 100644
--- a/clang/lib/AST/TypePrinter.cpp
+++ b/clang/lib/AST/TypePrinter.cpp
@@ -1746,14 +1746,15 @@ void TypePrinter::printPackExpansionAfter(const PackExpansionType *T,
static void printCountAttributedImpl(const CountAttributedType *T,
raw_ostream &OS,
const PrintingPolicy &Policy) {
+ OS << ' ';
if (T->isCountInBytes() && T->isOrNull())
- OS << " __sized_by_or_null(";
+ OS << "__sized_by_or_null(";
else if (T->isCountInBytes())
- OS << " __sized_by(";
+ OS << "__sized_by(";
else if (T->isOrNull())
- OS << " __counted_by_or_null(";
+ OS << "__counted_by_or_null(";
else
- OS << " __counted_by(";
+ OS << "__counted_by(";
if (T->getCountExpr())
T->getCountExpr()->printPretty(OS, nullptr, Policy);
OS << ')';