aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-02-17 20:16:45 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-02-17 20:16:45 +0000
commit59d16d1402d76a298ab7fc5f362e9d3dfd744aa5 (patch)
tree91819c1d532545211848fbae25668bb70482b5da /lib
parent16de4c716290a198054bf67c93f3a266d269b2d1 (diff)
Added support for objc's gc attribute in ExtQualType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64800 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/ASTContext.cpp5
-rw-r--r--lib/AST/Type.cpp18
2 files changed, 20 insertions, 3 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 32a6c7d4c6..dec73182b8 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -725,7 +725,7 @@ QualType ASTContext::getAddrSpaceQualType(QualType T, unsigned AddressSpace) {
// Check if we've already instantiated an address space qual'd type of this
// type.
llvm::FoldingSetNodeID ID;
- ExtQualType::Profile(ID, T.getTypePtr(), AddressSpace);
+ ExtQualType::Profile(ID, T.getTypePtr(), AddressSpace, 0);
void *InsertPos = 0;
if (ExtQualType *EXTQy = ExtQualTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(EXTQy, 0);
@@ -741,7 +741,8 @@ QualType ASTContext::getAddrSpaceQualType(QualType T, unsigned AddressSpace) {
assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
}
ExtQualType *New = new (*this, 8) ExtQualType(T.getTypePtr(), Canonical,
- AddressSpace);
+ AddressSpace, 0,
+ ExtQualType::ASQUAL);
ExtQualTypes.InsertNode(New, InsertPos);
Types.push_back(New);
return QualType(New, T.getCVRQualifiers());
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 0edc6ee7f7..6aec24fddd 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -1053,7 +1053,23 @@ void ComplexType::getAsStringInternal(std::string &S) const {
}
void ExtQualType::getAsStringInternal(std::string &S) const {
- S = "__attribute__((address_space("+llvm::utostr_32(AddressSpace)+")))" + S;
+ bool space = false;
+ if (ExtQualTypeKind & ASQUAL) {
+ S = "__attribute__((address_space("+llvm::utostr_32(AddressSpace)+")))" + S;
+ space = true;
+ }
+ if (ExtQualTypeKind & GCQUAL) {
+ if (space)
+ S += ' ';
+ S += "__attribute__((objc_gc(";
+ ObjCGCAttr *gcattr = getGCAttr();
+ ObjCGCAttr::GCAttrTypes attr = gcattr->getType();
+ if (attr & ObjCGCAttr::Weak)
+ S += "weak";
+ else
+ S += "strong";
+ S += ")))";
+ }
BaseType->getAsStringInternal(S);
}