diff options
| -rw-r--r-- | clang/include/clang/AST/ASTContext.h | 12 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 3 | 
2 files changed, 9 insertions, 6 deletions
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 0a184bc2e37..7c0d19c56f9 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -325,12 +325,6 @@ class ASTContext : public RefCountedBase<ASTContext> {    };    llvm::DenseMap<Module*, PerModuleInitializers*> ModuleInitializers; -  /// Diagnostics that are emitted if and only if the given function is -  /// codegen'ed.  Access these through FunctionDecl::addDeferredDiag() and -  /// FunctionDecl::takeDeferredDiags(). -  llvm::DenseMap<const FunctionDecl *, std::vector<PartialDiagnosticAt>> -      DeferredDiags; -  public:    /// \brief A type synonym for the TemplateOrInstantiation mapping.    typedef llvm::PointerUnion<VarTemplateDecl *, MemberSpecializationInfo *> @@ -454,6 +448,12 @@ private:    /// \brief Allocator for partial diagnostics.    PartialDiagnostic::StorageAllocator DiagAllocator; +  /// Diagnostics that are emitted if and only if the given function is +  /// codegen'ed.  Access these through FunctionDecl::addDeferredDiag() and +  /// FunctionDecl::takeDeferredDiags(). +  llvm::DenseMap<const FunctionDecl *, std::vector<PartialDiagnosticAt>> +      DeferredDiags; +    /// \brief The current C++ ABI.    std::unique_ptr<CXXABI> ABI;    CXXABI *createCXXABI(const TargetInfo &T); diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 9bf3ae2752f..845edcd2a17 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -509,6 +509,9 @@ void CodeGenModule::Release() {      DiagnosticBuilder Builder(getDiags().Report(Loc, PD.getDiagID()));      PD.Emit(Builder);    } +  // Clear the deferred diags so they don't outlive the ASTContext's +  // PartialDiagnostic allocator. +  DeferredDiags.clear();  }  void CodeGenModule::UpdateCompletedType(const TagDecl *TD) {  | 

