forked from OSchip/llvm-project
Add FieldNames to __NSConstantString_tag
Since consumers of the AST may expect fields to be named. Patch by Brad King! llvm-svn: 261887
This commit is contained in:
parent
f4e35f9cb9
commit
4791a80a30
|
@ -4877,21 +4877,27 @@ TypedefDecl *ASTContext::getCFConstantStringDecl() const {
|
||||||
CFConstantStringTagDecl->startDefinition();
|
CFConstantStringTagDecl->startDefinition();
|
||||||
|
|
||||||
QualType FieldTypes[4];
|
QualType FieldTypes[4];
|
||||||
|
const char *FieldNames[4];
|
||||||
|
|
||||||
// const int *isa;
|
// const int *isa;
|
||||||
FieldTypes[0] = getPointerType(IntTy.withConst());
|
FieldTypes[0] = getPointerType(IntTy.withConst());
|
||||||
|
FieldNames[0] = "isa";
|
||||||
// int flags;
|
// int flags;
|
||||||
FieldTypes[1] = IntTy;
|
FieldTypes[1] = IntTy;
|
||||||
|
FieldNames[1] = "flags";
|
||||||
// const char *str;
|
// const char *str;
|
||||||
FieldTypes[2] = getPointerType(CharTy.withConst());
|
FieldTypes[2] = getPointerType(CharTy.withConst());
|
||||||
|
FieldNames[2] = "str";
|
||||||
// long length;
|
// long length;
|
||||||
FieldTypes[3] = LongTy;
|
FieldTypes[3] = LongTy;
|
||||||
|
FieldNames[3] = "length";
|
||||||
|
|
||||||
// Create fields
|
// Create fields
|
||||||
for (unsigned i = 0; i < 4; ++i) {
|
for (unsigned i = 0; i < 4; ++i) {
|
||||||
FieldDecl *Field = FieldDecl::Create(*this, CFConstantStringTagDecl,
|
FieldDecl *Field = FieldDecl::Create(*this, CFConstantStringTagDecl,
|
||||||
SourceLocation(),
|
SourceLocation(),
|
||||||
SourceLocation(), nullptr,
|
SourceLocation(),
|
||||||
|
&Idents.get(FieldNames[i]),
|
||||||
FieldTypes[i], /*TInfo=*/nullptr,
|
FieldTypes[i], /*TInfo=*/nullptr,
|
||||||
/*BitWidth=*/nullptr,
|
/*BitWidth=*/nullptr,
|
||||||
/*Mutable=*/false,
|
/*Mutable=*/false,
|
||||||
|
|
Loading…
Reference in New Issue