From 2298981669bf3bd63335a4be179bc0f96823a8f4 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 20 Aug 2019 20:50:49 +0000 Subject: Vendor import of stripped clang trunk r366426 (just before the release_90 branch point): https://llvm.org/svn/llvm-project/cfe/trunk@366426 --- lib/Tooling/Tooling.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'lib/Tooling/Tooling.cpp') diff --git a/lib/Tooling/Tooling.cpp b/lib/Tooling/Tooling.cpp index 63aa64a5330d..291df0ae333d 100644 --- a/lib/Tooling/Tooling.cpp +++ b/lib/Tooling/Tooling.cpp @@ -1,9 +1,8 @@ //===- Tooling.cpp - Running clang standalone tools -----------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -302,7 +301,7 @@ bool ToolInvocation::run() { DiagConsumer ? DiagConsumer : &DiagnosticPrinter, false); const std::unique_ptr Driver( - newDriver(&Diagnostics, BinaryName, Files->getVirtualFileSystem())); + newDriver(&Diagnostics, BinaryName, &Files->getVirtualFileSystem())); // The "input file not found" diagnostics from the driver are useful. // The driver is only aware of the VFS working directory, but some clients // change this at the FileManager level instead. @@ -482,7 +481,7 @@ int ClangTool::run(ToolAction *Action) { if (OverlayFileSystem->setCurrentWorkingDirectory( CompileCommand.Directory)) llvm::report_fatal_error("Cannot chdir into \"" + - Twine(CompileCommand.Directory) + "\n!"); + Twine(CompileCommand.Directory) + "\"!"); // Now fill the in-memory VFS with the relative file mappings so it will // have the correct relative paths. We never remove mappings but that @@ -518,7 +517,8 @@ int ClangTool::run(ToolAction *Action) { if (!Invocation.run()) { // FIXME: Diagnostics should be used instead. - llvm::errs() << "Error while processing " << File << ".\n"; + if (PrintErrorMessage) + llvm::errs() << "Error while processing " << File << ".\n"; ProcessingFailed = true; } } @@ -570,6 +570,10 @@ void ClangTool::setRestoreWorkingDir(bool RestoreCWD) { this->RestoreCWD = RestoreCWD; } +void ClangTool::setPrintErrorMessage(bool PrintErrorMessage) { + this->PrintErrorMessage = PrintErrorMessage; +} + namespace clang { namespace tooling { -- cgit v1.2.3