]> granicus.if.org Git - clang/commitdiff
AST: Avoid reading an unitialized value
authorJustin Bogner <mail@justinbogner.com>
Wed, 8 Jul 2015 18:32:26 +0000 (18:32 +0000)
committerJustin Bogner <mail@justinbogner.com>
Wed, 8 Jul 2015 18:32:26 +0000 (18:32 +0000)
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

lib/AST/ASTDiagnostic.cpp

index 68a58a517df605da4d82b148d522b52d3b626c7a..dddaa5af6fb088499cba97b15f8b17961731dbe9 100644 (file)
@@ -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)