[cfe-commits] r159976 - in /cfe/trunk: include/clang/Basic/Diagnostic.h lib/AST/ASTDiagnostic.cpp lib/Basic/Diagnostic.cpp

Chandler Carruth chandlerc at google.com
Mon Jul 9 19:40:03 PDT 2012


Test case?
On Jul 9, 2012 6:47 PM, "Richard Trieu" <rtrieu at google.com> wrote:

> Author: rtrieu
> Date: Mon Jul  9 20:46:04 2012
> New Revision: 159976
>
> URL: http://llvm.org/viewvc/llvm-project?rev=159976&view=rev
> Log:
> Properly update the FormattedArgs vector when the template type diffing
> falls
> back to regular type printing.
>
> Modified:
>     cfe/trunk/include/clang/Basic/Diagnostic.h
>     cfe/trunk/lib/AST/ASTDiagnostic.cpp
>     cfe/trunk/lib/Basic/Diagnostic.cpp
>
> Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=159976&r1=159975&r2=159976&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
> +++ cfe/trunk/include/clang/Basic/Diagnostic.h Mon Jul  9 20:46:04 2012
> @@ -1286,6 +1286,8 @@
>    unsigned PrintFromType : 1;
>    unsigned ElideType : 1;
>    unsigned ShowColors : 1;
> +  // The printer sets this variable to true if the template diff was used.
> +  unsigned TemplateDiffUsed : 1;
>  };
>
>  /// Special character that the diagnostic printer will use to toggle the
> bold
>
> Modified: cfe/trunk/lib/AST/ASTDiagnostic.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDiagnostic.cpp?rev=159976&r1=159975&r2=159976&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTDiagnostic.cpp (original)
> +++ cfe/trunk/lib/AST/ASTDiagnostic.cpp Mon Jul  9 20:46:04 2012
> @@ -254,7 +254,7 @@
>    switch (Kind) {
>      default: llvm_unreachable("unknown ArgumentKind");
>      case DiagnosticsEngine::ak_qualtype_pair: {
> -      const TemplateDiffTypes &TDT =
> *reinterpret_cast<TemplateDiffTypes*>(Val);
> +      TemplateDiffTypes &TDT = *reinterpret_cast<TemplateDiffTypes*>(Val);
>        QualType FromType =
>
>  QualType::getFromOpaquePtr(reinterpret_cast<void*>(TDT.FromType));
>        QualType ToType =
> @@ -264,6 +264,7 @@
>                                   TDT.PrintFromType, TDT.ElideType,
>                                   TDT.ShowColors, S)) {
>          NeedQuotes = !TDT.PrintTree;
> +        TDT.TemplateDiffUsed = true;
>          break;
>        }
>
>
> Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=159976&r1=159975&r2=159976&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
> +++ cfe/trunk/lib/Basic/Diagnostic.cpp Mon Jul  9 20:46:04 2012
> @@ -821,6 +821,7 @@
>        TDT.ToType = getRawArg(ArgNo2);
>        TDT.ElideType = getDiags()->ElideType;
>        TDT.ShowColors = getDiags()->ShowColors;
> +      TDT.TemplateDiffUsed = false;
>        intptr_t val = reinterpret_cast<intptr_t>(&TDT);
>
>        const char *ArgumentEnd = Argument + ArgumentLen;
> @@ -859,6 +860,10 @@
>                                       Argument, ArgumentLen,
>                                       FormattedArgs.data(),
> FormattedArgs.size(),
>                                       OutStr, QualTypeVals);
> +      if (!TDT.TemplateDiffUsed)
> +
>  FormattedArgs.push_back(std::make_pair(DiagnosticsEngine::ak_qualtype,
> +                                               TDT.FromType));
> +
>        // Append middle text
>        FormatDiagnostic(FirstDollar + 1, SecondDollar, OutStr);
>
> @@ -869,6 +874,10 @@
>                                       Argument, ArgumentLen,
>                                       FormattedArgs.data(),
> FormattedArgs.size(),
>                                       OutStr, QualTypeVals);
> +      if (!TDT.TemplateDiffUsed)
> +
>  FormattedArgs.push_back(std::make_pair(DiagnosticsEngine::ak_qualtype,
> +                                               TDT.ToType));
> +
>        // Append end text
>        FormatDiagnostic(SecondDollar + 1, Pipe, OutStr);
>        break;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120709/3ad5078c/attachment.html>


More information about the cfe-commits mailing list