From: Justin Bogner Date: Wed, 8 Jul 2015 18:32:26 +0000 (+0000) Subject: AST: Avoid reading an unitialized value X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4f1774e198641460b6a9b17bf8f680621461c4f;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241705 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp index 68a58a517d..dddaa5af6f 100644 --- a/lib/AST/ASTDiagnostic.cpp +++ b/lib/AST/ASTDiagnostic.cpp @@ -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)