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
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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits