Skip to content

Commit 0e08374

Browse files
committed
[clang][NFC] Add a notice to desugarForDiagnostic
`desugarForDiagnostic` only sets ShouldAKA to true if desugaring happens, otherwise ShouldAKA is left intact and might be uninitialized. Victims (including me): llvm/llvm-project@25bf8cb llvm/llvm-project@0e8384a Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D152880
1 parent c42e7b8 commit 0e08374

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/include/clang/AST/ASTDiagnostic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ namespace clang {
3434
ArrayRef<intptr_t> QualTypeVals);
3535

3636
/// Returns a desugared version of the QualType, and marks ShouldAKA as true
37-
/// whenever we remove significant sugar from the type.
37+
/// whenever we remove significant sugar from the type. Make sure ShouldAKA
38+
/// is initialized before passing it in.
3839
QualType desugarForDiagnostic(ASTContext &Context, QualType QT,
3940
bool &ShouldAKA);
4041
} // end namespace clang

clang/lib/AST/ASTDiagnostic.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
using namespace clang;
2626

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

0 commit comments

Comments
 (0)