DeclTy **Elements, unsigned NumElements);
private:
/// Subroutines of ActOnDeclarator()...
- TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, ScopedDecl *LastDecl);
+ TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, QualType T,
+ ScopedDecl *LastDecl);
TypedefDecl *MergeTypeDefDecl(TypedefDecl *New, ScopedDecl *Old);
FunctionDecl *MergeFunctionDecl(FunctionDecl *New, ScopedDecl *Old);
VarDecl *MergeVarDecl(VarDecl *New, ScopedDecl *Old);
ScopedDecl *New;
bool InvalidDecl = false;
+ QualType R = GetTypeForDeclarator(D, S);
+ assert(!R.isNull() && "GetTypeForDeclarator() returned null type");
+
if (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef) {
- TypedefDecl *NewTD = ParseTypedefDecl(S, D, LastDeclarator);
+ TypedefDecl *NewTD = ParseTypedefDecl(S, D, R, LastDeclarator);
if (!NewTD) return 0;
// Handle attributes prior to checking for duplicates in MergeVarDecl
InvalidDecl = true;
}
}
- } else if (D.isFunctionDeclarator()) {
- QualType R = GetTypeForDeclarator(D, S);
- assert(!R.isNull() && "GetTypeForDeclarator() returned null type");
-
+ } else if (R.getTypePtr()->isFunctionType()) {
FunctionDecl::StorageClass SC = FunctionDecl::None;
switch (D.getDeclSpec().getStorageClassSpec()) {
default: assert(0 && "Unknown storage class!");
}
New = NewFD;
} else {
- QualType R = GetTypeForDeclarator(D, S);
- assert(!R.isNull() && "GetTypeForDeclarator() returned null type");
if (R.getTypePtr()->isObjcInterfaceType()) {
Diag(D.getIdentifierLoc(), diag::err_statically_allocated_object,
D.getIdentifier()->getName());
}
-TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D,
+TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T,
ScopedDecl *LastDeclarator) {
assert(D.getIdentifier() && "Wrong callback for declspec without declarator");
-
- QualType T = GetTypeForDeclarator(D, S);
assert(!T.isNull() && "GetTypeForDeclarator() returned null type");
// Scope manipulation handled by caller.