Fix another regression from the "skip vtable pointer initialization"
optimization. Make sure to require a vtable when trying to get the address
of a VTT, otherwise we would never end up emitting the VTT.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131400 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp
index 8b4684c..0d25008 100644
--- a/lib/CodeGen/CGClass.cpp
+++ b/lib/CodeGen/CGClass.cpp
@@ -812,7 +812,7 @@
 /// CanSkipVTablePointerInitialization - Check whether we need to initialize
 /// any vtable pointers before calling this destructor.
 static bool CanSkipVTablePointerInitialization(ASTContext &Context,
-                                           const CXXDestructorDecl *Dtor) {
+                                               const CXXDestructorDecl *Dtor) {
   if (!Dtor->hasTrivialBody())
     return false;
 
diff --git a/lib/CodeGen/CGVTT.cpp b/lib/CodeGen/CGVTT.cpp
index a6849f8..aefc41e 100644
--- a/lib/CodeGen/CGVTT.cpp
+++ b/lib/CodeGen/CGVTT.cpp
@@ -411,6 +411,8 @@
   Out.flush();
   llvm::StringRef Name = OutName.str();
 
+  ComputeVTableRelatedInformation(RD, /*VTableRequired=*/true);
+
   VTTBuilder Builder(CGM, RD, /*GenerateDefinition=*/false);
 
   const llvm::Type *Int8PtrTy = 
diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp
index c7ef9c7..9ac5e67 100644
--- a/lib/CodeGen/CGVTables.cpp
+++ b/lib/CodeGen/CGVTables.cpp
@@ -3175,7 +3175,7 @@
   Out.flush();
   llvm::StringRef Name = OutName.str();
 
-  ComputeVTableRelatedInformation(RD, true);
+  ComputeVTableRelatedInformation(RD, /*VTableRequired=*/true);
   
   const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext());
   llvm::ArrayType *ArrayType =