[PATCH] D152880: [clang][NFC] Add a notice to desugarForDiagnostic
Younan Zhang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 13 19:14:30 PDT 2023
zyounan created this revision.
Herald added a project: All.
zyounan added reviewers: aaron.ballman, lh123.
zyounan published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
`desugarForDiagnostic` only sets ShouldAKA to true if desugaring
happens, otherwise ShouldAKA is left intact and might be uninitialized.
Victims (including me):
https://github.com/llvm/llvm-project/commit/25bf8cb3c0e3c41231289a6ff0a37b6d49b24011
https://github.com/llvm/llvm-project/commit/0e8384a0fe4f03d60cd92aba1cae074512481ca2
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152880
Files:
clang/include/clang/AST/ASTDiagnostic.h
clang/lib/AST/ASTDiagnostic.cpp
Index: clang/lib/AST/ASTDiagnostic.cpp
===================================================================
--- clang/lib/AST/ASTDiagnostic.cpp
+++ clang/lib/AST/ASTDiagnostic.cpp
@@ -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;
Index: clang/include/clang/AST/ASTDiagnostic.h
===================================================================
--- clang/include/clang/AST/ASTDiagnostic.h
+++ clang/include/clang/AST/ASTDiagnostic.h
@@ -34,7 +34,8 @@
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152880.531148.patch
Type: text/x-patch
Size: 1299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230614/31a80ac6/attachment.bin>
More information about the cfe-commits
mailing list