summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-12-06 09:56:30 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-12-06 09:56:30 +0000
commit1597da4c05501ae592d1eabe86a8466337a76ded (patch)
treedfa6b46eb2cace0d1d5b5aa923ddf682829a3e6a /clang
parenta6cb9f21be1aa41396943df2a93437ab843e983d (diff)
downloadbcm5719-llvm-1597da4c05501ae592d1eabe86a8466337a76ded.tar.gz
bcm5719-llvm-1597da4c05501ae592d1eabe86a8466337a76ded.zip
Document that CompilerInvocation::createDiagnostics keeps a reference to the DiagnosticOptions, and update callers to make sure they don't pass in a temporary.
llvm-svn: 90704
Diffstat (limited to 'clang')
-rw-r--r--clang/examples/wpa/clang-wpa.cpp3
-rw-r--r--clang/include/clang/Frontend/CompilerInstance.h6
-rw-r--r--clang/tools/CIndex/CIndex.cpp3
-rw-r--r--clang/tools/index-test/index-test.cpp3
4 files changed, 11 insertions, 4 deletions
diff --git a/clang/examples/wpa/clang-wpa.cpp b/clang/examples/wpa/clang-wpa.cpp
index cca7907ba09..ae789fa9ae3 100644
--- a/clang/examples/wpa/clang-wpa.cpp
+++ b/clang/examples/wpa/clang-wpa.cpp
@@ -33,8 +33,9 @@ int main(int argc, char **argv) {
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];
diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h
index 27153b63c83..18ec429db7e 100644
--- a/clang/include/clang/Frontend/CompilerInstance.h
+++ b/clang/include/clang/Frontend/CompilerInstance.h
@@ -419,9 +419,13 @@ public:
/// 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);
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp
index 9259818e0ec..5e8e02df1a9 100644
--- a/clang/tools/CIndex/CIndex.cpp
+++ b/clang/tools/CIndex/CIndex.cpp
@@ -292,6 +292,7 @@ public:
};
class CIndexer : public Indexer {
+ DiagnosticOptions DiagOpts;
IgnoreDiagnosticsClient IgnoreDiagClient;
llvm::OwningPtr<Diagnostic> TextDiags;
Diagnostic IgnoreDiags;
@@ -308,7 +309,7 @@ public:
OnlyLocalDecls(false),
DisplayDiagnostics(false) {
TextDiags.reset(
- CompilerInstance::createDiagnostics(DiagnosticOptions(), 0, 0));
+ CompilerInstance::createDiagnostics(DiagOpts, 0, 0));
}
virtual ~CIndexer() { delete &getProgram(); }
diff --git a/clang/tools/index-test/index-test.cpp b/clang/tools/index-test/index-test.cpp
index d13b2d49264..0b1971f797c 100644
--- a/clang/tools/index-test/index-test.cpp
+++ b/clang/tools/index-test/index-test.cpp
@@ -238,8 +238,9 @@ int main(int argc, char **argv) {
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())
OpenPOWER on IntegriCloud