[documenting declaration]: Remove arc liftime qualifiers

when doccumenting declrations in comments.
// rdar://13757500

llvm-svn: 180880
This commit is contained in:
Fariborz Jahanian 2013-05-01 20:53:21 +00:00
parent 0f3b9b819a
commit b5f34681a6
4 changed files with 23 additions and 21 deletions

View File

@ -1452,7 +1452,18 @@ public:
qs.addObjCLifetime(lifetime);
return getQualifiedType(type, qs);
}
/// getUnqualifiedObjCPointerType - Returns version of
/// Objective-C pointer type with lifetime qualifier removed.
QualType getUnqualifiedObjCPointerType(QualType type) const {
if (!type.getTypePtr()->isObjCObjectPointerType() ||
!type.getQualifiers().hasObjCLifetime())
return type;
Qualifiers Qs = type.getQualifiers();
Qs.removeObjCLifetime();
return getQualifiedType(type.getUnqualifiedType(), Qs);
}
DeclarationNameInfo getNameForTemplate(TemplateName Name,
SourceLocation NameLoc) const;

View File

@ -853,10 +853,6 @@ public:
return *this;
}
/// getUnqualifiedObjCPointerType - Returns the unqualified version if
/// Objective-C pointer type; otherwise, returns type as is.
inline QualType getUnqualifiedObjCPointerType() const;
/// operator==/!= - Indicate whether the specified types and qualifiers are
/// identical.
friend bool operator==(const QualType &LHS, const QualType &RHS) {
@ -4651,11 +4647,6 @@ inline QualType QualType::getUnqualifiedType() const {
return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
}
inline QualType QualType::getUnqualifiedObjCPointerType() const {
return getTypePtr()->isObjCObjectPointerType() ?
getUnqualifiedType() : *this;
}
inline SplitQualType QualType::getSplitUnqualifiedType() const {
if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())

View File

@ -617,7 +617,7 @@ void DeclPrinter::VisitFieldDecl(FieldDecl *D) {
if (!Policy.SuppressSpecifiers && D->isModulePrivate())
Out << "__module_private__ ";
Out << D->getType().getUnqualifiedObjCPointerType().
Out << D->getASTContext().getUnqualifiedObjCPointerType(D->getType()).
stream(Policy, D->getName());
if (D->isBitField()) {
@ -662,7 +662,7 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) {
Out << "__module_private__ ";
}
QualType T = D->getType().getUnqualifiedObjCPointerType();
QualType T = D->getASTContext().getUnqualifiedObjCPointerType(D->getType());
if (ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D))
T = Parm->getOriginalType();
T.print(Out, Policy, D->getName());
@ -911,7 +911,7 @@ void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) {
else
Out << "+ ";
if (!OMD->getResultType().isNull())
Out << '(' << OMD->getResultType().getUnqualifiedObjCPointerType().
Out << '(' << OMD->getASTContext().getUnqualifiedObjCPointerType(OMD->getResultType()).
getAsString(Policy) << ")";
std::string name = OMD->getSelector().getAsString();
@ -921,7 +921,7 @@ void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) {
// FIXME: selector is missing here!
pos = name.find_first_of(':', lastPos);
Out << " " << name.substr(lastPos, pos - lastPos);
Out << ":(" << (*PI)->getType().getUnqualifiedObjCPointerType().
Out << ":(" << (*PI)->getASTContext().getUnqualifiedObjCPointerType((*PI)->getType()).
getAsString(Policy) << ')' << **PI;
lastPos = pos + 1;
}
@ -955,7 +955,7 @@ void DeclPrinter::VisitObjCImplementationDecl(ObjCImplementationDecl *OID) {
Indentation += Policy.Indentation;
for (ObjCImplementationDecl::ivar_iterator I = OID->ivar_begin(),
E = OID->ivar_end(); I != E; ++I) {
Indent() << I->getType().getUnqualifiedObjCPointerType().
Indent() << I->getASTContext().getUnqualifiedObjCPointerType(I->getType()).
getAsString(Policy) << ' ' << **I << ";\n";
}
Indentation -= Policy.Indentation;
@ -994,7 +994,7 @@ void DeclPrinter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
Indentation += Policy.Indentation;
for (ObjCInterfaceDecl::ivar_iterator I = OID->ivar_begin(),
E = OID->ivar_end(); I != E; ++I) {
Indent() << I->getType().getUnqualifiedObjCPointerType().
Indent() << I->getASTContext().getUnqualifiedObjCPointerType(I->getType()).
getAsString(Policy) << ' ' << **I << ";\n";
}
Indentation -= Policy.Indentation;
@ -1046,7 +1046,7 @@ void DeclPrinter::VisitObjCCategoryDecl(ObjCCategoryDecl *PID) {
Indentation += Policy.Indentation;
for (ObjCCategoryDecl::ivar_iterator I = PID->ivar_begin(),
E = PID->ivar_end(); I != E; ++I) {
Indent() << I->getType().getUnqualifiedObjCPointerType().
Indent() << I->getASTContext().getUnqualifiedObjCPointerType(I->getType()).
getAsString(Policy) << ' ' << **I << ";\n";
}
Indentation -= Policy.Indentation;
@ -1133,7 +1133,7 @@ void DeclPrinter::VisitObjCPropertyDecl(ObjCPropertyDecl *PDecl) {
(void) first; // Silence dead store warning due to idiomatic code.
Out << " )";
}
Out << ' ' << PDecl->getType().getUnqualifiedObjCPointerType().
Out << ' ' << PDecl->getASTContext().getUnqualifiedObjCPointerType(PDecl->getType()).
getAsString(Policy) << ' ' << *PDecl;
if (Policy.PolishForDeclaration)
Out << ';';

View File

@ -14,8 +14,8 @@
NSString *Name;
}
//! This is WithLabel comment.
- (NSString *)WithLabel:(NSString *)label;
// CHECK: <Declaration>- (NSString *)WithLabel:(NSString *)label;</Declaration>
- (NSString *)WithLabel:(NSString * const)label;
// CHECK: <Declaration>- (NSString *)WithLabel:(NSString *const)label;</Declaration>
//! This is a property to get the Name.
@property (copy) NSString *Name;
@ -29,7 +29,7 @@
// CHECK: <Declaration>NSString *NickName</Declaration>
}
- (NSString *)WithLabel:(NSString *)label {
- (NSString *)WithLabel:(NSString * const)label {
return 0;
}
@synthesize Name = Name;