[cfe-commits] r43445 - in /cfe/trunk: AST/ASTContext.cpp clang.xcodeproj/project.pbxproj
Anders Carlsson
andersca at mac.com
Sun Oct 28 23:33:42 PDT 2007
Author: andersca
Date: Mon Oct 29 01:33:42 2007
New Revision: 43445
URL: http://llvm.org/viewvc/llvm-project?rev=43445&view=rev
Log:
Address Chris's comments.
Modified:
cfe/trunk/AST/ASTContext.cpp
cfe/trunk/clang.xcodeproj/project.pbxproj
Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=43445&r1=43444&r2=43445&view=diff
==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Mon Oct 29 01:33:42 2007
@@ -837,10 +837,11 @@
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 @@
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 @@
}
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 @@
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 @@
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)
Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=43445&r1=43444&r2=43445&view=diff
==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Mon Oct 29 01:33:42 2007
@@ -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 = "";
More information about the cfe-commits
mailing list