r283271 - [CUDA] Destroy deferred diagnostics before destroying the ASTContext's PartialDiagnostic allocator.
Justin Lebar via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 4 16:41:46 PDT 2016
Author: jlebar
Date: Tue Oct 4 18:41:45 2016
New Revision: 283271
URL: http://llvm.org/viewvc/llvm-project?rev=283271&view=rev
Log:
[CUDA] Destroy deferred diagnostics before destroying the ASTContext's PartialDiagnostic allocator.
Summary:
This will let us (in a separate patch) allocate deferred diagnostics in
the ASTContext's PartialDiagnostic arena.
Reviewers: rnk
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25260
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=283271&r1=283270&r2=283271&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Tue Oct 4 18:41:45 2016
@@ -325,12 +325,6 @@ class ASTContext : public RefCountedBase
};
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);
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=283271&r1=283270&r2=283271&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Oct 4 18:41:45 2016
@@ -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) {
More information about the cfe-commits
mailing list