]> granicus.if.org Git - clang/commitdiff
Make DiagnosticsEngine non-copyable
authorAlp Toker <alp@nuanti.com>
Sun, 11 May 2014 22:10:52 +0000 (22:10 +0000)
committerAlp Toker <alp@nuanti.com>
Sun, 11 May 2014 22:10:52 +0000 (22:10 +0000)
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

include/clang/Basic/Diagnostic.h
include/clang/Frontend/CompilerInvocation.h
lib/AST/MicrosoftMangle.cpp
lib/Frontend/CompilerInvocation.cpp

index 1e2e5e06b0ecfc514d1e13527972e41171cf9d88..f4cc7fd38b6326bc6e0077d145fd35ac33747c5b 100644 (file)
@@ -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 {
index e6d79d81cb90c14a8cc3e6da6a54ddb834f50368..3d7467cb14861a05ae30c83d8b82f4b0d112bd37 100644 (file)
@@ -50,6 +50,8 @@ bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args,
                          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);
   
index b615c6f17f4cdfd759ee7d9f1c23747461ce375b..8a857609754b3ad181da60d1bd8d3d17e1bf8bb1 100644 (file)
@@ -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<BlockDecl>(DC)) {
-      DiagnosticsEngine Diags = Context.getDiags();
+      DiagnosticsEngine &Diags = Context.getDiags();
       unsigned DiagID =
           Diags.getCustomDiagID(DiagnosticsEngine::Error,
                                 "cannot mangle a local inside this block yet");
index 076572e7505bb108e2b089136da624e926f0b347..6aeb9c6502e940d98d05436b5bd7ab07a55406d4 100644 (file)
@@ -57,6 +57,8 @@ CompilerInvocationBase::CompilerInvocationBase(const CompilerInvocationBase &X)
     HeaderSearchOpts(new HeaderSearchOptions(X.getHeaderSearchOpts())),
     PreprocessorOpts(new PreprocessorOptions(X.getPreprocessorOpts())) {}
 
+CompilerInvocationBase::~CompilerInvocationBase() {}
+
 //===----------------------------------------------------------------------===//
 // Deserialization (from args)
 //===----------------------------------------------------------------------===//