Skip to content

Commit

Permalink
[clang][NFC] Add a notice to desugarForDiagnostic
Browse files Browse the repository at this point in the history
`desugarForDiagnostic` only sets ShouldAKA to true if desugaring
happens, otherwise ShouldAKA is left intact and might be uninitialized.

Victims (including me):

25bf8cb

0e8384a

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D152880
  • Loading branch information
zyn0217 committed Jun 15, 2023
1 parent c42e7b8 commit 0e08374
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion clang/include/clang/AST/ASTDiagnostic.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ namespace clang {
ArrayRef<intptr_t> QualTypeVals);

/// Returns a desugared version of the QualType, and marks ShouldAKA as true
/// whenever we remove significant sugar from the type.
/// whenever we remove significant sugar from the type. Make sure ShouldAKA
/// is initialized before passing it in.
QualType desugarForDiagnostic(ASTContext &Context, QualType QT,
bool &ShouldAKA);
} // end namespace clang
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/AST/ASTDiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
using namespace clang;

// Returns a desugared version of the QualType, and marks ShouldAKA as true
// whenever we remove significant sugar from the type.
// whenever we remove significant sugar from the type. Make sure ShouldAKA
// is initialized before passing it in.
QualType clang::desugarForDiagnostic(ASTContext &Context, QualType QT,
bool &ShouldAKA) {
QualifierCollector QC;
Expand Down

0 comments on commit 0e08374

Please sign in to comment.