summaryrefslogtreecommitdiffstats
path: root/clang/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2007-08-17 05:31:46 +0000
committerAnders Carlsson <andersca@mac.com>2007-08-17 05:31:46 +0000
commit98f0790fabed73dc19e16db8558c16399e16b5b2 (patch)
tree8cb1ff82a56e34a8cd4695d59e0344940e14ae7c /clang/AST/ASTContext.cpp
parent2c4ea1e4118049472d0ed3be55e85919b13b92e5 (diff)
downloadbcm5719-llvm-98f0790fabed73dc19e16db8558c16399e16b5b2.tar.gz
bcm5719-llvm-98f0790fabed73dc19e16db8558c16399e16b5b2.zip
Add initial support for constant CFStrings.
llvm-svn: 41136
Diffstat (limited to 'clang/AST/ASTContext.cpp')
-rw-r--r--clang/AST/ASTContext.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/AST/ASTContext.cpp b/clang/AST/ASTContext.cpp
index 899f9c6de6b..7293d4574f8 100644
--- a/clang/AST/ASTContext.cpp
+++ b/clang/AST/ASTContext.cpp
@@ -740,3 +740,32 @@ QualType ASTContext::maxIntegerType(QualType lhs, QualType rhs) {
return signedType;
}
}
+
+// getCFConstantStringType - Return the type used for constant CFStrings.
+QualType ASTContext::getCFConstantStringType() {
+ if (!CFConstantStringTypeDecl) {
+ CFConstantStringTypeDecl = new RecordDecl(Decl::Struct, SourceLocation(),
+ &Idents.get("__builtin_CFString"),
+ 0);
+
+ QualType FieldTypes[4];
+
+ // const int *isa;
+ FieldTypes[0] = getPointerType(IntTy.getQualifiedType(QualType::Const));
+ // int flags;
+ FieldTypes[1] = IntTy;
+ // const char *str;
+ FieldTypes[2] = getPointerType(CharTy.getQualifiedType(QualType::Const));
+ // long length;
+ FieldTypes[3] = LongTy;
+ // Create fields
+ FieldDecl *FieldDecls[4];
+
+ for (unsigned i = 0; i < 4; ++i)
+ FieldDecls[i] = new FieldDecl(SourceLocation(), 0, FieldTypes[i], 0);
+
+ CFConstantStringTypeDecl->defineBody(FieldDecls, 4);
+ }
+
+ return getTagDeclType(CFConstantStringTypeDecl);
+}
OpenPOWER on IntegriCloud