llvm::DenseMap<ObjCMethodDecl*, std::string> MethodInternalNames;
llvm::SmallVector<Stmt *, 32> Stmts;
llvm::SmallVector<int, 8> ObjCBcLabelNo;
- llvm::SmallVector<const RecordType *, 8> EncodingRecordTypes;
unsigned NumObjCStringLiterals;
// Create a new string expression.
QualType StrType = Context->getPointerType(Context->CharTy);
std::string StrEncoding;
- Context->getObjCEncodingForType(Exp->getEncodedType(), StrEncoding,
- EncodingRecordTypes);
+ Context->getObjCEncodingForType(Exp->getEncodedType(), StrEncoding);
Expr *Replacement = new StringLiteral(StrEncoding.c_str(),
StrEncoding.length(), false, StrType,
SourceLocation(), SourceLocation());
Result += (*IVI)->getName();
Result += "\", \"";
std::string StrEncoding;
- Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding,
- EncodingRecordTypes);
+ Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding);
Result += StrEncoding;
Result += "\", ";
SynthesizeIvarOffsetComputation(IDecl, *IVI, Result);
Result += (*IVI)->getName();
Result += "\", \"";
std::string StrEncoding;
- Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding,
- EncodingRecordTypes);
+ Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding);
Result += StrEncoding;
Result += "\", ";
SynthesizeIvarOffsetComputation(IDecl, (*IVI), Result);
llvm::DenseMap<const ObjCInterfaceDecl*,
const ASTRecordLayout*> ASTObjCInterfaces;
- llvm::SmallVector<const RecordType *, 8> EncodingRecordTypes;
-
/// BuiltinVaListType - built-in va list type.
/// This is initially null and set by Sema::LazilyCreateBuiltin when
/// a builtin that takes a valist is encountered.
/// given type into \arg S. If \arg NameFields is specified then
/// record field names are also encoded.
void getObjCEncodingForType(QualType t, std::string &S,
- llvm::SmallVector<const RecordType*,8> &RT,
bool NameFields=false) const;
// Put the string version of type qualifiers into S.
void getObjCEncodingForTypeImpl(QualType t, std::string &S,
bool ExpandPointedToStructures,
bool ExpandStructures,
- llvm::SmallVector<const RecordType*,8> &RT,
bool NameFields) const;
};
// Encode type qualifer, 'in', 'inout', etc. for the return type.
getObjCEncodingForTypeQualifier(Decl->getObjCDeclQualifier(), S);
// Encode result type.
- getObjCEncodingForType(Decl->getResultType(), S, EncodingRecordTypes);
+ getObjCEncodingForType(Decl->getResultType(), S);
// Compute size of all parameters.
// Start with computing size of a pointer in number of bytes.
// FIXME: There might(should) be a better way of doing this computation!
// 'in', 'inout', etc.
getObjCEncodingForTypeQualifier(
Decl->getParamDecl(i)->getObjCDeclQualifier(), S);
- getObjCEncodingForType(PType, S, EncodingRecordTypes);
+ getObjCEncodingForType(PType, S);
S += llvm::utostr(ParmOffset);
ParmOffset += getObjCEncodingTypeSize(PType);
}
// Encode result type.
// FIXME: GCC uses a generating_property_type_encoding mode during
// this part. Investigate.
- getObjCEncodingForType(PD->getType(), S, EncodingRecordTypes);
+ getObjCEncodingForType(PD->getType(), S);
if (PD->isReadOnly()) {
S += ",R";
}
void ASTContext::getObjCEncodingForType(QualType T, std::string& S,
- llvm::SmallVector<const RecordType*,8> &ERType,
bool NameFields) const {
// We follow the behavior of gcc, expanding structures which are
// directly pointed to, and expanding embedded structures. Note that
// these rules are sufficient to prevent recursive encoding of the
// same type.
- getObjCEncodingForTypeImpl(T, S, true, true, ERType, NameFields);
+ getObjCEncodingForTypeImpl(T, S, true, true, NameFields);
}
void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
bool ExpandPointedToStructures,
bool ExpandStructures,
- llvm::SmallVector<const RecordType*,8> &ERType,
bool NameFields) const {
if (const BuiltinType *BT = T->getAsBuiltinType()) {
char encoding;
// Treat id<P...> same as 'id' for encoding purposes.
return getObjCEncodingForTypeImpl(getObjCIdType(), S,
ExpandPointedToStructures,
- ExpandStructures, ERType, NameFields);
+ ExpandStructures, NameFields);
}
else if (const PointerType *PT = T->getAsPointerType()) {
QualType PointeeTy = PT->getPointeeType();
S += '^';
getObjCEncodingForTypeImpl(PT->getPointeeType(), S,
false, ExpandPointedToStructures,
- ERType, NameFields);
+ NameFields);
} else if (const ArrayType *AT =
// Ignore type qualifiers etc.
dyn_cast<ArrayType>(T->getCanonicalTypeInternal())) {
assert(0 && "Unhandled array type!");
getObjCEncodingForTypeImpl(AT->getElementType(), S,
- false, ExpandStructures, ERType, NameFields);
+ false, ExpandStructures, NameFields);
S += ']';
} else if (T->getAsFunctionType()) {
S += '?';
} else {
S += '?';
}
- bool found = false;
- for (unsigned i = 0, e = ERType.size(); i != e; ++i)
- if (ERType[i] == RTy) {
- found = true;
- break;
- }
- if (!found && ExpandStructures) {
- ERType.push_back(RTy);
+ if (ExpandStructures) {
S += '=';
for (int i = 0; i < RDecl->getNumMembers(); i++) {
FieldDecl *FD = RDecl->getMember(i);
S += 'b';
S += llvm::utostr(N);
} else {
- getObjCEncodingForTypeImpl(FD->getType(), S, false, true,
- ERType, NameFields);
+ getObjCEncodingForTypeImpl(FD->getType(), S, false, true, NameFields);
}
}
- assert(ERType.back() == RTy && "Record Type stack mismatch.");
- ERType.pop_back();
}
S += RDecl->isUnion() ? ')' : '}';
} else if (T->isEnumeralType()) {