vsapsai created this revision. vsapsai added a reviewer: rtrieu. Herald added subscribers: dexonsmith, jkorous.
Because `Selector::getIdentifierInfoForSlot` returns NULL if a slot has no corresponding identifier, use `Selector::getNameForSlot` instead. rdar://problem/51615164 https://reviews.llvm.org/D63789 Files: clang/lib/AST/ODRHash.cpp clang/test/Modules/odr_hash.mm Index: clang/test/Modules/odr_hash.mm =================================================================== --- clang/test/Modules/odr_hash.mm +++ clang/test/Modules/odr_hash.mm @@ -57,6 +57,10 @@ @interface Interface3 <T : I1 *> @end +@interface EmptySelectorSlot +- (void)notify:(int)arg :(int)empty; +@end + #endif #if defined(FIRST) @@ -289,6 +293,14 @@ } // namespace ObjCTypeParam } // namespace Types +namespace rdar51615164 { +#if defined(FIRST) || defined(SECOND) +void notify(EmptySelectorSlot *obj) { + [obj notify:0 :0]; +} +#endif +} // namespace rdar51615164 + // Keep macros contained to one file. #ifdef FIRST #undef FIRST Index: clang/lib/AST/ODRHash.cpp =================================================================== --- clang/lib/AST/ODRHash.cpp +++ clang/lib/AST/ODRHash.cpp @@ -72,7 +72,7 @@ AddBoolean(S.isUnarySelector()); unsigned NumArgs = S.getNumArgs(); for (unsigned i = 0; i < NumArgs; ++i) { - AddIdentifierInfo(S.getIdentifierInfoForSlot(i)); + ID.AddString(S.getNameForSlot(i)); } break; }
Index: clang/test/Modules/odr_hash.mm =================================================================== --- clang/test/Modules/odr_hash.mm +++ clang/test/Modules/odr_hash.mm @@ -57,6 +57,10 @@ @interface Interface3 <T : I1 *> @end +@interface EmptySelectorSlot +- (void)notify:(int)arg :(int)empty; +@end + #endif #if defined(FIRST) @@ -289,6 +293,14 @@ } // namespace ObjCTypeParam } // namespace Types +namespace rdar51615164 { +#if defined(FIRST) || defined(SECOND) +void notify(EmptySelectorSlot *obj) { + [obj notify:0 :0]; +} +#endif +} // namespace rdar51615164 + // Keep macros contained to one file. #ifdef FIRST #undef FIRST Index: clang/lib/AST/ODRHash.cpp =================================================================== --- clang/lib/AST/ODRHash.cpp +++ clang/lib/AST/ODRHash.cpp @@ -72,7 +72,7 @@ AddBoolean(S.isUnarySelector()); unsigned NumArgs = S.getNumArgs(); for (unsigned i = 0; i < NumArgs; ++i) { - AddIdentifierInfo(S.getIdentifierInfoForSlot(i)); + ID.AddString(S.getNameForSlot(i)); } break; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits