Make parsing a semantic analysis a little more robust following Sema
failures that involve malformed types, e.g., "typename X::foo" where
"foo" isn't a type, or "std::vector<void>" that doens't instantiate
properly.

Similarly, be a bit smarter in our handling of ambiguities that occur
in Sema::getTypeName, to eliminate duplicate error messages about
ambiguous name lookup.

This eliminates two XFAILs in test/SemaCXX, one of which was crying
out to us, trying to tell us that we were producing repeated error
messages.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68251 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaInherit.h b/lib/Sema/SemaInherit.h
index 6138685..20c8ae5 100644
--- a/lib/Sema/SemaInherit.h
+++ b/lib/Sema/SemaInherit.h
@@ -132,8 +132,16 @@
     /// DetectedVirtual - The base class that is virtual.
     const RecordType *DetectedVirtual;
 
+    /// \brief Array of the declarations that have been found. This
+    /// array is constructed only if needed, e.g., to iterate over the
+    /// results within LookupResult.
+    NamedDecl **DeclsFound;
+    unsigned NumDeclsFound;
+
     friend class Sema;
 
+    void ComputeDeclsFound();
+
   public:
     typedef std::list<BasePath>::const_iterator paths_iterator;
     
@@ -143,15 +151,21 @@
                        bool RecordPaths = true,
                        bool DetectVirtual = true)
       : FindAmbiguities(FindAmbiguities), RecordPaths(RecordPaths),
-        DetectVirtual(DetectVirtual), DetectedVirtual(0)
+        DetectVirtual(DetectVirtual), DetectedVirtual(0), DeclsFound(0),
+        NumDeclsFound(0)
     {}
 
+    ~BasePaths() { delete [] DeclsFound; }
+
     paths_iterator begin() const { return Paths.begin(); }
     paths_iterator end()   const { return Paths.end(); }
 
     BasePath&       front()       { return Paths.front(); }
     const BasePath& front() const { return Paths.front(); }
 
+    NamedDecl **found_decls_begin();
+    NamedDecl **found_decls_end();
+
     bool isAmbiguous(QualType BaseType);
 
     /// isFindingAmbiguities - Whether we are finding multiple paths