[cfe-commits] r90704 - in /cfe/trunk: examples/wpa/clang-wpa.cpp include/clang/Frontend/CompilerInstance.h tools/CIndex/CIndex.cpp tools/index-test/index-test.cpp
Daniel Dunbar
daniel at zuster.org
Sun Dec 6 01:56:31 PST 2009
Author: ddunbar
Date: Sun Dec 6 03:56:30 2009
New Revision: 90704
URL: http://llvm.org/viewvc/llvm-project?rev=90704&view=rev
Log:
Document that CompilerInvocation::createDiagnostics keeps a reference to the DiagnosticOptions, and update callers to make sure they don't pass in a temporary.
Modified:
cfe/trunk/examples/wpa/clang-wpa.cpp
cfe/trunk/include/clang/Frontend/CompilerInstance.h
cfe/trunk/tools/CIndex/CIndex.cpp
cfe/trunk/tools/index-test/index-test.cpp
Modified: cfe/trunk/examples/wpa/clang-wpa.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/wpa/clang-wpa.cpp?rev=90704&r1=90703&r2=90704&view=diff
==============================================================================
--- cfe/trunk/examples/wpa/clang-wpa.cpp (original)
+++ cfe/trunk/examples/wpa/clang-wpa.cpp Sun Dec 6 03:56:30 2009
@@ -33,8 +33,9 @@
if (InputFilenames.empty())
return 0;
+ DiagnosticOptions DiagOpts;
llvm::OwningPtr<Diagnostic> Diags(
- CompilerInstance::createDiagnostics(DiagnosticOptions(), argc, argv));
+ CompilerInstance::createDiagnostics(DiagOpts, argc, argv));
for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
const std::string &InFile = InputFilenames[i];
Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=90704&r1=90703&r2=90704&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Sun Dec 6 03:56:30 2009
@@ -419,9 +419,13 @@
/// logging information.
///
/// Note that this creates an unowned DiagnosticClient, if using directly the
- /// caller is responsible for releaseing the returned Diagnostic's client
+ /// caller is responsible for releasing the returned Diagnostic'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.
+ ///
/// \return The new object on success, or null on failure.
static Diagnostic *createDiagnostics(const DiagnosticOptions &Opts,
int Argc, char **Argv);
Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=90704&r1=90703&r2=90704&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Sun Dec 6 03:56:30 2009
@@ -292,6 +292,7 @@
};
class CIndexer : public Indexer {
+ DiagnosticOptions DiagOpts;
IgnoreDiagnosticsClient IgnoreDiagClient;
llvm::OwningPtr<Diagnostic> TextDiags;
Diagnostic IgnoreDiags;
@@ -308,7 +309,7 @@
OnlyLocalDecls(false),
DisplayDiagnostics(false) {
TextDiags.reset(
- CompilerInstance::createDiagnostics(DiagnosticOptions(), 0, 0));
+ CompilerInstance::createDiagnostics(DiagOpts, 0, 0));
}
virtual ~CIndexer() { delete &getProgram(); }
Modified: cfe/trunk/tools/index-test/index-test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/index-test/index-test.cpp?rev=90704&r1=90703&r2=90704&view=diff
==============================================================================
--- cfe/trunk/tools/index-test/index-test.cpp (original)
+++ cfe/trunk/tools/index-test/index-test.cpp Sun Dec 6 03:56:30 2009
@@ -238,8 +238,9 @@
Indexer Idxer(Prog);
llvm::SmallVector<TUnit*, 4> TUnits;
+ DiagnosticOptions DiagOpts;
llvm::OwningPtr<Diagnostic> Diags(
- CompilerInstance::createDiagnostics(DiagnosticOptions(), argc, argv));
+ CompilerInstance::createDiagnostics(DiagOpts, argc, argv));
// If no input was specified, read from stdin.
if (InputFilenames.empty())
More information about the cfe-commits
mailing list