[cfe-commits] r146715 - /cfe/trunk/lib/Sema/SemaType.cpp
Sean Callanan
scallanan at apple.com
Thu Dec 15 16:20:31 PST 2011
Author: spyffe
Date: Thu Dec 15 18:20:31 2011
New Revision: 146715
URL: http://llvm.org/viewvc/llvm-project?rev=146715&view=rev
Log:
Sema::RequireCompleteType currently attempts to
instantiate a class from its template pattern
before it consults the ExternalASTSource. LLDB
in particular will sometimes provide patterns
that need to be completed first.
To make this possible, I have moved the
completion before the code that does the
instantiation, allowing the ExternalASTSource
to provide the required information.
Modified:
cfe/trunk/lib/Sema/SemaType.cpp
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=146715&r1=146714&r2=146715&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu Dec 15 18:20:31 2011
@@ -4065,6 +4065,34 @@
if (!T->isIncompleteType())
return false;
+ const TagType *Tag = T->getAs<TagType>();
+ const ObjCInterfaceType *IFace = 0;
+
+ if (Tag) {
+ // Avoid diagnosing invalid decls as incomplete.
+ if (Tag->getDecl()->isInvalidDecl())
+ return true;
+
+ // Give the external AST source a chance to complete the type.
+ if (Tag->getDecl()->hasExternalLexicalStorage()) {
+ Context.getExternalSource()->CompleteType(Tag->getDecl());
+ if (!Tag->isIncompleteType())
+ return false;
+ }
+ }
+ else if ((IFace = T->getAs<ObjCInterfaceType>())) {
+ // Avoid diagnosing invalid decls as incomplete.
+ if (IFace->getDecl()->isInvalidDecl())
+ return true;
+
+ // Give the external AST source a chance to complete the type.
+ if (IFace->getDecl()->hasExternalLexicalStorage()) {
+ Context.getExternalSource()->CompleteType(IFace->getDecl());
+ if (!IFace->isIncompleteType())
+ return false;
+ }
+ }
+
// If we have a class template specialization or a class member of a
// class template specialization, or an array with known size of such,
// try to instantiate it.
@@ -4096,34 +4124,6 @@
if (diag == 0)
return true;
-
- const TagType *Tag = T->getAs<TagType>();
- const ObjCInterfaceType *IFace = 0;
-
- if (Tag) {
- // Avoid diagnosing invalid decls as incomplete.
- if (Tag->getDecl()->isInvalidDecl())
- return true;
-
- // Give the external AST source a chance to complete the type.
- if (Tag->getDecl()->hasExternalLexicalStorage()) {
- Context.getExternalSource()->CompleteType(Tag->getDecl());
- if (!Tag->isIncompleteType())
- return false;
- }
- }
- else if ((IFace = T->getAs<ObjCInterfaceType>())) {
- // Avoid diagnosing invalid decls as incomplete.
- if (IFace->getDecl()->isInvalidDecl())
- return true;
-
- // Give the external AST source a chance to complete the type.
- if (IFace->getDecl()->hasExternalLexicalStorage()) {
- Context.getExternalSource()->CompleteType(IFace->getDecl());
- if (!IFace->isIncompleteType())
- return false;
- }
- }
// We have an incomplete type. Produce a diagnostic.
Diag(Loc, PD) << T;
More information about the cfe-commits
mailing list