[clang] a00d440 - [AST] Hide errors from the attempt to introspect nodes

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 22 13:37:11 PDT 2021


Is this missing a test case?

On Tue, Mar 16, 2021 at 4:47 PM Stephen Kelly via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

>
> Author: Stephen Kelly
> Date: 2021-03-16T23:46:31Z
> New Revision: a00d44012820e9ed2eba623dd61ca9cf5a2ce115
>
> URL:
> https://github.com/llvm/llvm-project/commit/a00d44012820e9ed2eba623dd61ca9cf5a2ce115
> DIFF:
> https://github.com/llvm/llvm-project/commit/a00d44012820e9ed2eba623dd61ca9cf5a2ce115.diff
>
> LOG: [AST] Hide errors from the attempt to introspect nodes
>
> Added:
>
>
> Modified:
>     clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
>
> Removed:
>
>
>
>
> ################################################################################
> diff  --git a/clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
> b/clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
> index 6615f865221d..74ba70eefa04 100644
> --- a/clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
> +++ b/clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
> @@ -92,7 +92,13 @@ int main(int argc, const char **argv) {
>    auto ParsedArgs = Opts.ParseArgs(llvm::makeArrayRef(Argv).slice(1),
>                                     MissingArgIndex, MissingArgCount);
>    ParseDiagnosticArgs(*DiagOpts, ParsedArgs);
> -  TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts);
> +
> +  // Don't output diagnostics, because common scenarios such as
> +  // cross-compiling fail with diagnostics.  This is not fatal, but
> +  // just causes attempts to use the introspection API to return no data.
> +  std::string Str;
> +  llvm::raw_string_ostream OS(Str);
> +  TextDiagnosticPrinter DiagnosticPrinter(OS, &*DiagOpts);
>    DiagnosticsEngine Diagnostics(
>        IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
>        &DiagnosticPrinter, false);
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210322/b2133c57/attachment.html>


More information about the cfe-commits mailing list