Revert various template unreachability code I committed accidentally.

r148774, r148775, r148776, r148777

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148780 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp
index c7040fc..7b84710 100644
--- a/lib/Analysis/CFG.cpp
+++ b/lib/Analysis/CFG.cpp
@@ -721,7 +721,7 @@
     }
     
     const CXXDestructorDecl *Dtor = Ty->getAsCXXRecordDecl()->getDestructor();
-    if (Dtor && cast<FunctionType>(Dtor->getType())->getNoReturnAttr())
+    if (cast<FunctionType>(Dtor->getType())->getNoReturnAttr())
       Block = createNoReturnBlock();
     else
       autoCreateBlock();
@@ -750,12 +750,13 @@
   // Before virtual bases destroy direct base objects.
   for (CXXRecordDecl::base_class_const_iterator BI = RD->bases_begin(),
       BE = RD->bases_end(); BI != BE; ++BI) {
-    if (!BI->isVirtual())
-      if (const CXXRecordDecl *CD = BI->getType()->getAsCXXRecordDecl())
-        if (!CD->hasTrivialDestructor()) {
-          autoCreateBlock();
-          appendBaseDtor(Block, BI);
-        }
+    if (!BI->isVirtual()) {
+      const CXXRecordDecl *CD = BI->getType()->getAsCXXRecordDecl();
+      if (!CD->hasTrivialDestructor()) {
+        autoCreateBlock();
+        appendBaseDtor(Block, BI);
+      }
+    }
   }
 
   // First destroy member objects.
@@ -864,7 +865,7 @@
 
   // Check if type is a C++ class with non-trivial destructor.
   if (const CXXRecordDecl *CD = QT->getAsCXXRecordDecl())
-    if (CD->hasDefinition() && !CD->hasTrivialDestructor()) {
+    if (!CD->hasTrivialDestructor()) {
       // Add the variable to scope
       Scope = createOrReuseLocalScope(Scope);
       Scope->addVar(VD);
diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp
index 5f1d8cc..e2d1e8c 100644
--- a/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/lib/Sema/AnalysisBasedWarnings.cpp
@@ -782,7 +782,8 @@
     return;
 
   // For code in dependent contexts, we'll do this at instantiation time.
-  bool Dependent = cast<DeclContext>(D)->isDependentContext();
+  if (cast<DeclContext>(D)->isDependentContext())
+    return;
 
   if (Diags.hasErrorOccurred() || Diags.hasFatalErrorOccurred()) {
     // Flush out any possibly unreachable diagnostics.
@@ -825,7 +826,7 @@
   // Construct the analysis context with the specified CFG build options.
   
   // Emit delayed diagnostics.
-  if (!fscope->PossiblyUnreachableDiags.empty() && !Dependent) {
+  if (!fscope->PossiblyUnreachableDiags.empty()) {
     bool analyzed = false;
 
     // Register the expressions with the CFGBuilder.
@@ -873,7 +874,7 @@
   
   
   // Warning: check missing 'return'
-  if (P.enableCheckFallThrough && !Dependent) {
+  if (P.enableCheckFallThrough) {
     const CheckFallThroughDiagnostics &CD =
       (isa<BlockDecl>(D) ? CheckFallThroughDiagnostics::MakeForBlock()
                          : CheckFallThroughDiagnostics::MakeForFunction(D));
@@ -894,7 +895,7 @@
   }
 
   // Check for thread safety violations
-  if (P.enableThreadSafetyAnalysis && !Dependent) {
+  if (P.enableThreadSafetyAnalysis) {
     SourceLocation FL = AC.getDecl()->getLocation();
     thread_safety::ThreadSafetyReporter Reporter(S, FL);
     thread_safety::runThreadSafetyAnalysis(AC, Reporter);