Skip to content

Commit

Permalink
AST: Avoid reading an unitialized value
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bogner committed Jul 8, 2015
1 parent 3386353 commit 25bf8cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang/lib/AST/ASTDiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty,
if (CompareCanTy == CanTy)
continue; // Same canonical types
std::string CompareS = CompareTy.getAsString(Context.getPrintingPolicy());
bool aka;
QualType CompareDesugar = Desugar(Context, CompareTy, aka);
bool ShouldAKA = false;
QualType CompareDesugar = Desugar(Context, CompareTy, ShouldAKA);
std::string CompareDesugarStr =
CompareDesugar.getAsString(Context.getPrintingPolicy());
if (CompareS != S && CompareDesugarStr != S)
Expand Down

0 comments on commit 25bf8cb

Please sign in to comment.