diff options
author | Chris Lattner <sabre@nondot.org> | 2008-03-16 21:08:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-03-16 21:08:55 +0000 |
commit | 8d1c04f53a77d66a742247cd00589b6d7a64084b (patch) | |
tree | 04f65b24a20eb7f6605f6aa182ecbd59ab2c1527 /clang/Driver/RewriteTest.cpp | |
parent | 36ac1cae1f3bf74f474b960c9c80d75f580154b3 (diff) | |
download | bcm5719-llvm-8d1c04f53a77d66a742247cd00589b6d7a64084b.tar.gz bcm5719-llvm-8d1c04f53a77d66a742247cd00589b6d7a64084b.zip |
Convert more counts to be zero based instead of -1 based, make them unsigned.
llvm-svn: 48429
Diffstat (limited to 'clang/Driver/RewriteTest.cpp')
-rw-r--r-- | clang/Driver/RewriteTest.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/Driver/RewriteTest.cpp b/clang/Driver/RewriteTest.cpp index 7bdec9390a1..2b88c0c8f35 100644 --- a/clang/Driver/RewriteTest.cpp +++ b/clang/Driver/RewriteTest.cpp @@ -2178,7 +2178,7 @@ void RewriteTest::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl, if (ObjCSynthesizedStructs.count(CDecl)) return; ObjCInterfaceDecl *RCDecl = CDecl->getSuperClass(); - int NumIvars = CDecl->getNumInstanceVariables(); + int NumIvars = CDecl->ivar_size(); SourceLocation LocStart = CDecl->getLocStart(); SourceLocation LocEnd = CDecl->getLocEnd(); @@ -2186,7 +2186,8 @@ void RewriteTest::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl, const char *endBuf = SM->getCharacterData(LocEnd); // If no ivars and no root or if its root, directly or indirectly, // have no ivars (thus not synthesized) then no need to synthesize this class. - if (NumIvars <= 0 && (!RCDecl || !ObjCSynthesizedStructs.count(RCDecl))) { + if ((CDecl->isForwardDecl() || NumIvars == 0) && + (!RCDecl || !ObjCSynthesizedStructs.count(RCDecl))) { endBuf += Lexer::MeasureTokenLength(LocEnd, *SM); ReplaceText(LocStart, endBuf-startBuf, Result.c_str(), Result.size()); return; @@ -2634,9 +2635,9 @@ void RewriteTest::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, } // Build _objc_ivar_list metadata for classes ivars if needed - int NumIvars = IDecl->getImplDeclNumIvars() > 0 - ? IDecl->getImplDeclNumIvars() - : (CDecl ? CDecl->getNumInstanceVariables() : 0); + unsigned NumIvars = !IDecl->ivar_empty() + ? IDecl->ivar_size() + : (CDecl ? CDecl->ivar_size() : 0); if (NumIvars > 0) { static bool objc_ivar = false; if (!objc_ivar) { @@ -2672,7 +2673,7 @@ void RewriteTest::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, Result += "\n"; ObjCInterfaceDecl::ivar_iterator IVI, IVE; - if (IDecl->getImplDeclNumIvars() > 0) { + if (!IDecl->ivar_empty()) { IVI = IDecl->ivar_begin(); IVE = IDecl->ivar_end(); } else { |