r208512 - Make DiagnosticsEngine non-copyable

Jordan Rose jordan_rose at apple.com
Sun May 11 21:27:16 PDT 2014


Ooh, good call.

On May 11, 2014, at 15:10 , Alp Toker <alp at nuanti.com> wrote:

> Author: alp
> Date: Sun May 11 17:10:52 2014
> New Revision: 208512
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=208512&view=rev
> Log:
> Make DiagnosticsEngine non-copyable
> 
> Also provide an out-of-line dtor for CompilerInvocation.
> 
> Cleanup work that may help reduce header inclusion for IntrusiveRefCntPtr.
> 
> Modified:
>    cfe/trunk/include/clang/Basic/Diagnostic.h
>    cfe/trunk/include/clang/Frontend/CompilerInvocation.h
>    cfe/trunk/lib/AST/MicrosoftMangle.cpp
>    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> 
> Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=208512&r1=208511&r2=208512&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
> +++ cfe/trunk/include/clang/Basic/Diagnostic.h Sun May 11 17:10:52 2014
> @@ -132,6 +132,9 @@ public:
> /// the user. DiagnosticsEngine is tied to one translation unit and one
> /// SourceManager.
> class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
> +  DiagnosticsEngine(const DiagnosticsEngine &) LLVM_DELETED_FUNCTION;
> +  void operator=(const DiagnosticsEngine &) LLVM_DELETED_FUNCTION;
> +
> public:
>   /// \brief The level of the diagnostic, after it has been through mapping.
>   enum Level {
> 
> Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=208512&r1=208511&r2=208512&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
> +++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Sun May 11 17:10:52 2014
> @@ -50,6 +50,8 @@ bool ParseDiagnosticArgs(DiagnosticOptio
>                          DiagnosticsEngine *Diags = nullptr);
> 
> class CompilerInvocationBase : public RefCountedBase<CompilerInvocation> {
> +  void operator=(const CompilerInvocationBase &) LLVM_DELETED_FUNCTION;
> +
> protected:
>   /// Options controlling the language variant.
>   IntrusiveRefCntPtr<LangOptions> LangOpts;
> @@ -68,6 +70,7 @@ protected:
> 
> public:
>   CompilerInvocationBase();
> +  ~CompilerInvocationBase();
> 
>   CompilerInvocationBase(const CompilerInvocationBase &X);
> 
> 
> Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=208512&r1=208511&r2=208512&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
> +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Sun May 11 17:10:52 2014
> @@ -791,7 +791,7 @@ void MicrosoftCXXNameMangler::mangleUnqu
> 
>     case DeclarationName::CXXLiteralOperatorName: {
>       // FIXME: Was this added in VS2010? Does MS even know how to mangle this?
> -      DiagnosticsEngine Diags = Context.getDiags();
> +      DiagnosticsEngine &Diags = Context.getDiags();
>       unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
>         "cannot mangle this literal operator yet");
>       Diags.Report(ND->getLocation(), DiagID);
> @@ -822,7 +822,7 @@ void MicrosoftCXXNameMangler::mangleNest
>     }
> 
>     if (const BlockDecl *BD = dyn_cast<BlockDecl>(DC)) {
> -      DiagnosticsEngine Diags = Context.getDiags();
> +      DiagnosticsEngine &Diags = Context.getDiags();
>       unsigned DiagID =
>           Diags.getCustomDiagID(DiagnosticsEngine::Error,
>                                 "cannot mangle a local inside this block yet");
> 
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=208512&r1=208511&r2=208512&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sun May 11 17:10:52 2014
> @@ -57,6 +57,8 @@ CompilerInvocationBase::CompilerInvocati
>     HeaderSearchOpts(new HeaderSearchOptions(X.getHeaderSearchOpts())),
>     PreprocessorOpts(new PreprocessorOptions(X.getPreprocessorOpts())) {}
> 
> +CompilerInvocationBase::~CompilerInvocationBase() {}
> +
> //===----------------------------------------------------------------------===//
> // Deserialization (from args)
> //===----------------------------------------------------------------------===//
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list