summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-12-22 23:22:27 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-12-22 23:22:27 +0000
commitdaef00bca6c92b08594f7fe40fcd80d2c7b9c452 (patch)
tree689e1e9638cc085d05d532f30199b88b07e290da /clang/lib/AST
parent456e8853825ba4faa4820246fb2dbd0bb3974466 (diff)
downloadbcm5719-llvm-daef00bca6c92b08594f7fe40fcd80d2c7b9c452.tar.gz
bcm5719-llvm-daef00bca6c92b08594f7fe40fcd80d2c7b9c452.zip
More encoding support; in this case, encoding of
outer-most const of pointer types. llvm-svn: 61355
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTContext.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index f81d41aa61f..ad6c0dfc6c1 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1755,13 +1755,15 @@ void ASTContext::getObjCEncodingForType(QualType T, std::string& S,
// directly pointed to, and expanding embedded structures. Note that
// these rules are sufficient to prevent recursive encoding of the
// same type.
- getObjCEncodingForTypeImpl(T, S, true, true, Field);
+ getObjCEncodingForTypeImpl(T, S, true, true, Field,
+ true /* outermost type */);
}
void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
bool ExpandPointedToStructures,
bool ExpandStructures,
- FieldDecl *FD) const {
+ FieldDecl *FD,
+ bool OutermostType) const {
if (const BuiltinType *BT = T->getAsBuiltinType()) {
if (FD && FD->isBitField()) {
const Expr *E = FD->getBitWidth();
@@ -1805,6 +1807,8 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
}
else if (const PointerType *PT = T->getAsPointerType()) {
QualType PointeeTy = PT->getPointeeType();
+ if (OutermostType && PointeeTy.isConstQualified())
+ S += 'r';
if (isObjCIdType(PointeeTy)) {
S += '@';
return;
@@ -1879,6 +1883,9 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
getObjCEncodingForTypeImpl(Field->getType(), S, false, true,
(*Field));
} else {
+ // FIXME! Another legacy kludge: 32-bit longs are encoded as
+ // 'l' or 'L', but not always. For typedefs, we need to use
+ // 'i' or 'I' instead if encoding a struct field, or a pointer!
getObjCEncodingForTypeImpl(Field->getType(), S, false, true,
FD);
}
OpenPOWER on IntegriCloud