diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-12-27 03:58:08 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-12-27 03:58:08 +0000 |
commit | 2e0c8f79d97b974a680087d12a7dc5e1dc705c20 (patch) | |
tree | 39a5eec66a84c82be84d24b102a61991a5b226a5 /clang/lib/Serialization | |
parent | c33b2fd0add3d1a77b19874c6a1dd91f5a59f8a3 (diff) | |
download | bcm5719-llvm-2e0c8f79d97b974a680087d12a7dc5e1dc705c20.tar.gz bcm5719-llvm-2e0c8f79d97b974a680087d12a7dc5e1dc705c20.zip |
Address review feedback on r221933.
Remove ObjCMethodList::Count, instead store a "has more than one decl" bit in
the low bit of the ObjCMethodDecl pointer, using a PointerIntPair.
Most of this patch is replacing ".Method" with ".getMethod()".
No intended behavior change.
llvm-svn: 224876
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 14 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 28 |
2 files changed, 21 insertions, 21 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index eea4ba84b0c..b3bac25a076 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3457,7 +3457,7 @@ static void moveMethodToBackOfGlobalList(Sema &S, ObjCMethodDecl *Method) { bool Found = false; for (ObjCMethodList *List = &Start; List; List = List->getNext()) { if (!Found) { - if (List->Method == Method) { + if (List->getMethod() == Method) { Found = true; } else { // Keep searching. @@ -3466,9 +3466,9 @@ static void moveMethodToBackOfGlobalList(Sema &S, ObjCMethodDecl *Method) { } if (List->getNext()) - List->Method = List->getNext()->Method; + List->setMethod(List->getNext()->getMethod()); else - List->Method = Method; + List->setMethod(Method); } } @@ -7065,11 +7065,11 @@ namespace clang { namespace serialization { SmallVector<ObjCMethodDecl *, 4> FactoryMethods; public: - ReadMethodPoolVisitor(ASTReader &Reader, Selector Sel, + ReadMethodPoolVisitor(ASTReader &Reader, Selector Sel, unsigned PriorGeneration) - : Reader(Reader), Sel(Sel), PriorGeneration(PriorGeneration), - InstanceBits(0), FactoryBits(0) { } - + : Reader(Reader), Sel(Sel), PriorGeneration(PriorGeneration), + InstanceBits(0), FactoryBits(0) {} + static bool visit(ModuleFile &M, void *UserData) { ReadMethodPoolVisitor *This = static_cast<ReadMethodPoolVisitor *>(UserData); diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 02663ad43d4..c5d5b984cd3 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -2895,11 +2895,11 @@ public: unsigned DataLen = 4 + 2 + 2; // 2 bytes for each of the method counts for (const ObjCMethodList *Method = &Methods.Instance; Method; Method = Method->getNext()) - if (Method->Method) + if (Method->getMethod()) DataLen += 4; for (const ObjCMethodList *Method = &Methods.Factory; Method; Method = Method->getNext()) - if (Method->Method) + if (Method->getMethod()) DataLen += 4; LE.write<uint16_t>(DataLen); return std::make_pair(KeyLen, DataLen); @@ -2929,13 +2929,13 @@ public: unsigned NumInstanceMethods = 0; for (const ObjCMethodList *Method = &Methods.Instance; Method; Method = Method->getNext()) - if (Method->Method) + if (Method->getMethod()) ++NumInstanceMethods; unsigned NumFactoryMethods = 0; for (const ObjCMethodList *Method = &Methods.Factory; Method; Method = Method->getNext()) - if (Method->Method) + if (Method->getMethod()) ++NumFactoryMethods; unsigned InstanceBits = Methods.Instance.getBits(); @@ -2949,12 +2949,12 @@ public: LE.write<uint16_t>(NumFactoryMethodsAndBits); for (const ObjCMethodList *Method = &Methods.Instance; Method; Method = Method->getNext()) - if (Method->Method) - LE.write<uint32_t>(Writer.getDeclID(Method->Method)); + if (Method->getMethod()) + LE.write<uint32_t>(Writer.getDeclID(Method->getMethod())); for (const ObjCMethodList *Method = &Methods.Factory; Method; Method = Method->getNext()) - if (Method->Method) - LE.write<uint32_t>(Writer.getDeclID(Method->Method)); + if (Method->getMethod()) + LE.write<uint32_t>(Writer.getDeclID(Method->getMethod())); assert(Out.tell() - Start == DataLen && "Data length is wrong"); } @@ -3000,19 +3000,19 @@ void ASTWriter::WriteSelectors(Sema &SemaRef) { if (Chain && I->second < FirstSelectorID) { // Selector already exists. Did it change? bool changed = false; - for (ObjCMethodList *M = &Data.Instance; !changed && M && M->Method; - M = M->getNext()) { - if (!M->Method->isFromASTFile()) + for (ObjCMethodList *M = &Data.Instance; + !changed && M && M->getMethod(); M = M->getNext()) { + if (!M->getMethod()->isFromASTFile()) changed = true; } - for (ObjCMethodList *M = &Data.Factory; !changed && M && M->Method; + for (ObjCMethodList *M = &Data.Factory; !changed && M && M->getMethod(); M = M->getNext()) { - if (!M->Method->isFromASTFile()) + if (!M->getMethod()->isFromASTFile()) changed = true; } if (!changed) continue; - } else if (Data.Instance.Method || Data.Factory.Method) { + } else if (Data.Instance.getMethod() || Data.Factory.getMethod()) { // A new method pool entry. ++NumTableEntries; } |