From bf40cb518312dde1c07e44fcae59bc4eec65589c Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 15 Jul 2010 23:40:35 +0000 Subject: When deferring the emission of declarations with initializers in C++, remember the order they appeared in the translation unit. If they get emitted, put them in their proper order. Fixes rdar://problem/7458115 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108477 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index 27f15fc018..05d02ec0a0 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -162,6 +162,12 @@ class CodeGenModule : public BlockModule { /// CXXGlobalInits - Global variables with initializers that need to run /// before main. std::vector CXXGlobalInits; + + /// When a C++ decl with an initializer is deferred, null is + /// appended to CXXGlobalInits, and the index of that null is placed + /// here so that the initializer will be performed in the correct + /// order. + llvm::DenseMap DelayedCXXInitPosition; /// - Global variables with initializers whose order of initialization /// is set by init_priority attribute. -- cgit v1.2.3-70-g09d2