mirror of
https://github.com/intel/llvm.git
synced 2026-01-29 12:53:33 +08:00
Make DiagnosticOptions intrusively reference-counted, and make sure
the various stakeholders bump up the reference count. In particular, the diagnostics engine now keeps the DiagnosticOptions object alive. llvm-svn: 166508
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
namespace clang {
|
||||
class DiagnosticConsumer;
|
||||
class DiagnosticBuilder;
|
||||
class DiagnosticOptions;
|
||||
class IdentifierInfo;
|
||||
class DeclContext;
|
||||
class LangOptions;
|
||||
@@ -190,6 +191,7 @@ private:
|
||||
// backtrace stack, 0 -> no limit.
|
||||
ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors?
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> Diags;
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
|
||||
DiagnosticConsumer *Client;
|
||||
bool OwnsDiagClient;
|
||||
SourceManager *SourceMgr;
|
||||
@@ -341,6 +343,7 @@ private:
|
||||
public:
|
||||
explicit DiagnosticsEngine(
|
||||
const IntrusiveRefCntPtr<DiagnosticIDs> &Diags,
|
||||
DiagnosticOptions *DiagOpts,
|
||||
DiagnosticConsumer *client = 0,
|
||||
bool ShouldOwnClient = true);
|
||||
~DiagnosticsEngine();
|
||||
@@ -349,6 +352,9 @@ public:
|
||||
return Diags;
|
||||
}
|
||||
|
||||
/// \brief Retrieve the diagnostic options.
|
||||
DiagnosticOptions &getDiagnosticOptions() const { return *DiagOpts; }
|
||||
|
||||
DiagnosticConsumer *getClient() { return Client; }
|
||||
const DiagnosticConsumer *getClient() const { return Client; }
|
||||
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_FRONTEND_DIAGNOSTICOPTIONS_H
|
||||
#define LLVM_CLANG_FRONTEND_DIAGNOSTICOPTIONS_H
|
||||
#ifndef LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H
|
||||
#define LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H
|
||||
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -19,7 +20,7 @@ namespace clang {
|
||||
|
||||
/// DiagnosticOptions - Options for controlling the compiler diagnostics
|
||||
/// engine.
|
||||
class DiagnosticOptions {
|
||||
class DiagnosticOptions : public llvm::RefCountedBase<DiagnosticOptions>{
|
||||
public:
|
||||
unsigned IgnoreWarnings : 1; /// -w
|
||||
unsigned NoRewriteMacros : 1; /// -Wno-rewrite-macros
|
||||
@@ -495,8 +495,7 @@ public:
|
||||
/// releasing the returned DiagnosticsEngine's client eventually.
|
||||
///
|
||||
/// \param Opts - The diagnostic options; note that the created text
|
||||
/// diagnostic object contains a reference to these options and its lifetime
|
||||
/// must extend past that of the diagnostic engine.
|
||||
/// diagnostic object contains a reference to these options.
|
||||
///
|
||||
/// \param Client If non-NULL, a diagnostic client that will be
|
||||
/// attached to (and, then, owned by) the returned DiagnosticsEngine
|
||||
@@ -507,7 +506,7 @@ public:
|
||||
///
|
||||
/// \return The new object on success, or null on failure.
|
||||
static IntrusiveRefCntPtr<DiagnosticsEngine>
|
||||
createDiagnostics(const DiagnosticOptions &Opts, int Argc,
|
||||
createDiagnostics(DiagnosticOptions *Opts, int Argc,
|
||||
const char* const *Argv,
|
||||
DiagnosticConsumer *Client = 0,
|
||||
bool ShouldOwnClient = true,
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
#include "clang/Basic/LangOptions.h"
|
||||
#include "clang/Basic/TargetOptions.h"
|
||||
#include "clang/Basic/FileSystemOptions.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
|
||||
#include "clang/Frontend/MigratorOptions.h"
|
||||
#include "clang/Frontend/CodeGenOptions.h"
|
||||
#include "clang/Frontend/DependencyOutputOptions.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
#include "clang/Frontend/FrontendOptions.h"
|
||||
#include "clang/Frontend/HeaderSearchOptions.h"
|
||||
#include "clang/Frontend/LangStandard.h"
|
||||
@@ -55,6 +55,10 @@ protected:
|
||||
|
||||
/// Options controlling the target.
|
||||
IntrusiveRefCntPtr<TargetOptions> TargetOpts;
|
||||
|
||||
/// Options controlling the diagnostic engine.
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagnosticOpts;
|
||||
|
||||
public:
|
||||
CompilerInvocationBase();
|
||||
|
||||
@@ -67,6 +71,8 @@ public:
|
||||
const TargetOptions &getTargetOpts() const {
|
||||
return *TargetOpts.getPtr();
|
||||
}
|
||||
|
||||
DiagnosticOptions &getDiagnosticOpts() const { return *DiagnosticOpts; }
|
||||
};
|
||||
|
||||
/// \brief Helper class for holding the data necessary to invoke the compiler.
|
||||
@@ -86,9 +92,6 @@ class CompilerInvocation : public CompilerInvocationBase {
|
||||
/// Options controlling dependency output.
|
||||
DependencyOutputOptions DependencyOutputOpts;
|
||||
|
||||
/// Options controlling the diagnostic engine.
|
||||
DiagnosticOptions DiagnosticOpts;
|
||||
|
||||
/// Options controlling file system operations.
|
||||
FileSystemOptions FileSystemOpts;
|
||||
|
||||
@@ -174,9 +177,6 @@ public:
|
||||
return DependencyOutputOpts;
|
||||
}
|
||||
|
||||
DiagnosticOptions &getDiagnosticOpts() { return DiagnosticOpts; }
|
||||
const DiagnosticOptions &getDiagnosticOpts() const { return DiagnosticOpts; }
|
||||
|
||||
FileSystemOptions &getFileSystemOpts() { return FileSystemOpts; }
|
||||
const FileSystemOptions &getFileSystemOpts() const {
|
||||
return FileSystemOpts;
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef llvm::PointerUnion<const Diagnostic *,
|
||||
class DiagnosticRenderer {
|
||||
protected:
|
||||
const LangOptions &LangOpts;
|
||||
const DiagnosticOptions &DiagOpts;
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
|
||||
|
||||
/// \brief The location of the previous diagnostic if known.
|
||||
///
|
||||
@@ -66,7 +66,7 @@ protected:
|
||||
DiagnosticsEngine::Level LastLevel;
|
||||
|
||||
DiagnosticRenderer(const LangOptions &LangOpts,
|
||||
const DiagnosticOptions &DiagOpts);
|
||||
DiagnosticOptions *DiagOpts);
|
||||
|
||||
virtual ~DiagnosticRenderer();
|
||||
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
class DiagnosticNoteRenderer : public DiagnosticRenderer {
|
||||
public:
|
||||
DiagnosticNoteRenderer(const LangOptions &LangOpts,
|
||||
const DiagnosticOptions &DiagOpts)
|
||||
DiagnosticOptions *DiagOpts)
|
||||
: DiagnosticRenderer(LangOpts, DiagOpts) {}
|
||||
|
||||
virtual ~DiagnosticNoteRenderer();
|
||||
|
||||
@@ -42,7 +42,7 @@ class LogDiagnosticPrinter : public DiagnosticConsumer {
|
||||
|
||||
raw_ostream &OS;
|
||||
const LangOptions *LangOpts;
|
||||
const DiagnosticOptions *DiagOpts;
|
||||
llvm::IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
|
||||
|
||||
SourceLocation LastWarningLoc;
|
||||
FullSourceLoc LastLoc;
|
||||
@@ -54,7 +54,7 @@ class LogDiagnosticPrinter : public DiagnosticConsumer {
|
||||
std::string DwarfDebugFlags;
|
||||
|
||||
public:
|
||||
LogDiagnosticPrinter(raw_ostream &OS, const DiagnosticOptions &Diags,
|
||||
LogDiagnosticPrinter(raw_ostream &OS, DiagnosticOptions *Diags,
|
||||
bool OwnsOutputStream = false);
|
||||
virtual ~LogDiagnosticPrinter();
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ enum RecordIDs {
|
||||
/// (via libclang) without needing to parse Clang's command line output.
|
||||
///
|
||||
DiagnosticConsumer *create(llvm::raw_ostream *OS,
|
||||
const DiagnosticOptions &diags);
|
||||
DiagnosticOptions *diags);
|
||||
|
||||
} // end serialized_diags namespace
|
||||
} // end clang namespace
|
||||
|
||||
@@ -40,7 +40,7 @@ class TextDiagnostic : public DiagnosticRenderer {
|
||||
public:
|
||||
TextDiagnostic(raw_ostream &OS,
|
||||
const LangOptions &LangOpts,
|
||||
const DiagnosticOptions &DiagOpts);
|
||||
DiagnosticOptions *DiagOpts);
|
||||
|
||||
virtual ~TextDiagnostic();
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "clang/Basic/LLVM.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
||||
|
||||
namespace clang {
|
||||
class DiagnosticOptions;
|
||||
@@ -26,7 +27,7 @@ class TextDiagnostic;
|
||||
|
||||
class TextDiagnosticPrinter : public DiagnosticConsumer {
|
||||
raw_ostream &OS;
|
||||
const DiagnosticOptions *DiagOpts;
|
||||
llvm::IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
|
||||
|
||||
/// \brief Handle to the currently active text diagnostic emitter.
|
||||
OwningPtr<TextDiagnostic> TextDiag;
|
||||
@@ -37,7 +38,7 @@ class TextDiagnosticPrinter : public DiagnosticConsumer {
|
||||
unsigned OwnsOutputStream : 1;
|
||||
|
||||
public:
|
||||
TextDiagnosticPrinter(raw_ostream &os, const DiagnosticOptions &diags,
|
||||
TextDiagnosticPrinter(raw_ostream &os, DiagnosticOptions *diags,
|
||||
bool OwnsOutputStream = false);
|
||||
virtual ~TextDiagnosticPrinter();
|
||||
|
||||
|
||||
@@ -243,12 +243,13 @@ createInvocationForMigration(CompilerInvocation &origCI) {
|
||||
}
|
||||
|
||||
static void emitPremigrationErrors(const CapturedDiagList &arcDiags,
|
||||
const DiagnosticOptions &diagOpts,
|
||||
DiagnosticOptions *diagOpts,
|
||||
Preprocessor &PP) {
|
||||
TextDiagnosticPrinter printer(llvm::errs(), diagOpts);
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
|
||||
new DiagnosticsEngine(DiagID, &printer, /*ShouldOwnClient=*/false));
|
||||
new DiagnosticsEngine(DiagID, diagOpts, &printer,
|
||||
/*ShouldOwnClient=*/false));
|
||||
Diags->setSourceManager(&PP.getSourceManager());
|
||||
|
||||
printer.BeginSourceFile(PP.getLangOpts(), &PP);
|
||||
@@ -286,7 +287,8 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
|
||||
assert(DiagClient);
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
|
||||
new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
|
||||
new DiagnosticsEngine(DiagID, &origCI.getDiagnosticOpts(),
|
||||
DiagClient, /*ShouldOwnClient=*/false));
|
||||
|
||||
// Filter of all diagnostics.
|
||||
CaptureDiagnosticConsumer errRec(*Diags, *DiagClient, capturedDiags);
|
||||
@@ -314,7 +316,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
|
||||
}
|
||||
|
||||
if (emitPremigrationARCErrors)
|
||||
emitPremigrationErrors(capturedDiags, origCI.getDiagnosticOpts(),
|
||||
emitPremigrationErrors(capturedDiags, &origCI.getDiagnosticOpts(),
|
||||
Unit->getPreprocessor());
|
||||
if (!plistOut.empty()) {
|
||||
SmallVector<StoredDiagnostic, 8> arcDiags;
|
||||
@@ -395,7 +397,8 @@ static bool applyTransforms(CompilerInvocation &origCI,
|
||||
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
|
||||
new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
|
||||
new DiagnosticsEngine(DiagID, &origCI.getDiagnosticOpts(),
|
||||
DiagClient, /*ShouldOwnClient=*/false));
|
||||
|
||||
if (outputDir.empty()) {
|
||||
origCI.getLangOpts()->ObjCAutoRefCount = true;
|
||||
@@ -434,7 +437,8 @@ bool arcmt::getFileRemappings(std::vector<std::pair<std::string,std::string> > &
|
||||
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
|
||||
new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
|
||||
new DiagnosticsEngine(DiagID, new DiagnosticOptions,
|
||||
DiagClient, /*ShouldOwnClient=*/false));
|
||||
|
||||
FileRemapper remapper;
|
||||
bool err = remapper.initFromDisk(outputDir, *Diags,
|
||||
@@ -458,7 +462,8 @@ bool arcmt::getFileRemappingsFromFileList(
|
||||
|
||||
llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
|
||||
new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
|
||||
new DiagnosticsEngine(DiagID, new DiagnosticOptions,
|
||||
DiagClient, /*ShouldOwnClient=*/false));
|
||||
|
||||
for (ArrayRef<StringRef>::iterator
|
||||
I = remapFiles.begin(), E = remapFiles.end(); I != E; ++I) {
|
||||
@@ -574,7 +579,8 @@ MigrationProcess::MigrationProcess(const CompilerInvocation &CI,
|
||||
if (!outputDir.empty()) {
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
|
||||
new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
|
||||
new DiagnosticsEngine(DiagID, &CI.getDiagnosticOpts(),
|
||||
DiagClient, /*ShouldOwnClient=*/false));
|
||||
Remapper.initFromDisk(outputDir, *Diags, /*ignoreIfFilesChanges=*/true);
|
||||
}
|
||||
}
|
||||
@@ -593,7 +599,8 @@ bool MigrationProcess::applyTransform(TransformFn trans,
|
||||
assert(DiagClient);
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
|
||||
new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
|
||||
new DiagnosticsEngine(DiagID, new DiagnosticOptions,
|
||||
DiagClient, /*ShouldOwnClient=*/false));
|
||||
|
||||
// Filter of all diagnostics.
|
||||
CaptureDiagnosticConsumer errRec(*Diags, *DiagClient, capturedDiags);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "clang/AST/DeclTemplate.h"
|
||||
#include "clang/AST/ExprCXX.h"
|
||||
#include "clang/Basic/ABI.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Basic/IdentifierTable.h"
|
||||
#include "clang/Basic/PartialDiagnostic.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
@@ -37,9 +38,10 @@ static void DummyArgToStringFn(DiagnosticsEngine::ArgumentKind AK, intptr_t QT,
|
||||
|
||||
DiagnosticsEngine::DiagnosticsEngine(
|
||||
const IntrusiveRefCntPtr<DiagnosticIDs> &diags,
|
||||
DiagnosticOptions *DiagOpts,
|
||||
DiagnosticConsumer *client, bool ShouldOwnClient)
|
||||
: Diags(diags), Client(client), OwnsDiagClient(ShouldOwnClient),
|
||||
SourceMgr(0) {
|
||||
: Diags(diags), DiagOpts(DiagOpts), Client(client),
|
||||
OwnsDiagClient(ShouldOwnClient), SourceMgr(0) {
|
||||
ArgToStringFn = DummyArgToStringFn;
|
||||
ArgToStringCookie = 0;
|
||||
|
||||
|
||||
@@ -41,8 +41,9 @@ void ASTMergeAction::ExecuteAction() {
|
||||
DiagIDs(CI.getDiagnostics().getDiagnosticIDs());
|
||||
for (unsigned I = 0, N = ASTFiles.size(); I != N; ++I) {
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine>
|
||||
Diags(new DiagnosticsEngine(DiagIDs, CI.getDiagnostics().getClient(),
|
||||
/*ShouldOwnClient=*/false));
|
||||
Diags(new DiagnosticsEngine(DiagIDs, &CI.getDiagnosticOpts(),
|
||||
CI.getDiagnostics().getClient(),
|
||||
/*ShouldOwnClient=*/false));
|
||||
ASTUnit *Unit = ASTUnit::LoadFromASTFile(ASTFiles[I], Diags,
|
||||
CI.getFileSystemOpts(), false);
|
||||
if (!Unit)
|
||||
|
||||
@@ -668,11 +668,11 @@ void ASTUnit::ConfigureDiags(IntrusiveRefCntPtr<DiagnosticsEngine> &Diags,
|
||||
if (!Diags.getPtr()) {
|
||||
// No diagnostics engine was provided, so create our own diagnostics object
|
||||
// with the default options.
|
||||
DiagnosticOptions DiagOpts;
|
||||
DiagnosticConsumer *Client = 0;
|
||||
if (CaptureDiagnostics)
|
||||
Client = new StoredDiagnosticConsumer(AST.StoredDiagnostics);
|
||||
Diags = CompilerInstance::createDiagnostics(DiagOpts, ArgEnd-ArgBegin,
|
||||
Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions(),
|
||||
ArgEnd-ArgBegin,
|
||||
ArgBegin, Client,
|
||||
/*ShouldOwnClient=*/true,
|
||||
/*ShouldCloneClient=*/false);
|
||||
@@ -1947,8 +1947,8 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin,
|
||||
if (!Diags.getPtr()) {
|
||||
// No diagnostics engine was provided, so create our own diagnostics object
|
||||
// with the default options.
|
||||
DiagnosticOptions DiagOpts;
|
||||
Diags = CompilerInstance::createDiagnostics(DiagOpts, ArgEnd - ArgBegin,
|
||||
Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions(),
|
||||
ArgEnd - ArgBegin,
|
||||
ArgBegin);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,10 +90,10 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) {
|
||||
IK));
|
||||
|
||||
TextDiagnosticPrinter *DiagClient =
|
||||
new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
|
||||
new TextDiagnosticPrinter(llvm::errs(), new DiagnosticOptions());
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
|
||||
new DiagnosticsEngine(DiagID, DiagClient));
|
||||
new DiagnosticsEngine(DiagID, &CI.getDiagnosticOpts(), DiagClient));
|
||||
|
||||
OwningPtr<CompilerInstance> Clang(new CompilerInstance());
|
||||
Clang->setInvocation(CInvok.take());
|
||||
|
||||
@@ -93,15 +93,15 @@ void CompilerInstance::setCodeCompletionConsumer(CodeCompleteConsumer *Value) {
|
||||
}
|
||||
|
||||
// Diagnostics
|
||||
static void SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts,
|
||||
static void SetUpBuildDumpLog(DiagnosticOptions *DiagOpts,
|
||||
unsigned argc, const char* const *argv,
|
||||
DiagnosticsEngine &Diags) {
|
||||
std::string ErrorInfo;
|
||||
OwningPtr<raw_ostream> OS(
|
||||
new llvm::raw_fd_ostream(DiagOpts.DumpBuildInformation.c_str(), ErrorInfo));
|
||||
new llvm::raw_fd_ostream(DiagOpts->DumpBuildInformation.c_str(),ErrorInfo));
|
||||
if (!ErrorInfo.empty()) {
|
||||
Diags.Report(diag::err_fe_unable_to_open_logfile)
|
||||
<< DiagOpts.DumpBuildInformation << ErrorInfo;
|
||||
<< DiagOpts->DumpBuildInformation << ErrorInfo;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -116,20 +116,20 @@ static void SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts,
|
||||
Diags.setClient(new ChainedDiagnosticConsumer(Diags.takeClient(), Logger));
|
||||
}
|
||||
|
||||
static void SetUpDiagnosticLog(const DiagnosticOptions &DiagOpts,
|
||||
static void SetUpDiagnosticLog(DiagnosticOptions *DiagOpts,
|
||||
const CodeGenOptions *CodeGenOpts,
|
||||
DiagnosticsEngine &Diags) {
|
||||
std::string ErrorInfo;
|
||||
bool OwnsStream = false;
|
||||
raw_ostream *OS = &llvm::errs();
|
||||
if (DiagOpts.DiagnosticLogFile != "-") {
|
||||
if (DiagOpts->DiagnosticLogFile != "-") {
|
||||
// Create the output stream.
|
||||
llvm::raw_fd_ostream *FileOS(
|
||||
new llvm::raw_fd_ostream(DiagOpts.DiagnosticLogFile.c_str(),
|
||||
new llvm::raw_fd_ostream(DiagOpts->DiagnosticLogFile.c_str(),
|
||||
ErrorInfo, llvm::raw_fd_ostream::F_Append));
|
||||
if (!ErrorInfo.empty()) {
|
||||
Diags.Report(diag::warn_fe_cc_log_diagnostics_failure)
|
||||
<< DiagOpts.DumpBuildInformation << ErrorInfo;
|
||||
<< DiagOpts->DumpBuildInformation << ErrorInfo;
|
||||
} else {
|
||||
FileOS->SetUnbuffered();
|
||||
FileOS->SetUseAtomicWrites(true);
|
||||
@@ -146,7 +146,7 @@ static void SetUpDiagnosticLog(const DiagnosticOptions &DiagOpts,
|
||||
Diags.setClient(new ChainedDiagnosticConsumer(Diags.takeClient(), Logger));
|
||||
}
|
||||
|
||||
static void SetupSerializedDiagnostics(const DiagnosticOptions &DiagOpts,
|
||||
static void SetupSerializedDiagnostics(DiagnosticOptions *DiagOpts,
|
||||
DiagnosticsEngine &Diags,
|
||||
StringRef OutputFile) {
|
||||
std::string ErrorInfo;
|
||||
@@ -172,13 +172,13 @@ void CompilerInstance::createDiagnostics(int Argc, const char* const *Argv,
|
||||
DiagnosticConsumer *Client,
|
||||
bool ShouldOwnClient,
|
||||
bool ShouldCloneClient) {
|
||||
Diagnostics = createDiagnostics(getDiagnosticOpts(), Argc, Argv, Client,
|
||||
Diagnostics = createDiagnostics(&getDiagnosticOpts(), Argc, Argv, Client,
|
||||
ShouldOwnClient, ShouldCloneClient,
|
||||
&getCodeGenOpts());
|
||||
}
|
||||
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine>
|
||||
CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts,
|
||||
CompilerInstance::createDiagnostics(DiagnosticOptions *Opts,
|
||||
int Argc, const char* const *Argv,
|
||||
DiagnosticConsumer *Client,
|
||||
bool ShouldOwnClient,
|
||||
@@ -186,7 +186,7 @@ CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts,
|
||||
const CodeGenOptions *CodeGenOpts) {
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine>
|
||||
Diags(new DiagnosticsEngine(DiagID));
|
||||
Diags(new DiagnosticsEngine(DiagID, Opts));
|
||||
|
||||
// Create the diagnostic client for reporting errors or for
|
||||
// implementing -verify.
|
||||
@@ -199,22 +199,22 @@ CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts,
|
||||
Diags->setClient(new TextDiagnosticPrinter(llvm::errs(), Opts));
|
||||
|
||||
// Chain in -verify checker, if requested.
|
||||
if (Opts.VerifyDiagnostics)
|
||||
if (Opts->VerifyDiagnostics)
|
||||
Diags->setClient(new VerifyDiagnosticConsumer(*Diags));
|
||||
|
||||
// Chain in -diagnostic-log-file dumper, if requested.
|
||||
if (!Opts.DiagnosticLogFile.empty())
|
||||
if (!Opts->DiagnosticLogFile.empty())
|
||||
SetUpDiagnosticLog(Opts, CodeGenOpts, *Diags);
|
||||
|
||||
if (!Opts.DumpBuildInformation.empty())
|
||||
if (!Opts->DumpBuildInformation.empty())
|
||||
SetUpBuildDumpLog(Opts, Argc, Argv, *Diags);
|
||||
|
||||
if (!Opts.DiagnosticSerializationFile.empty())
|
||||
if (!Opts->DiagnosticSerializationFile.empty())
|
||||
SetupSerializedDiagnostics(Opts, *Diags,
|
||||
Opts.DiagnosticSerializationFile);
|
||||
Opts->DiagnosticSerializationFile);
|
||||
|
||||
// Configure our handling of diagnostics.
|
||||
ProcessWarningOptions(*Diags, Opts);
|
||||
ProcessWarningOptions(*Diags, *Opts);
|
||||
|
||||
return Diags;
|
||||
}
|
||||
|
||||
@@ -35,12 +35,14 @@ using namespace clang;
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
CompilerInvocationBase::CompilerInvocationBase()
|
||||
: LangOpts(new LangOptions()), TargetOpts(new TargetOptions()) {}
|
||||
: LangOpts(new LangOptions()), TargetOpts(new TargetOptions()),
|
||||
DiagnosticOpts(new DiagnosticOptions()) {}
|
||||
|
||||
CompilerInvocationBase::CompilerInvocationBase(const CompilerInvocationBase &X)
|
||||
: RefCountedBase<CompilerInvocation>(),
|
||||
LangOpts(new LangOptions(*X.getLangOpts())),
|
||||
TargetOpts(new TargetOptions(X.getTargetOpts())) {}
|
||||
TargetOpts(new TargetOptions(X.getTargetOpts())),
|
||||
DiagnosticOpts(new DiagnosticOptions(X.getDiagnosticOpts())) {}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Utility functions.
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Frontend/Utils.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
#include "clang/Frontend/FrontendDiagnostic.h"
|
||||
#include "clang/Driver/Compilation.h"
|
||||
#include "clang/Driver/Driver.h"
|
||||
@@ -34,8 +34,8 @@ clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList,
|
||||
if (!Diags.getPtr()) {
|
||||
// No diagnostics engine was provided, so create our own diagnostics object
|
||||
// with the default options.
|
||||
DiagnosticOptions DiagOpts;
|
||||
Diags = CompilerInstance::createDiagnostics(DiagOpts, ArgList.size(),
|
||||
Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions,
|
||||
ArgList.size(),
|
||||
ArgList.begin());
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Frontend/DiagnosticRenderer.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "clang/Edit/EditedSource.h"
|
||||
#include "clang/Edit/Commit.h"
|
||||
@@ -60,8 +60,8 @@ static StringRef getImmediateMacroName(SourceLocation Loc,
|
||||
}
|
||||
|
||||
DiagnosticRenderer::DiagnosticRenderer(const LangOptions &LangOpts,
|
||||
const DiagnosticOptions &DiagOpts)
|
||||
: LangOpts(LangOpts), DiagOpts(DiagOpts), LastLevel() {}
|
||||
DiagnosticOptions *DiagOpts)
|
||||
: LangOpts(LangOpts), DiagOpts(DiagOpts), LastLevel() {}
|
||||
|
||||
DiagnosticRenderer::~DiagnosticRenderer() {}
|
||||
|
||||
@@ -194,7 +194,7 @@ void DiagnosticRenderer::emitIncludeStack(SourceLocation Loc,
|
||||
return;
|
||||
LastIncludeLoc = Loc;
|
||||
|
||||
if (!DiagOpts.ShowNoteIncludeStack && Level == DiagnosticsEngine::Note)
|
||||
if (!DiagOpts->ShowNoteIncludeStack && Level == DiagnosticsEngine::Note)
|
||||
return;
|
||||
|
||||
emitIncludeStackRecursively(Loc, SM);
|
||||
@@ -269,11 +269,11 @@ void DiagnosticRenderer::emitMacroExpansionsAndCarets(
|
||||
Loc = SM.getImmediateMacroCalleeLoc(Loc);
|
||||
|
||||
unsigned MacroSkipStart = 0, MacroSkipEnd = 0;
|
||||
if (MacroDepth > DiagOpts.MacroBacktraceLimit &&
|
||||
DiagOpts.MacroBacktraceLimit != 0) {
|
||||
MacroSkipStart = DiagOpts.MacroBacktraceLimit / 2 +
|
||||
DiagOpts.MacroBacktraceLimit % 2;
|
||||
MacroSkipEnd = MacroDepth - DiagOpts.MacroBacktraceLimit / 2;
|
||||
if (MacroDepth > DiagOpts->MacroBacktraceLimit &&
|
||||
DiagOpts->MacroBacktraceLimit != 0) {
|
||||
MacroSkipStart = DiagOpts->MacroBacktraceLimit / 2 +
|
||||
DiagOpts->MacroBacktraceLimit % 2;
|
||||
MacroSkipEnd = MacroDepth - DiagOpts->MacroBacktraceLimit / 2;
|
||||
}
|
||||
|
||||
// Whether to suppress printing this macro expansion.
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Frontend/LogDiagnosticPrinter.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
@@ -16,9 +17,9 @@
|
||||
using namespace clang;
|
||||
|
||||
LogDiagnosticPrinter::LogDiagnosticPrinter(raw_ostream &os,
|
||||
const DiagnosticOptions &diags,
|
||||
DiagnosticOptions *diags,
|
||||
bool _OwnsOutputStream)
|
||||
: OS(os), LangOpts(0), DiagOpts(&diags),
|
||||
: OS(os), LangOpts(0), DiagOpts(diags),
|
||||
OwnsOutputStream(_OwnsOutputStream) {
|
||||
}
|
||||
|
||||
@@ -172,6 +173,6 @@ void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
|
||||
|
||||
DiagnosticConsumer *
|
||||
LogDiagnosticPrinter::clone(DiagnosticsEngine &Diags) const {
|
||||
return new LogDiagnosticPrinter(OS, *DiagOpts, /*OwnsOutputStream=*/false);
|
||||
return new LogDiagnosticPrinter(OS, &*DiagOpts, /*OwnsOutputStream=*/false);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
@@ -52,7 +53,7 @@ class SDiagsRenderer : public DiagnosticNoteRenderer {
|
||||
SDiagsWriter &Writer;
|
||||
public:
|
||||
SDiagsRenderer(SDiagsWriter &Writer, const LangOptions &LangOpts,
|
||||
const DiagnosticOptions &DiagOpts)
|
||||
DiagnosticOptions *DiagOpts)
|
||||
: DiagnosticNoteRenderer(LangOpts, DiagOpts), Writer(Writer) {}
|
||||
|
||||
virtual ~SDiagsRenderer() {}
|
||||
@@ -89,7 +90,7 @@ protected:
|
||||
class SDiagsWriter : public DiagnosticConsumer {
|
||||
friend class SDiagsRenderer;
|
||||
public:
|
||||
explicit SDiagsWriter(llvm::raw_ostream *os, const DiagnosticOptions &diags)
|
||||
explicit SDiagsWriter(llvm::raw_ostream *os, DiagnosticOptions *diags)
|
||||
: LangOpts(0), DiagOpts(diags), Stream(Buffer), OS(os),
|
||||
EmittedAnyDiagBlocks(false) {
|
||||
EmitPreamble();
|
||||
@@ -175,7 +176,7 @@ private:
|
||||
enum { Version = 1 };
|
||||
|
||||
const LangOptions *LangOpts;
|
||||
const DiagnosticOptions &DiagOpts;
|
||||
llvm::IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
|
||||
|
||||
/// \brief The byte buffer for the serialized content.
|
||||
SmallString<1024> Buffer;
|
||||
@@ -217,7 +218,7 @@ private:
|
||||
namespace clang {
|
||||
namespace serialized_diags {
|
||||
DiagnosticConsumer *create(llvm::raw_ostream *OS,
|
||||
const DiagnosticOptions &diags) {
|
||||
DiagnosticOptions *diags) {
|
||||
return new SDiagsWriter(OS, diags);
|
||||
}
|
||||
} // end namespace serialized_diags
|
||||
@@ -517,7 +518,7 @@ void SDiagsWriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
|
||||
assert(Info.hasSourceManager() && LangOpts &&
|
||||
"Unexpected diagnostic with valid location outside of a source file");
|
||||
SDiagsRenderer Renderer(*this, *LangOpts, DiagOpts);
|
||||
SDiagsRenderer Renderer(*this, *LangOpts, &*DiagOpts);
|
||||
Renderer.emitDiagnostic(Info.getLocation(), DiagLevel,
|
||||
diagBuf.str(),
|
||||
Info.getRanges(),
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Basic/ConvertUTF.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
@@ -683,7 +683,7 @@ static bool printWordWrapped(raw_ostream &OS, StringRef Str,
|
||||
|
||||
TextDiagnostic::TextDiagnostic(raw_ostream &OS,
|
||||
const LangOptions &LangOpts,
|
||||
const DiagnosticOptions &DiagOpts)
|
||||
DiagnosticOptions *DiagOpts)
|
||||
: DiagnosticRenderer(LangOpts, DiagOpts), OS(OS) {}
|
||||
|
||||
TextDiagnostic::~TextDiagnostic() {}
|
||||
@@ -702,13 +702,13 @@ TextDiagnostic::emitDiagnosticMessage(SourceLocation Loc,
|
||||
if (Loc.isValid())
|
||||
emitDiagnosticLoc(Loc, PLoc, Level, Ranges, *SM);
|
||||
|
||||
if (DiagOpts.ShowColors)
|
||||
if (DiagOpts->ShowColors)
|
||||
OS.resetColor();
|
||||
|
||||
printDiagnosticLevel(OS, Level, DiagOpts.ShowColors);
|
||||
printDiagnosticLevel(OS, Level, DiagOpts->ShowColors);
|
||||
printDiagnosticMessage(OS, Level, Message,
|
||||
OS.tell() - StartOfLocationInfo,
|
||||
DiagOpts.MessageLength, DiagOpts.ShowColors);
|
||||
DiagOpts->MessageLength, DiagOpts->ShowColors);
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
@@ -802,36 +802,36 @@ void TextDiagnostic::emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
|
||||
}
|
||||
unsigned LineNo = PLoc.getLine();
|
||||
|
||||
if (!DiagOpts.ShowLocation)
|
||||
if (!DiagOpts->ShowLocation)
|
||||
return;
|
||||
|
||||
if (DiagOpts.ShowColors)
|
||||
if (DiagOpts->ShowColors)
|
||||
OS.changeColor(savedColor, true);
|
||||
|
||||
OS << PLoc.getFilename();
|
||||
switch (DiagOpts.Format) {
|
||||
switch (DiagOpts->Format) {
|
||||
case DiagnosticOptions::Clang: OS << ':' << LineNo; break;
|
||||
case DiagnosticOptions::Msvc: OS << '(' << LineNo; break;
|
||||
case DiagnosticOptions::Vi: OS << " +" << LineNo; break;
|
||||
}
|
||||
|
||||
if (DiagOpts.ShowColumn)
|
||||
if (DiagOpts->ShowColumn)
|
||||
// Compute the column number.
|
||||
if (unsigned ColNo = PLoc.getColumn()) {
|
||||
if (DiagOpts.Format == DiagnosticOptions::Msvc) {
|
||||
if (DiagOpts->Format == DiagnosticOptions::Msvc) {
|
||||
OS << ',';
|
||||
ColNo--;
|
||||
} else
|
||||
OS << ':';
|
||||
OS << ColNo;
|
||||
}
|
||||
switch (DiagOpts.Format) {
|
||||
switch (DiagOpts->Format) {
|
||||
case DiagnosticOptions::Clang:
|
||||
case DiagnosticOptions::Vi: OS << ':'; break;
|
||||
case DiagnosticOptions::Msvc: OS << ") : "; break;
|
||||
}
|
||||
|
||||
if (DiagOpts.ShowSourceRanges && !Ranges.empty()) {
|
||||
if (DiagOpts->ShowSourceRanges && !Ranges.empty()) {
|
||||
FileID CaretFileID =
|
||||
SM.getFileID(SM.getExpansionLoc(Loc));
|
||||
bool PrintedRange = false;
|
||||
@@ -890,7 +890,7 @@ void TextDiagnostic::emitBasicNote(StringRef Message) {
|
||||
void TextDiagnostic::emitIncludeLocation(SourceLocation Loc,
|
||||
PresumedLoc PLoc,
|
||||
const SourceManager &SM) {
|
||||
if (DiagOpts.ShowLocation)
|
||||
if (DiagOpts->ShowLocation)
|
||||
OS << "In file included from " << PLoc.getFilename() << ':'
|
||||
<< PLoc.getLine() << ":\n";
|
||||
else
|
||||
@@ -918,7 +918,7 @@ void TextDiagnostic::emitSnippetAndCaret(
|
||||
// was part of a different warning or error diagnostic, or if the
|
||||
// diagnostic has ranges. We don't want to emit the same caret
|
||||
// multiple times if one loc has multiple diagnostics.
|
||||
if (!DiagOpts.ShowCarets)
|
||||
if (!DiagOpts->ShowCarets)
|
||||
return;
|
||||
if (Loc == LastLoc && Ranges.empty() && Hints.empty() &&
|
||||
(LastLevel != DiagnosticsEngine::Note || Level == LastLevel))
|
||||
@@ -956,7 +956,7 @@ void TextDiagnostic::emitSnippetAndCaret(
|
||||
// length as the line of source code.
|
||||
std::string CaretLine(LineEnd-LineStart, ' ');
|
||||
|
||||
const SourceColumnMap sourceColMap(SourceLine, DiagOpts.TabStop);
|
||||
const SourceColumnMap sourceColMap(SourceLine, DiagOpts->TabStop);
|
||||
|
||||
// Highlight all of the characters covered by Ranges with ~ characters.
|
||||
for (SmallVectorImpl<CharSourceRange>::iterator I = Ranges.begin(),
|
||||
@@ -976,7 +976,7 @@ void TextDiagnostic::emitSnippetAndCaret(
|
||||
|
||||
// If the source line is too long for our terminal, select only the
|
||||
// "interesting" source region within that line.
|
||||
unsigned Columns = DiagOpts.MessageLength;
|
||||
unsigned Columns = DiagOpts->MessageLength;
|
||||
if (Columns)
|
||||
selectInterestingSourceRegion(SourceLine, CaretLine, FixItInsertionLine,
|
||||
Columns, sourceColMap);
|
||||
@@ -985,7 +985,7 @@ void TextDiagnostic::emitSnippetAndCaret(
|
||||
// to produce easily machine parsable output. Add a space before the
|
||||
// source line and the caret to make it trivial to tell the main diagnostic
|
||||
// line from what the user is intended to see.
|
||||
if (DiagOpts.ShowSourceRanges) {
|
||||
if (DiagOpts->ShowSourceRanges) {
|
||||
SourceLine = ' ' + SourceLine;
|
||||
CaretLine = ' ' + CaretLine;
|
||||
}
|
||||
@@ -997,20 +997,20 @@ void TextDiagnostic::emitSnippetAndCaret(
|
||||
// Emit what we have computed.
|
||||
emitSnippet(SourceLine);
|
||||
|
||||
if (DiagOpts.ShowColors)
|
||||
if (DiagOpts->ShowColors)
|
||||
OS.changeColor(caretColor, true);
|
||||
OS << CaretLine << '\n';
|
||||
if (DiagOpts.ShowColors)
|
||||
if (DiagOpts->ShowColors)
|
||||
OS.resetColor();
|
||||
|
||||
if (!FixItInsertionLine.empty()) {
|
||||
if (DiagOpts.ShowColors)
|
||||
if (DiagOpts->ShowColors)
|
||||
// Print fixit line in color
|
||||
OS.changeColor(fixitColor, false);
|
||||
if (DiagOpts.ShowSourceRanges)
|
||||
if (DiagOpts->ShowSourceRanges)
|
||||
OS << ' ';
|
||||
OS << FixItInsertionLine << '\n';
|
||||
if (DiagOpts.ShowColors)
|
||||
if (DiagOpts->ShowColors)
|
||||
OS.resetColor();
|
||||
}
|
||||
|
||||
@@ -1029,15 +1029,15 @@ void TextDiagnostic::emitSnippet(StringRef line) {
|
||||
|
||||
while (i<line.size()) {
|
||||
std::pair<SmallString<16>,bool> res
|
||||
= printableTextForNextCharacter(line, &i, DiagOpts.TabStop);
|
||||
= printableTextForNextCharacter(line, &i, DiagOpts->TabStop);
|
||||
bool was_printable = res.second;
|
||||
|
||||
if (DiagOpts.ShowColors && was_printable == print_reversed) {
|
||||
if (DiagOpts->ShowColors && was_printable == print_reversed) {
|
||||
if (print_reversed)
|
||||
OS.reverseColor();
|
||||
OS << to_print;
|
||||
to_print.clear();
|
||||
if (DiagOpts.ShowColors)
|
||||
if (DiagOpts->ShowColors)
|
||||
OS.resetColor();
|
||||
}
|
||||
|
||||
@@ -1045,10 +1045,10 @@ void TextDiagnostic::emitSnippet(StringRef line) {
|
||||
to_print += res.first.str();
|
||||
}
|
||||
|
||||
if (print_reversed && DiagOpts.ShowColors)
|
||||
if (print_reversed && DiagOpts->ShowColors)
|
||||
OS.reverseColor();
|
||||
OS << to_print;
|
||||
if (print_reversed && DiagOpts.ShowColors)
|
||||
if (print_reversed && DiagOpts->ShowColors)
|
||||
OS.resetColor();
|
||||
|
||||
OS << '\n';
|
||||
@@ -1148,7 +1148,7 @@ std::string TextDiagnostic::buildFixItInsertionLine(
|
||||
const SourceManager &SM) {
|
||||
|
||||
std::string FixItInsertionLine;
|
||||
if (Hints.empty() || !DiagOpts.ShowFixits)
|
||||
if (Hints.empty() || !DiagOpts->ShowFixits)
|
||||
return FixItInsertionLine;
|
||||
unsigned PrevHintEndCol = 0;
|
||||
|
||||
@@ -1208,14 +1208,14 @@ std::string TextDiagnostic::buildFixItInsertionLine(
|
||||
}
|
||||
}
|
||||
|
||||
expandTabs(FixItInsertionLine, DiagOpts.TabStop);
|
||||
expandTabs(FixItInsertionLine, DiagOpts->TabStop);
|
||||
|
||||
return FixItInsertionLine;
|
||||
}
|
||||
|
||||
void TextDiagnostic::emitParseableFixits(ArrayRef<FixItHint> Hints,
|
||||
const SourceManager &SM) {
|
||||
if (!DiagOpts.ShowParseableFixits)
|
||||
if (!DiagOpts->ShowParseableFixits)
|
||||
return;
|
||||
|
||||
// We follow FixItRewriter's example in not (yet) handling
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Frontend/TextDiagnosticPrinter.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
#include "clang/Frontend/TextDiagnostic.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
@@ -25,9 +25,9 @@
|
||||
using namespace clang;
|
||||
|
||||
TextDiagnosticPrinter::TextDiagnosticPrinter(raw_ostream &os,
|
||||
const DiagnosticOptions &diags,
|
||||
DiagnosticOptions *diags,
|
||||
bool _OwnsOutputStream)
|
||||
: OS(os), DiagOpts(&diags),
|
||||
: OS(os), DiagOpts(diags),
|
||||
OwnsOutputStream(_OwnsOutputStream) {
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ TextDiagnosticPrinter::~TextDiagnosticPrinter() {
|
||||
void TextDiagnosticPrinter::BeginSourceFile(const LangOptions &LO,
|
||||
const Preprocessor *PP) {
|
||||
// Build the TextDiagnostic utility.
|
||||
TextDiag.reset(new TextDiagnostic(OS, LO, *DiagOpts));
|
||||
TextDiag.reset(new TextDiagnostic(OS, LO, &*DiagOpts));
|
||||
}
|
||||
|
||||
void TextDiagnosticPrinter::EndSourceFile() {
|
||||
@@ -158,5 +158,5 @@ void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
|
||||
|
||||
DiagnosticConsumer *
|
||||
TextDiagnosticPrinter::clone(DiagnosticsEngine &Diags) const {
|
||||
return new TextDiagnosticPrinter(OS, *DiagOpts, /*OwnsOutputStream=*/false);
|
||||
return new TextDiagnosticPrinter(OS, &*DiagOpts, /*OwnsOutputStream=*/false);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "clang/Sema/SemaDiagnostic.h"
|
||||
#include "clang/Lex/LexDiagnostic.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Frontend/FrontendDiagnostic.h"
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "clang/Lex/LiteralSupport.h"
|
||||
#include "clang/Lex/LexDiagnostic.h"
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/TargetInfo.h"
|
||||
#include "clang/Basic/TargetOptions.h"
|
||||
@@ -76,7 +77,7 @@ ModuleMap::ModuleMap(FileManager &FileMgr, const DiagnosticConsumer &DC,
|
||||
{
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagIDs(new DiagnosticIDs);
|
||||
Diags = IntrusiveRefCntPtr<DiagnosticsEngine>(
|
||||
new DiagnosticsEngine(DiagIDs));
|
||||
new DiagnosticsEngine(DiagIDs, new DiagnosticOptions));
|
||||
Diags->setClient(DC.clone(*Diags), /*ShouldOwnClient=*/true);
|
||||
SourceMgr = new SourceManager(*Diags, FileMgr);
|
||||
}
|
||||
|
||||
@@ -484,6 +484,7 @@ void html::HighlightMacros(Rewriter &R, FileID FID, const Preprocessor& PP) {
|
||||
// Temporarily change the diagnostics object so that we ignore any generated
|
||||
// diagnostics from this pass.
|
||||
DiagnosticsEngine TmpDiags(PP.getDiagnostics().getDiagnosticIDs(),
|
||||
&PP.getDiagnostics().getDiagnosticOptions(),
|
||||
new IgnoringDiagConsumer);
|
||||
|
||||
// FIXME: This is a huge hack; we reuse the input preprocessor because we want
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
#include "clang/Frontend/TextDiagnosticPrinter.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "clang/Rewrite/Core/Rewriter.h"
|
||||
@@ -164,12 +164,11 @@ Replacements &RefactoringTool::getReplacements() { return Replace; }
|
||||
int RefactoringTool::run(FrontendActionFactory *ActionFactory) {
|
||||
int Result = Tool.run(ActionFactory);
|
||||
LangOptions DefaultLangOptions;
|
||||
DiagnosticOptions DefaultDiagnosticOptions;
|
||||
TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(),
|
||||
DefaultDiagnosticOptions);
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
|
||||
TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts);
|
||||
DiagnosticsEngine Diagnostics(
|
||||
llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()),
|
||||
&DiagnosticPrinter, false);
|
||||
&*DiagOpts, &DiagnosticPrinter, false);
|
||||
SourceManager Sources(Diagnostics, Tool.getFiles());
|
||||
Rewriter Rewrite(Sources, DefaultLangOptions);
|
||||
if (!applyAllReplacements(Replace, Rewrite)) {
|
||||
|
||||
@@ -159,11 +159,12 @@ bool ToolInvocation::run() {
|
||||
for (int I = 0, E = CommandLine.size(); I != E; ++I)
|
||||
Argv.push_back(CommandLine[I].c_str());
|
||||
const char *const BinaryName = Argv[0];
|
||||
DiagnosticOptions DefaultDiagnosticOptions;
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
|
||||
TextDiagnosticPrinter DiagnosticPrinter(
|
||||
llvm::errs(), DefaultDiagnosticOptions);
|
||||
DiagnosticsEngine Diagnostics(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>(
|
||||
new DiagnosticIDs()), &DiagnosticPrinter, false);
|
||||
llvm::errs(), &*DiagOpts);
|
||||
DiagnosticsEngine Diagnostics(
|
||||
llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>(new DiagnosticIDs()),
|
||||
&*DiagOpts, &DiagnosticPrinter, false);
|
||||
|
||||
const llvm::OwningPtr<clang::driver::Driver> Driver(
|
||||
newDriver(&Diagnostics, BinaryName));
|
||||
|
||||
@@ -105,11 +105,12 @@ public:
|
||||
|
||||
static bool checkForMigration(StringRef resourcesPath,
|
||||
ArrayRef<const char *> Args) {
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
|
||||
DiagnosticConsumer *DiagClient =
|
||||
new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
|
||||
new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts);
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
|
||||
new DiagnosticsEngine(DiagID, DiagClient));
|
||||
new DiagnosticsEngine(DiagID, &*DiagOpts, DiagClient));
|
||||
// Chain in -verify checker, if requested.
|
||||
VerifyDiagnosticConsumer *verifyDiag = 0;
|
||||
if (VerifyDiags) {
|
||||
@@ -150,11 +151,12 @@ static bool performTransformations(StringRef resourcesPath,
|
||||
if (checkForMigration(resourcesPath, Args))
|
||||
return true;
|
||||
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
|
||||
DiagnosticConsumer *DiagClient =
|
||||
new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
|
||||
new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts);
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> TopDiags(
|
||||
new DiagnosticsEngine(DiagID, DiagClient));
|
||||
new DiagnosticsEngine(DiagID, &*DiagOpts, &*DiagClient));
|
||||
|
||||
CompilerInvocation origCI;
|
||||
if (!CompilerInvocation::CreateFromArgs(origCI, Args.begin(), Args.end(),
|
||||
|
||||
@@ -60,7 +60,7 @@ createDiagnostics(unsigned int argc, char **argv) {
|
||||
// well formed diagnostic object.
|
||||
TextDiagnosticBuffer *DiagsBuffer = new TextDiagnosticBuffer;
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> InterimDiags(
|
||||
new DiagnosticsEngine(DiagIDs, DiagsBuffer));
|
||||
new DiagnosticsEngine(DiagIDs, new DiagnosticOptions(), DiagsBuffer));
|
||||
|
||||
// Try to build a CompilerInvocation.
|
||||
OwningPtr<CompilerInvocation> Invocation(
|
||||
@@ -71,7 +71,7 @@ createDiagnostics(unsigned int argc, char **argv) {
|
||||
|
||||
// Build the diagnostics parser
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> FinalDiags =
|
||||
CompilerInstance::createDiagnostics(Invocation->getDiagnosticOpts(),
|
||||
CompilerInstance::createDiagnostics(&Invocation->getDiagnosticOpts(),
|
||||
argc, argv);
|
||||
if (!FinalDiags)
|
||||
return NULL;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "DiagTool.h"
|
||||
#include "DiagnosticNames.h"
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
@@ -50,7 +51,9 @@ static void resetColor(bool ShowColors, llvm::raw_ostream &out) {
|
||||
}
|
||||
|
||||
static clang::DiagnosticsEngine::Level getLevel(unsigned DiagID) {
|
||||
static clang::DiagnosticsEngine Diags(new DiagnosticIDs);
|
||||
// FIXME: This feels like a hack.
|
||||
static clang::DiagnosticsEngine Diags(new DiagnosticIDs,
|
||||
new DiagnosticOptions);
|
||||
return Diags.getDiagnosticLevel(DiagID, SourceLocation());
|
||||
}
|
||||
|
||||
|
||||
@@ -122,8 +122,10 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd,
|
||||
|
||||
// Run clang -cc1 test.
|
||||
if (ArgBegin != ArgEnd && StringRef(ArgBegin[0]) == "-cc1test") {
|
||||
DiagnosticsEngine Diags(DiagID, new TextDiagnosticPrinter(llvm::errs(),
|
||||
DiagnosticOptions()));
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
|
||||
DiagnosticsEngine Diags(DiagID, &*DiagOpts,
|
||||
new TextDiagnosticPrinter(llvm::errs(),
|
||||
&*DiagOpts));
|
||||
return cc1_test(Diags, ArgBegin + 1, ArgEnd);
|
||||
}
|
||||
|
||||
@@ -135,8 +137,9 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd,
|
||||
|
||||
// Buffer diagnostics from argument parsing so that we can output them using a
|
||||
// well formed diagnostic object.
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
|
||||
TextDiagnosticBuffer *DiagsBuffer = new TextDiagnosticBuffer;
|
||||
DiagnosticsEngine Diags(DiagID, DiagsBuffer);
|
||||
DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagsBuffer);
|
||||
bool Success;
|
||||
Success = CompilerInvocation::CreateFromArgs(Clang->getInvocation(),
|
||||
ArgBegin, ArgEnd, Diags);
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
#include "clang/Driver/CC1AsOptions.h"
|
||||
#include "clang/Driver/OptTable.h"
|
||||
#include "clang/Driver/Options.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
#include "clang/Frontend/FrontendDiagnostic.h"
|
||||
#include "clang/Frontend/TextDiagnosticPrinter.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
@@ -394,11 +394,12 @@ int cc1as_main(const char **ArgBegin, const char **ArgEnd,
|
||||
InitializeAllAsmParsers();
|
||||
|
||||
// Construct our diagnostic client.
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
|
||||
TextDiagnosticPrinter *DiagClient
|
||||
= new TextDiagnosticPrinter(errs(), DiagnosticOptions());
|
||||
= new TextDiagnosticPrinter(errs(), &*DiagOpts);
|
||||
DiagClient->setPrefix("clang -cc1as");
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
DiagnosticsEngine Diags(DiagID, DiagClient);
|
||||
DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient);
|
||||
|
||||
// Set an error handler, so that any LLVM backend diagnostics go through our
|
||||
// error handler.
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "clang/Driver/ArgList.h"
|
||||
#include "clang/Driver/Options.h"
|
||||
#include "clang/Driver/Compilation.h"
|
||||
@@ -19,7 +20,6 @@
|
||||
#include "clang/Driver/Option.h"
|
||||
#include "clang/Driver/OptTable.h"
|
||||
#include "clang/Frontend/CompilerInvocation.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
#include "clang/Frontend/TextDiagnosticPrinter.h"
|
||||
#include "clang/Frontend/Utils.h"
|
||||
|
||||
@@ -375,7 +375,7 @@ int main(int argc_, const char **argv_) {
|
||||
|
||||
llvm::sys::Path Path = GetExecutablePath(argv[0], CanonicalPrefixes);
|
||||
|
||||
DiagnosticOptions DiagOpts;
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions;
|
||||
{
|
||||
// Note that ParseDiagnosticArgs() uses the cc1 option table.
|
||||
OwningPtr<OptTable> CC1Opts(createDriverOptTable());
|
||||
@@ -385,17 +385,17 @@ int main(int argc_, const char **argv_) {
|
||||
// We ignore MissingArgCount and the return value of ParseDiagnosticArgs.
|
||||
// Any errors that would be diagnosed here will also be diagnosed later,
|
||||
// when the DiagnosticsEngine actually exists.
|
||||
(void) ParseDiagnosticArgs(DiagOpts, *Args);
|
||||
(void) ParseDiagnosticArgs(*DiagOpts, *Args);
|
||||
}
|
||||
// Now we can create the DiagnosticsEngine with a properly-filled-out
|
||||
// DiagnosticOptions instance.
|
||||
TextDiagnosticPrinter *DiagClient
|
||||
= new TextDiagnosticPrinter(llvm::errs(), DiagOpts);
|
||||
= new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts);
|
||||
DiagClient->setPrefix(llvm::sys::path::stem(Path.str()));
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
|
||||
DiagnosticsEngine Diags(DiagID, DiagClient);
|
||||
ProcessWarningOptions(Diags, DiagOpts);
|
||||
DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient);
|
||||
ProcessWarningOptions(Diags, *DiagOpts);
|
||||
|
||||
#ifdef CLANG_IS_PRODUCTION
|
||||
const bool IsProduction = true;
|
||||
|
||||
@@ -2559,10 +2559,10 @@ static void clang_parseTranslationUnit_Impl(void *UserData) {
|
||||
bool ForSerialization = options & CXTranslationUnit_ForSerialization;
|
||||
|
||||
// Configure the diagnostics.
|
||||
DiagnosticOptions DiagOpts;
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine>
|
||||
Diags(CompilerInstance::createDiagnostics(DiagOpts, num_command_line_args,
|
||||
command_line_args));
|
||||
Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions,
|
||||
num_command_line_args,
|
||||
command_line_args));
|
||||
|
||||
// Recover resources if we crash before exiting this function.
|
||||
llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
|
||||
|
||||
@@ -246,6 +246,8 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults {
|
||||
/// \brief Diagnostics produced while performing code completion.
|
||||
SmallVector<StoredDiagnostic, 8> Diagnostics;
|
||||
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
|
||||
|
||||
/// \brief Diag object
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diag;
|
||||
|
||||
@@ -305,8 +307,10 @@ static llvm::sys::cas_flag CodeCompletionResultObjects;
|
||||
AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults(
|
||||
const FileSystemOptions& FileSystemOpts)
|
||||
: CXCodeCompleteResults(),
|
||||
DiagOpts(new DiagnosticOptions),
|
||||
Diag(new DiagnosticsEngine(
|
||||
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))),
|
||||
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs),
|
||||
&*DiagOpts)),
|
||||
FileSystemOpts(FileSystemOpts),
|
||||
FileMgr(new FileManager(FileSystemOpts)),
|
||||
SourceMgr(new SourceManager(*Diag, *FileMgr)),
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "clang/Frontend/ASTUnit.h"
|
||||
#include "clang/Frontend/FrontendDiagnostic.h"
|
||||
#include "clang/Frontend/DiagnosticRenderer.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
#include "clang/Basic/DiagnosticOptions.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
class CXDiagnosticRenderer : public DiagnosticNoteRenderer {
|
||||
public:
|
||||
CXDiagnosticRenderer(const LangOptions &LangOpts,
|
||||
const DiagnosticOptions &DiagOpts,
|
||||
DiagnosticOptions *DiagOpts,
|
||||
CXDiagnosticSetImpl *mainSet)
|
||||
: DiagnosticNoteRenderer(LangOpts, DiagOpts),
|
||||
CurrentSet(mainSet), MainSet(mainSet) {}
|
||||
@@ -191,9 +191,9 @@ CXDiagnosticSetImpl *cxdiag::lazyCreateDiags(CXTranslationUnit TU,
|
||||
if (!TU->Diagnostics) {
|
||||
CXDiagnosticSetImpl *Set = new CXDiagnosticSetImpl();
|
||||
TU->Diagnostics = Set;
|
||||
DiagnosticOptions DOpts;
|
||||
llvm::IntrusiveRefCntPtr<DiagnosticOptions> DOpts = new DiagnosticOptions;
|
||||
CXDiagnosticRenderer Renderer(AU->getASTContext().getLangOpts(),
|
||||
DOpts, Set);
|
||||
&*DOpts, Set);
|
||||
|
||||
for (ASTUnit::stored_diag_iterator it = AU->stored_diag_begin(),
|
||||
ei = AU->stored_diag_end(); it != ei; ++it) {
|
||||
|
||||
@@ -290,13 +290,13 @@ static void clang_indexSourceFile_Impl(void *UserData) {
|
||||
CaptureDiagnosticConsumer *CaptureDiag = new CaptureDiagnosticConsumer();
|
||||
|
||||
// Configure the diagnostics.
|
||||
DiagnosticOptions DiagOpts;
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine>
|
||||
Diags(CompilerInstance::createDiagnostics(DiagOpts, num_command_line_args,
|
||||
command_line_args,
|
||||
CaptureDiag,
|
||||
/*ShouldOwnClient=*/true,
|
||||
/*ShouldCloneClient=*/false));
|
||||
Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions,
|
||||
num_command_line_args,
|
||||
command_line_args,
|
||||
CaptureDiag,
|
||||
/*ShouldOwnClient=*/true,
|
||||
/*ShouldCloneClient=*/false));
|
||||
|
||||
// Recover resources if we crash before exiting this function.
|
||||
llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
|
||||
|
||||
Reference in New Issue
Block a user