diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-13 01:26:44 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-13 01:26:44 +0000 |
commit | 78243658c533168d51fd076fba328437932ba6f1 (patch) | |
tree | 5ac50b68c9aacb2e986d1a4afecfcdbab1d1f931 /include/clang/Frontend | |
parent | 21cae2059a06f7d89eee169409c9266def1b1aca (diff) |
When compiling a module on-demand, re-use the diagnostics client
already provided. This required a little bit of clean-up in the way
that VerifyDiagnosticsClient managed ownership of its underlying
"primary" client, because now it will no longer always take ownership.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 7 | ||||
-rw-r--r-- | include/clang/Frontend/VerifyDiagnosticsClient.h | 10 |
2 files changed, 11 insertions, 6 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 88f8976b67..c61d6df196 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -457,8 +457,12 @@ public: /// \param Client If non-NULL, a diagnostic client that will be /// attached to (and, then, owned by) the Diagnostic inside this AST /// unit. + /// + /// \param ShouldOwnClient If Client is non-NULL, specifies whether + /// the diagnostic object should take ownership of the client. void createDiagnostics(int Argc, const char* const *Argv, - DiagnosticClient *Client = 0); + DiagnosticClient *Client = 0, + bool ShouldOwnClient = true); /// Create a Diagnostic object with a the TextDiagnosticPrinter. /// @@ -487,6 +491,7 @@ public: createDiagnostics(const DiagnosticOptions &Opts, int Argc, const char* const *Argv, DiagnosticClient *Client = 0, + bool ShouldOwnClient = true, const CodeGenOptions *CodeGenOpts = 0); /// Create the file manager and replace any existing one with it. diff --git a/include/clang/Frontend/VerifyDiagnosticsClient.h b/include/clang/Frontend/VerifyDiagnosticsClient.h index 988a589cfe..0c789ff86d 100644 --- a/include/clang/Frontend/VerifyDiagnosticsClient.h +++ b/include/clang/Frontend/VerifyDiagnosticsClient.h @@ -65,7 +65,8 @@ class TextDiagnosticBuffer; class VerifyDiagnosticsClient : public DiagnosticClient { public: Diagnostic &Diags; - llvm::OwningPtr<DiagnosticClient> PrimaryClient; + DiagnosticClient *PrimaryClient; + bool OwnsPrimaryClient; llvm::OwningPtr<TextDiagnosticBuffer> Buffer; Preprocessor *CurrentPreprocessor; @@ -75,10 +76,9 @@ private: public: /// Create a new verifying diagnostic client, which will issue errors to \arg - /// PrimaryClient when a diagnostic does not match what is expected (as - /// indicated in the source file). The verifying diagnostic client takes - /// ownership of \arg PrimaryClient. - VerifyDiagnosticsClient(Diagnostic &Diags, DiagnosticClient *PrimaryClient); + /// the currently-attached diagnostic client when a diagnostic does not match + /// what is expected (as indicated in the source file). + VerifyDiagnosticsClient(Diagnostic &Diags); ~VerifyDiagnosticsClient(); virtual void BeginSourceFile(const LangOptions &LangOpts, |