Skip to content

Commit

Permalink
[Bounds-Safety][NFC] Clean up leading space emission for CountAttribu…
Browse files Browse the repository at this point in the history
…tedType (#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.
  • Loading branch information
delcypher authored Apr 3, 2024
1 parent 66fed33 commit 5e3da75
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions clang/lib/AST/TypePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 << ')';
Expand Down

0 comments on commit 5e3da75

Please sign in to comment.