Making error message more explicit in CXX Reference rule

Reviewed By: jvillard

Differential Revision: D12902491

fbshipit-source-id: 771cfd96a
master
Dino Distefano 6 years ago committed by Facebook Github Bot
parent 67ff14b4ed
commit d10f6855f2

@ -182,20 +182,13 @@ DEFINE-CHECKER CXX_REFERENCE_CAPTURED_IN_OBJC_BLOCK = {
HOLDS-NEXT)
HOLDS-IN-NODE BlockExpr;
// * Alternative ways of writing this check:
// SET report_when =
// WHEN
// captures_cxx_references()
// HOLDS-IN-NODE BlockDecl;
//
// SET report_when =
// is_node(BlockDecl) AND captures_cxx_references();
SET message =
"C++ Reference variable(s) %cxx_ref_captured_in_block% captured by Objective-C block";
SET suggestion = "C++ References are unmanaged and may be invalid by the time the block executes.";
SET suggestion = "This will very likely cause a crash because C++ References are unmanaged and may be invalid by the time the block executes.";
SET severity = "ERROR";
SET mode = "ON";
};
// If the declaration has availability attributes, check that it's compatible with

@ -26,8 +26,8 @@ codetoanalyze/objcpp/linters/componentkit/MutableLocalVariablesTest.mm, FooCompo
codetoanalyze/objcpp/linters/componentkit/MutableLocalVariablesTest.mm, FooComponent_newWithString, 67, MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE, no_bucket, ADVICE, []
codetoanalyze/objcpp/linters/componentkit/MutableLocalVariablesTest.mm, SomeClass_init, 38, MUTABLE_LOCAL_VARIABLE_IN_COMPONENT_FILE, no_bucket, ADVICE, []
codetoanalyze/objcpp/linters/componentkit/UnconventionalSuperclassTest.h, Linters_dummy_method, 15, COMPONENT_WITH_UNCONVENTIONAL_SUPERCLASS, no_bucket, ADVICE, []
codetoanalyze/objcpp/linters/cxx_reference_in_block/block.mm, A_foo, 18, CXX_REFERENCE_CAPTURED_IN_OBJC_BLOCK, no_bucket, WARNING, []
codetoanalyze/objcpp/linters/cxx_reference_in_block/block.mm, A_foo3, 35, CXX_REFERENCE_CAPTURED_IN_OBJC_BLOCK, no_bucket, WARNING, []
codetoanalyze/objcpp/linters/cxx_reference_in_block/block.mm, A_foo, 18, CXX_REFERENCE_CAPTURED_IN_OBJC_BLOCK, no_bucket, ERROR, []
codetoanalyze/objcpp/linters/cxx_reference_in_block/block.mm, A_foo3, 35, CXX_REFERENCE_CAPTURED_IN_OBJC_BLOCK, no_bucket, ERROR, []
codetoanalyze/objcpp/linters/global-var/B.mm, Linters_dummy_method, 28, GLOBAL_VARIABLE_INITIALIZED_WITH_FUNCTION_OR_METHOD_CALL, no_bucket, WARNING, []
codetoanalyze/objcpp/linters/global-var/B.mm, Linters_dummy_method, 30, GLOBAL_VARIABLE_INITIALIZED_WITH_FUNCTION_OR_METHOD_CALL, no_bucket, WARNING, []
codetoanalyze/objcpp/linters/global-var/B.mm, Linters_dummy_method, 32, GLOBAL_VARIABLE_INITIALIZED_WITH_FUNCTION_OR_METHOD_CALL, no_bucket, WARNING, []

Loading…
Cancel
Save