Skip to content

Commit 25bf8cb

Browse files
committed
AST: Avoid reading an unitialized value
Desugar doesn't necessarily initialize ShouldAKA, but as of r241542 it may read it. Fix the misuse of the API and initialize this before passing it in. Found by ubsan. llvm-svn: 241705
1 parent 3386353 commit 25bf8cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/AST/ASTDiagnostic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty,
192192
if (CompareCanTy == CanTy)
193193
continue; // Same canonical types
194194
std::string CompareS = CompareTy.getAsString(Context.getPrintingPolicy());
195-
bool aka;
196-
QualType CompareDesugar = Desugar(Context, CompareTy, aka);
195+
bool ShouldAKA = false;
196+
QualType CompareDesugar = Desugar(Context, CompareTy, ShouldAKA);
197197
std::string CompareDesugarStr =
198198
CompareDesugar.getAsString(Context.getPrintingPolicy());
199199
if (CompareS != S && CompareDesugarStr != S)

0 commit comments

Comments
 (0)