]> granicus.if.org Git - clang/commitdiff
Add FieldNames to __NSConstantString_tag
authorBen Langmuir <blangmuir@apple.com>
Thu, 25 Feb 2016 16:36:26 +0000 (16:36 +0000)
committerBen Langmuir <blangmuir@apple.com>
Thu, 25 Feb 2016 16:36:26 +0000 (16:36 +0000)
Since consumers of the AST may expect fields to be named.

Patch by Brad King!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261887 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp

index eba35786e81c862ea7472a4fcaf3614cb57e25a3..c6f5374d5c056a9541148c2efb910f625a4513f8 100644 (file)
@@ -4877,21 +4877,27 @@ TypedefDecl *ASTContext::getCFConstantStringDecl() const {
     CFConstantStringTagDecl->startDefinition();
 
     QualType FieldTypes[4];
+    const char *FieldNames[4];
 
     // const int *isa;
     FieldTypes[0] = getPointerType(IntTy.withConst());
+    FieldNames[0] = "isa";
     // int flags;
     FieldTypes[1] = IntTy;
+    FieldNames[1] = "flags";
     // const char *str;
     FieldTypes[2] = getPointerType(CharTy.withConst());
+    FieldNames[2] = "str";
     // long length;
     FieldTypes[3] = LongTy;
+    FieldNames[3] = "length";
 
     // Create fields
     for (unsigned i = 0; i < 4; ++i) {
       FieldDecl *Field = FieldDecl::Create(*this, CFConstantStringTagDecl,
                                            SourceLocation(),
-                                           SourceLocation(), nullptr,
+                                           SourceLocation(),
+                                           &Idents.get(FieldNames[i]),
                                            FieldTypes[i], /*TInfo=*/nullptr,
                                            /*BitWidth=*/nullptr,
                                            /*Mutable=*/false,