diff options
author | Anders Carlsson <andersca@mac.com> | 2007-10-29 06:33:42 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2007-10-29 06:33:42 +0000 |
commit | e8c49533521c40643653f943d47229e62d277f88 (patch) | |
tree | f32f07d6f361b3a15ff03d8e1a807d1695bbbc43 | |
parent | 17df57d6d324d2d90df3038792db17c17728f273 (diff) |
Address Chris's comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43445 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | AST/ASTContext.cpp | 26 | ||||
-rw-r--r-- | clang.xcodeproj/project.pbxproj | 1 |
2 files changed, 17 insertions, 10 deletions
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp index 87de905a27..bab2e0fcc3 100644 --- a/AST/ASTContext.cpp +++ b/AST/ASTContext.cpp @@ -837,10 +837,11 @@ QualType ASTContext::getCFConstantStringType() { return getTagDeclType(CFConstantStringTypeDecl); } +// This returns true if a type has been typedefed to BOOL: +// typedef <type> BOOL; static bool isTypeTypedefedAsBOOL(QualType T) { - if (const PointerType *NCPT = T->getAsPointerType()) - if (const TypedefType *TT = dyn_cast<TypedefType>(NCPT->getPointeeType())) + if (const TypedefType *TT = dyn_cast<TypedefType>(T)) if (!strcmp(TT->getDecl()->getName(), "BOOL")) return true; @@ -849,9 +850,15 @@ static bool isTypeTypedefedAsBOOL(QualType T) void ASTContext::getObjcEncodingForType(QualType T, std::string& S) const { - QualType Ty = T.getCanonicalType(); - - if (const BuiltinType *BT = Ty->getAsBuiltinType()) { + // FIXME: This currently doesn't encode: + // @ An object (whether statically typed or typed id) + // # A class object (Class) + // : A method selector (SEL) + // {name=type...} A structure + // (name=type...) A union + // bnum A bit field of num bits + + if (const BuiltinType *BT = T->getAsBuiltinType()) { char encoding; switch (BT->getKind()) { case BuiltinType::Void: @@ -906,13 +913,13 @@ void ASTContext::getObjcEncodingForType(QualType T, std::string& S) const } S += encoding; - } else if (const PointerType *PT = Ty->getAsPointerType()) { + } else if (const PointerType *PT = T->getAsPointerType()) { QualType PointeeTy = PT->getPointeeType(); if (PointeeTy->isCharType()) { // char pointer types should be encoded as '*' unless it is a // type that has been typedef'd to 'BOOL'. - if (!isTypeTypedefedAsBOOL(T)) { + if (!isTypeTypedefedAsBOOL(PointeeTy)) { S += '*'; return; } @@ -920,7 +927,7 @@ void ASTContext::getObjcEncodingForType(QualType T, std::string& S) const S += '^'; getObjcEncodingForType(PT->getPointeeType(), S); - } else if (const ArrayType *AT = Ty->getAsArrayType()) { + } else if (const ArrayType *AT = T->getAsArrayType()) { S += '['; if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(AT)) @@ -931,8 +938,7 @@ void ASTContext::getObjcEncodingForType(QualType T, std::string& S) const getObjcEncodingForType(AT->getElementType(), S); S += ']'; } else - fprintf(stderr, "@encode for type %s not implemented!\n", - Ty.getAsString().c_str()); + assert(0 && "@encode for type not implemented!"); } void ASTContext::setBuiltinVaListType(QualType T) diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj index de41b4628d..fe4cf8d85b 100644 --- a/clang.xcodeproj/project.pbxproj +++ b/clang.xcodeproj/project.pbxproj @@ -756,6 +756,7 @@ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */; + compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; mainGroup = 08FB7794FE84155DC02AAC07 /* clang */; projectDirPath = ""; |