diff --git a/clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp b/clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp --- a/clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp @@ -55,6 +55,7 @@ check::PostStmt, check::PreObjCMessage, check::PostObjCMessage > { + const ObjCObjectType *getObjectTypeForAllocAndNew(const ObjCMessageExpr *MsgE, CheckerContext &C) const; @@ -69,8 +70,8 @@ mutable std::unique_ptr ObjCGenericsBugType; void initBugType() const { if (!ObjCGenericsBugType) - ObjCGenericsBugType.reset( - new BugType(this, "Generics", categories::CoreFoundationObjectiveC)); + ObjCGenericsBugType.reset(new BugType( + GenericCheckName, "Generics", categories::CoreFoundationObjectiveC)); } class GenericsBugVisitor : public BugReporterVisitor { @@ -108,6 +109,7 @@ /// This value is set to true, when the Generics checker is turned on. DefaultBool CheckGenerics; + CheckerNameRef GenericCheckName; }; bool isObjCClassType(QualType Type) { @@ -1101,6 +1103,7 @@ void ento::registerObjCGenericsChecker(CheckerManager &mgr) { DynamicTypePropagation *checker = mgr.getChecker(); checker->CheckGenerics = true; + checker->GenericCheckName = mgr.getCurrentCheckerName(); } bool ento::shouldRegisterObjCGenericsChecker(const CheckerManager &mgr) { diff --git a/clang/test/Analysis/Inputs/expected-plists/generics.m.plist b/clang/test/Analysis/Inputs/expected-plists/generics.m.plist --- a/clang/test/Analysis/Inputs/expected-plists/generics.m.plist +++ b/clang/test/Analysis/Inputs/expected-plists/generics.m.plist @@ -138,9 +138,9 @@ descriptionConversion from value of type 'NSMutableArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context33d4584e2bf66b029ab9d152cc9cd8f7 + issue_hash_content_of_line_in_context9be4ccbeebeb5f814eb9ff5cef4907d3 issue_context_kindfunction issue_contextincompatibleTypesErased issue_hash_function_offset2 @@ -295,9 +295,9 @@ descriptionConversion from value of type 'NSMutableArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context6edc910aaa9dc1f2d823abc8cb75360f + issue_hash_content_of_line_in_context567cd90c936f23ea70aca98b9d3af2b7 issue_context_kindfunction issue_contextincompatibleTypesErased issue_hash_function_offset5 @@ -421,9 +421,9 @@ descriptionConversion from value of type 'NSNumber *' to incompatible type 'NSString *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context73c71c858082f5d7a2258f707927da3c + issue_hash_content_of_line_in_contexta6e6f9c2db7532f45c07d2c13bcf496b issue_context_kindfunction issue_contextincompatibleTypesErased issue_hash_function_offset8 @@ -689,9 +689,9 @@ descriptionConversion from value of type 'NSArray<NSNumber *> *' to incompatible type 'NSArray<NSString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context82c378fdcfcc5c0318d2f3ca46420ec1 + issue_hash_content_of_line_in_context73523166e7c9e436da86a96fbd7b3d90 issue_context_kindfunction issue_contextcrossProceduralErasedTypes issue_hash_function_offset1 @@ -846,9 +846,9 @@ descriptionConversion from value of type 'NSMutableArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context234e3c299ee75a4dd4563e0ea88b9ed9 + issue_hash_content_of_line_in_context649d50ef4cf1287ed225396d39995361 issue_context_kindfunction issue_contextincompatibleTypesErasedReverseConversion issue_hash_function_offset4 @@ -970,9 +970,9 @@ descriptionConversion from value of type 'NSNumber *' to incompatible type 'NSString *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contexte875afc5479fec33a693ce2b550a9573 + issue_hash_content_of_line_in_contextd5cc413c71cae912d5ba469f8fa05ac3 issue_context_kindfunction issue_contextincompatibleTypesErasedReverseConversion issue_hash_function_offset6 @@ -1129,9 +1129,9 @@ descriptionConversion from value of type 'NSMutableArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contextd7fa9fa89fe860ed8f5d22631233a5fa + issue_hash_content_of_line_in_context36d360e268b9ebc2d70e160a15b9a186 issue_context_kindfunction issue_contextidErasedIncompatibleTypesReverseConversion issue_hash_function_offset4 @@ -1252,9 +1252,9 @@ descriptionConversion from value of type 'NSNumber *' to incompatible type 'NSString *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context7de91182a5d6e40a85fa3b91cf3fd089 + issue_hash_content_of_line_in_contexta7326f4dedbc94e8fa1ee02d851e7810 issue_context_kindfunction issue_contextidErasedIncompatibleTypesReverseConversion issue_hash_function_offset6 @@ -1410,9 +1410,9 @@ descriptionConversion from value of type 'NSMutableArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context8960776d84319407ac2bf7a1531d19b0 + issue_hash_content_of_line_in_context2b09deaa8c501c7ce9edc693111bfab1 issue_context_kindfunction issue_contextidErasedIncompatibleTypes issue_hash_function_offset2 @@ -1566,9 +1566,9 @@ descriptionConversion from value of type 'NSMutableArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context93b114c7a385294dce5c25ed04a8b25a + issue_hash_content_of_line_in_contextbe4c414dad5574ca47577731eddc0adb issue_context_kindfunction issue_contextidErasedIncompatibleTypes issue_hash_function_offset5 @@ -1691,9 +1691,9 @@ descriptionConversion from value of type 'NSNumber *' to incompatible type 'NSString *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context4c17f22d7e977f3343d2e2129b9229c3 + issue_hash_content_of_line_in_contexte82f5d4de5cf484f9a352aaa72d0d69a issue_context_kindfunction issue_contextidErasedIncompatibleTypes issue_hash_function_offset7 @@ -1948,9 +1948,9 @@ descriptionConversion from value of type 'NSString *' to incompatible type 'NSMutableString *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context24a08781e7d8971a7d8f8f607ce40074 + issue_hash_content_of_line_in_context60492def9369fa10adfd15698ccf13c8 issue_context_kindfunction issue_contextpathSensitiveInference issue_hash_function_offset8 @@ -2106,9 +2106,9 @@ descriptionConversion from value of type 'MutableArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contexta8534f675404d57d833dc3c371d49845 + issue_hash_content_of_line_in_context7912d07f44fc4afc8ebfc7466bccad59 issue_context_kindfunction issue_contextverifyAPIusage issue_hash_function_offset2 @@ -2295,9 +2295,9 @@ descriptionConversion from value of type 'MutableArray<NSString *> *' to incompatible type 'MutableArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contextd113e22b9ee9ded1cd94750c3557eff4 + issue_hash_content_of_line_in_contexte8cde4ad9693aa9a93cdec1f7af85d11 issue_context_kindfunction issue_contextsubtypeOfGeneric issue_hash_function_offset3 @@ -2453,9 +2453,9 @@ descriptionConversion from value of type 'ExceptionalArray<NSString *> *' to incompatible type 'MutableArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contextf1b900572a63726a729714a765595c38 + issue_hash_content_of_line_in_context104cf6a2b6571c090fe079bc8af0e791 issue_context_kindfunction issue_contextgenericSubtypeOfGeneric issue_hash_function_offset5 @@ -2579,9 +2579,9 @@ descriptionConversion from value of type 'NSNumber *' to incompatible type 'NSString *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contextcbb926c9de226a3eac85fb961a93f39a + issue_hash_content_of_line_in_context45a05502f77ed21d04b722b40d5ee735 issue_context_kindfunction issue_contextgenericSubtypeOfGeneric issue_hash_function_offset7 @@ -2740,9 +2740,9 @@ descriptionConversion from value of type 'ExceptionalArray<NSString *> *' to incompatible type 'MutableArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contextb6ee3b22fbad45f213b4bf14bec7eeaf + issue_hash_content_of_line_in_context25579e3cacf6d5a4f9de130b2499ce5a issue_context_kindfunction issue_contextgenericSubtypeOfGenericReverse issue_hash_function_offset5 @@ -2866,9 +2866,9 @@ descriptionConversion from value of type 'NSNumber *' to incompatible type 'NSString *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context6561f05506a8ceca3afc79fc59912b94 + issue_hash_content_of_line_in_contexte7fd3f40a1f32b768ff8fd227b6286fc issue_context_kindfunction issue_contextgenericSubtypeOfGenericReverse issue_hash_function_offset7 @@ -3027,9 +3027,9 @@ descriptionConversion from value of type 'MutableArray<NSString *> *' to incompatible type 'MutableArray<NSMutableString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context6aab15d40b39ec0a6b749e561d486e6a + issue_hash_content_of_line_in_context91cf30fc85309c3e637dcb5069c41104 issue_context_kindfunction issue_contextinferenceFromAPI issue_hash_function_offset4 @@ -3182,9 +3182,9 @@ descriptionConversion from value of type 'MutableArray<NSMutableString *> *' to incompatible type 'MutableArray<NSString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contextbd1da1b7775323773555e5d5c122661f + issue_hash_content_of_line_in_context610e79d566da3ecb481a4880918b869c issue_context_kindfunction issue_contextinferenceFromAPI2 issue_hash_function_offset2 @@ -3337,9 +3337,9 @@ descriptionConversion from value of type 'MutableArray<NSMutableString *> *' to incompatible type 'MutableArray<NSString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context3f2abd3c0b4b4a80a71bcbb668124ffb + issue_hash_content_of_line_in_contextb3733a88d560ed410d3f67027c26c948 issue_context_kindfunction issue_contextinferenceFromAPIWithLegacyTypes issue_hash_function_offset2 @@ -3492,9 +3492,9 @@ descriptionConversion from value of type 'MutableArray<NSString *> *' to incompatible type 'MutableArray<NSMutableString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context73a50f2592e8b3c9af898749f24176f7 + issue_hash_content_of_line_in_contexte8906c6b546d90ce508f20ebe236a825 issue_context_kindfunction issue_contextinferenceFromAPIWithLegacyTypes2 issue_hash_function_offset2 @@ -3710,9 +3710,9 @@ descriptionConversion from value of type 'MutableArray<NSString *> *' to incompatible type 'MutableArray<NSMutableString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context23ca540c8961ab9a362a194e1e895f86 + issue_hash_content_of_line_in_contextcb3213e9e4a71a8e5fe96c708c5e9537 issue_context_kindfunction issue_contextinferenceFromAPIWithLegacyTypes3 issue_hash_function_offset3 @@ -3866,9 +3866,9 @@ descriptionConversion from value of type 'MutableArray<NSString *> *' to incompatible type 'MutableArray<NSMutableString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contextbe7e9426f827314f05fd4e15b25909df + issue_hash_content_of_line_in_contextfdbece8e1da487f06bcc3586fdd3d6d7 issue_context_kindfunction issue_contextinferenceFromAPIWithBuggyTypes issue_hash_function_offset2 @@ -4021,9 +4021,9 @@ descriptionConversion from value of type 'MutableArray<NSMutableString *> *' to incompatible type 'MutableArray<NSString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context0f97a618ccac913d7c8631b5b86a133e + issue_hash_content_of_line_in_context697e90b8d40d9eb42cc2955ba7916c56 issue_context_kindfunction issue_contextInferenceFromAPIWithBuggyTypes2 issue_hash_function_offset2 @@ -4239,9 +4239,9 @@ descriptionConversion from value of type 'MutableArray<NSMutableString *> *' to incompatible type 'MutableArray<NSString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context725c54c88bb271138b1de545ee59a8aa + issue_hash_content_of_line_in_context1f981347a159069ead84333d166397a1 issue_context_kindfunction issue_contextInferenceFromAPIWithBuggyTypes3 issue_hash_function_offset3 @@ -4458,9 +4458,9 @@ descriptionConversion from value of type 'MutableArray<NSString *> *' to incompatible type 'MutableArray<NSMutableString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contextfb867af384c612fe5c09f821127eeaf0 + issue_hash_content_of_line_in_contextb7c763b701b33c32892c0f23719eb909 issue_context_kindfunction issue_contextInferenceFromAPIWithBuggyTypes4 issue_hash_function_offset3 @@ -5343,9 +5343,9 @@ descriptionConversion from value of type 'NSString *' to incompatible type 'NSMutableString *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contexta0fa75143d7a7ac234292642a6d93360 + issue_hash_content_of_line_in_contextd2e2edac5234dd2750793699662fe372 issue_context_kindfunction issue_contextfindMethodDeclInTrackedType issue_hash_function_offset4 @@ -5564,9 +5564,9 @@ descriptionConversion from value of type 'NSString *' to incompatible type 'NSMutableString *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contextd0b99c8523e81ec43ba4ea80aeedef1b + issue_hash_content_of_line_in_context3bf8676fa507b66d643659571359abb9 issue_context_kindfunction issue_contextfindMethodDeclInTrackedType2 issue_hash_function_offset3 @@ -5721,9 +5721,9 @@ descriptionConversion from value of type 'NSArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context46aa94b866747bcbe1ded581da7a2633 + issue_hash_content_of_line_in_context8a15a02f23d0fe7c9bf9870b2b6058e4 issue_context_kindfunction issue_contexttrackedClassVariables issue_hash_function_offset2 @@ -5876,9 +5876,9 @@ descriptionConversion from value of type 'NSArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_contexta759006d1ce88e15fcd6de6a29e2579c + issue_hash_content_of_line_in_context020a563323ed1afc8f25c3dbb0ae9787 issue_context_kindfunction issue_contexttrackedClassVariables issue_hash_function_offset3 @@ -6032,9 +6032,9 @@ descriptionConversion from value of type 'NSArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context4bb1729ff86647750b458e6f8d883f08 + issue_hash_content_of_line_in_contextcd7ff0a199876a9291a9feb137c251cf issue_context_kindfunction issue_contextnestedCollections issue_hash_function_offset2 @@ -6221,9 +6221,9 @@ descriptionConversion from value of type 'NSArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context38831553eaecfb6c02b51e71d21ec6ea + issue_hash_content_of_line_in_context8ba10666e1dab5d0a5bdc4f6e16aeb63 issue_context_kindfunction issue_contextreturnCollectionToIdVariable issue_hash_function_offset3 @@ -6411,9 +6411,9 @@ descriptionConversion from value of type 'NSArray<NSString *> *' to incompatible type 'NSArray<NSNumber *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context9fcbd4dcf212f004877292aa5085322b + issue_hash_content_of_line_in_contextbf63c6bdf68630cd020bb73e195e1df3 issue_context_kindfunction issue_contexteraseSpecialization issue_hash_function_offset3 @@ -6912,9 +6912,9 @@ descriptionConversion from value of type 'UnrelatedTypeGeneric<NSString *> *' to incompatible type 'NSArray<NSString *> *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context8347f65fb51a85ccd462d75ffd761078 + issue_hash_content_of_line_in_context4cf120bb70d4c304368bb36b4ee7bb49 issue_context_kindfunction issue_contexttestGetMostInformativeDerivedForId issue_hash_function_offset2 @@ -7034,9 +7034,9 @@ descriptionConversion from value of type 'NSNumber *' to incompatible type 'NSString *' categoryCore Foundation/Objective-C typeGenerics - check_namecore.DynamicTypePropagation + check_nameosx.cocoa.ObjCGenerics - issue_hash_content_of_line_in_context6528db66f562ac0c2a94933f3ca5f6a8 + issue_hash_content_of_line_in_contextc25b5be7d87537d862f7b1eabeb79678 issue_context_kindfunction issue_contexttestGetMostInformativeDerivedForId issue_hash_function_offset7