]> granicus.if.org Git - clang/commitdiff
Put back the flags field in the constant CF string type.
authorAnders Carlsson <andersca@mac.com>
Mon, 19 Nov 2007 00:25:30 +0000 (00:25 +0000)
committerAnders Carlsson <andersca@mac.com>
Mon, 19 Nov 2007 00:25:30 +0000 (00:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44222 91177308-0d34-0410-b5e6-96231b3b80d8

AST/ASTContext.cpp
test/CodeGen/cfstring.c [new file with mode: 0644]

index 9d597bcc4306b3e79af0bab2982e81345ac01ee4..740d6e56fab6afe43102e812143e4b7d148e8157 100644 (file)
@@ -870,18 +870,20 @@ QualType ASTContext::getCFConstantStringType() {
     CFConstantStringTypeDecl = new RecordDecl(Decl::Struct, SourceLocation(), 
                                               &Idents.get("NSConstantString"),
                                               0);
-    QualType FieldTypes[3];
+    QualType FieldTypes[4];
   
     // const int *isa;
     FieldTypes[0] = getPointerType(IntTy.getQualifiedType(QualType::Const));  
+    // int flags;
+    FieldTypes[1] = IntTy;
     // const char *str;
-    FieldTypes[1] = getPointerType(CharTy.getQualifiedType(QualType::Const));  
+    FieldTypes[2] = getPointerType(CharTy.getQualifiedType(QualType::Const));  
     // long length;
-    FieldTypes[2] = LongTy;  
+    FieldTypes[3] = LongTy;  
     // Create fields
-    FieldDecl *FieldDecls[3];
+    FieldDecl *FieldDecls[4];
   
-    for (unsigned i = 0; i < 3; ++i)
+    for (unsigned i = 0; i < 4; ++i)
       FieldDecls[i] = new FieldDecl(SourceLocation(), 0, FieldTypes[i]);
   
     CFConstantStringTypeDecl->defineBody(FieldDecls, 4);
diff --git a/test/CodeGen/cfstring.c b/test/CodeGen/cfstring.c
new file mode 100644 (file)
index 0000000..c7df1b3
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: clang -emit-llvm %s
+#define CFSTR __builtin___CFStringMakeConstantString
+
+void f() {
+  CFSTR("Hello, World!");
+}
\ No newline at end of file