/// warnings and errors.
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const Diagnostic &Info);
-
- /// \brief Clone the diagnostic consumer, producing an equivalent consumer
- /// that can be used in a different context.
- virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const = 0;
};
/// \brief A diagnostic client that ignores all diagnostics.
const Diagnostic &Info) {
// Just ignore it.
}
- DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
- return new IgnoringDiagConsumer();
- }
};
/// \brief Diagnostic consumer that forwards diagnostics along to an
virtual void clear();
virtual bool IncludeInDiagnosticCounts() const;
-
- virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
};
// Struct used for sending info about how a type should be printed.
Primary->HandleDiagnostic(DiagLevel, Info);
Secondary->HandleDiagnostic(DiagLevel, Info);
}
-
- DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
- return new ChainedDiagnosticConsumer(Primary->clone(Diags),
- Secondary->clone(Diags));
- }
-
};
} // end namspace clang
///
/// \param ShouldOwnClient If Client is non-NULL, specifies whether
/// the diagnostic object should take ownership of the client.
- ///
- /// \param ShouldCloneClient If Client is non-NULL, specifies whether that
- /// client should be cloned.
void createDiagnostics(DiagnosticConsumer *Client = 0,
- bool ShouldOwnClient = true,
- bool ShouldCloneClient = true);
+ bool ShouldOwnClient = true);
/// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
///
createDiagnostics(DiagnosticOptions *Opts,
DiagnosticConsumer *Client = 0,
bool ShouldOwnClient = true,
- bool ShouldCloneClient = true,
const CodeGenOptions *CodeGenOpts = 0);
/// Create the file manager and replace any existing one with it.
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const Diagnostic &Info);
-
- DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
};
} // end namespace clang
/// FlushDiagnostics - Flush the buffered diagnostics to an given
/// diagnostic engine.
void FlushDiagnostics(DiagnosticsEngine &Diags) const;
-
- virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
};
} // end namspace clang
void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP);
void EndSourceFile();
void HandleDiagnostic(DiagnosticsEngine::Level Level, const Diagnostic &Info);
- DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
};
} // end namespace clang
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const Diagnostic &Info);
-
- virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
};
} // end namspace clang
/// \brief Emit a diagnostic via the adapted diagnostic client.
void Diag(SourceLocation Loc, unsigned DiagID);
-
- DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
};
}
// Non-ARC warnings are ignored.
Diags.setLastDiagnosticIgnored();
}
-
- DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
- // Just drop any diagnostics that come from cloned consumers; they'll
- // have different source managers anyway.
- return new IgnoringDiagConsumer();
- }
};
} // end anonymous namespace
return Target.IncludeInDiagnosticCounts();
}
-DiagnosticConsumer *
-ForwardingDiagnosticConsumer::clone(DiagnosticsEngine &Diags) const {
- return new ForwardingDiagnosticConsumer(Target);
-}
-
PartialDiagnostic::StorageAllocator::StorageAllocator() {
for (unsigned I = 0; I != NumCached; ++I)
FreeList[I] = Cached + I;
virtual void HandleDiagnostic(DiagnosticsEngine::Level Level,
const Diagnostic &Info);
-
- DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
- // Just drop any diagnostics that come from cloned consumers; they'll
- // have different source managers anyway.
- // FIXME: We'd like to be able to capture these somehow, even if it's just
- // file/line/column, because they could occur when parsing module maps or
- // building modules on-demand.
- return new IgnoringDiagConsumer();
- }
};
/// \brief RAII object that optionally captures diagnostics, if
Client = new StoredDiagnosticConsumer(AST.StoredDiagnostics);
Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions(),
Client,
- /*ShouldOwnClient=*/true,
- /*ShouldCloneClient=*/false);
+ /*ShouldOwnClient=*/true);
} else if (CaptureDiagnostics) {
Diags->setClient(new StoredDiagnosticConsumer(AST.StoredDiagnostics));
}
}
void CompilerInstance::createDiagnostics(DiagnosticConsumer *Client,
- bool ShouldOwnClient,
- bool ShouldCloneClient) {
+ bool ShouldOwnClient) {
Diagnostics = createDiagnostics(&getDiagnosticOpts(), Client,
- ShouldOwnClient, ShouldCloneClient,
- &getCodeGenOpts());
+ ShouldOwnClient, &getCodeGenOpts());
}
IntrusiveRefCntPtr<DiagnosticsEngine>
CompilerInstance::createDiagnostics(DiagnosticOptions *Opts,
DiagnosticConsumer *Client,
bool ShouldOwnClient,
- bool ShouldCloneClient,
const CodeGenOptions *CodeGenOpts) {
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
IntrusiveRefCntPtr<DiagnosticsEngine>
// Create the diagnostic client for reporting errors or for
// implementing -verify.
if (Client) {
- if (ShouldCloneClient)
- Diags->setClient(Client->clone(*Diags), ShouldOwnClient);
- else
- Diags->setClient(Client, ShouldOwnClient);
+ Diags->setClient(Client, ShouldOwnClient);
} else
Diags->setClient(new TextDiagnosticPrinter(llvm::errs(), Opts));
Instance.createDiagnostics(new ForwardingDiagnosticConsumer(
ImportingInstance.getDiagnosticClient()),
- /*ShouldOwnClient=*/true,
- /*ShouldCloneClient=*/false);
+ /*ShouldOwnClient=*/true);
// Note that this module is part of the module build stack, so that we
// can detect cycles in the module graph.
Entries.push_back(DE);
}
-DiagnosticConsumer *
-LogDiagnosticPrinter::clone(DiagnosticsEngine &Diags) const {
- return new LogDiagnosticPrinter(OS, &*DiagOpts, /*OwnsOutputStream=*/false);
-}
-
virtual void finish();
- DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
- return new SDiagsWriter(State);
- }
-
private:
/// \brief Emit the preamble for the serialized diagnostics.
void EmitPreamble();
escapeDiag(it->second, Buf)));
}
-DiagnosticConsumer *TextDiagnosticBuffer::clone(DiagnosticsEngine &) const {
- return new TextDiagnosticBuffer();
-}
OS.flush();
}
-
-DiagnosticConsumer *
-TextDiagnosticPrinter::clone(DiagnosticsEngine &Diags) const {
- return new TextDiagnosticPrinter(OS, &*DiagOpts, /*OwnsOutputStream=*/false);
-}
ED.Notes.clear();
}
-DiagnosticConsumer *
-VerifyDiagnosticConsumer::clone(DiagnosticsEngine &Diags) const {
- if (!Diags.getClient())
- Diags.setClient(PrimaryClient->clone(Diags));
-
- return new VerifyDiagnosticConsumer(Diags);
-}
-
Directive *Directive::create(bool RegexKind, SourceLocation DirectiveLoc,
SourceLocation DiagnosticLoc, StringRef Text,
unsigned Min, unsigned Max) {
Diags.setClient(this);
}
-DiagnosticConsumer *FixItRewriter::clone(DiagnosticsEngine &Diags) const {
- return new FixItRewriter(Diags, Diags.getSourceManager(),
- Rewrite.getLangOpts(), FixItOpts);
-}
-
FixItOptions::~FixItOptions() {}
if (level >= DiagnosticsEngine::Error)
Errors.push_back(StoredDiagnostic(level, Info));
}
-
- DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
- return new IgnoringDiagConsumer();
- }
};
//===----------------------------------------------------------------------===//
IntrusiveRefCntPtr<DiagnosticsEngine>
Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions,
CaptureDiag,
- /*ShouldOwnClient=*/true,
- /*ShouldCloneClient=*/false));
+ /*ShouldOwnClient=*/true));
// Recover resources if we crash before exiting this function.
llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,