From: Alp Toker Date: Sun, 11 May 2014 22:10:52 +0000 (+0000) Subject: Make DiagnosticsEngine non-copyable X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ef92c4ee73840460bdd8e6ff9268738210183d6;p=clang Make DiagnosticsEngine non-copyable Also provide an out-of-line dtor for CompilerInvocation. Cleanup work that may help reduce header inclusion for IntrusiveRefCntPtr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208512 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 1e2e5e06b0..f4cc7fd38b 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -132,6 +132,9 @@ public: /// the user. DiagnosticsEngine is tied to one translation unit and one /// SourceManager. class DiagnosticsEngine : public RefCountedBase { + 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 { diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index e6d79d81cb..3d7467cb14 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -50,6 +50,8 @@ bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args, DiagnosticsEngine *Diags = nullptr); class CompilerInvocationBase : public RefCountedBase { + void operator=(const CompilerInvocationBase &) LLVM_DELETED_FUNCTION; + protected: /// Options controlling the language variant. IntrusiveRefCntPtr LangOpts; @@ -68,6 +70,7 @@ protected: public: CompilerInvocationBase(); + ~CompilerInvocationBase(); CompilerInvocationBase(const CompilerInvocationBase &X); diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index b615c6f17f..8a85760975 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -791,7 +791,7 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND, 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::mangleNestedName(const NamedDecl *ND) { } if (const BlockDecl *BD = dyn_cast(DC)) { - DiagnosticsEngine Diags = Context.getDiags(); + DiagnosticsEngine &Diags = Context.getDiags(); unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error, "cannot mangle a local inside this block yet"); diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 076572e750..6aeb9c6502 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -57,6 +57,8 @@ CompilerInvocationBase::CompilerInvocationBase(const CompilerInvocationBase &X) HeaderSearchOpts(new HeaderSearchOptions(X.getHeaderSearchOpts())), PreprocessorOpts(new PreprocessorOptions(X.getPreprocessorOpts())) {} +CompilerInvocationBase::~CompilerInvocationBase() {} + //===----------------------------------------------------------------------===// // Deserialization (from args) //===----------------------------------------------------------------------===//