aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-11-16 01:44:35 +0000
committerJohn McCall <rjmccall@apple.com>2010-11-16 01:44:35 +0000
commit916c870442978db40404d51348cdf5524e506faa (patch)
tree836553e692f3f670a62b37470d17b2401e78fadb /lib/Sema/SemaType.cpp
parent560ba1472cb6dc574ad726bbe01c8311f6fa9187 (diff)
Add an ExternalASTSource hook to complete a type on demand.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119316 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 6e857a7f3b..fe0916e787 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -2227,16 +2227,19 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T,
if (diag == 0)
return true;
- const TagType *Tag = 0;
- if (const RecordType *Record = T->getAs<RecordType>())
- Tag = Record;
- else if (const EnumType *Enum = T->getAs<EnumType>())
- Tag = Enum;
+ const TagType *Tag = T->getAs<TagType>();
// Avoid diagnosing invalid decls as incomplete.
if (Tag && Tag->getDecl()->isInvalidDecl())
return true;
+ // Give the external AST source a chance to complete the type.
+ if (Tag && Tag->getDecl()->hasExternalLexicalStorage()) {
+ Context.getExternalSource()->CompleteType(Tag->getDecl());
+ if (!Tag->isIncompleteType())
+ return false;
+ }
+
// We have an incomplete type. Produce a diagnostic.
Diag(Loc, PD) << T;