You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/docs/analyzer/checkers.rst
+42-5Lines changed: 42 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3584,7 +3584,7 @@ These are examples of cases that we consider safe:
3584
3584
RefCountable* uncounted = this; // ok
3585
3585
}
3586
3586
3587
-
Here are some examples of situations that we warn about as they *might* be potentially unsafe. The logic is that either we're able to guarantee that an argument is safe or it's considered if not a bug then bug-prone.
3587
+
Here are some examples of situations that we warn about as they *might* be potentially unsafe. The logic is that either we're able to guarantee that a local variable is safe or it's considered unsafe.
3588
3588
3589
3589
.. code-block:: cpp
3590
3590
@@ -3603,11 +3603,48 @@ Here are some examples of situations that we warn about as they *might* be poten
3603
3603
RefCountable* uncounted = counted.get(); // warn
3604
3604
}
3605
3605
3606
-
We don't warn about these cases - we don't consider them necessarily safe but since they are very common and usually safe we'd introduce a lot of false positives otherwise:
3607
-
- variable defined in condition part of an ```if``` statement
3608
-
- variable defined in init statement condition of a ```for``` statement
3606
+
alpha.webkit.UncheckedLocalVarsChecker
3607
+
""""""""""""""""""""""""""""""""""""""
3608
+
The goal of this rule is to make sure that any unchecked local variable is backed by a CheckedPtr or CheckedRef with lifetime that is strictly larger than the scope of the unchecked local variable. To be on the safe side we require the scope of an unchecked variable to be embedded in the scope of CheckedPtr/CheckRef object that backs it.
3609
+
3610
+
These are examples of cases that we consider safe:
3611
+
3612
+
.. code-block:: cpp
3609
3613
3610
-
For the time being we also don't warn about uninitialized uncounted local variables.
3614
+
void foo1() {
3615
+
CheckedPtr<RefCountable> counted;
3616
+
// The scope of uncounted is EMBEDDED in the scope of counted.
RefCountable* uncounted = counted_param.get(); // ok
3624
+
}
3625
+
3626
+
void FooClass::foo_method() {
3627
+
RefCountable* uncounted = this; // ok
3628
+
}
3629
+
3630
+
Here are some examples of situations that we warn about as they *might* be potentially unsafe. The logic is that either we're able to guarantee that a local variable is safe or it's considered unsafe.
3631
+
3632
+
.. code-block:: cpp
3633
+
3634
+
void foo1() {
3635
+
RefCountable* uncounted = new RefCountable; // warn
HelpText<"Generate instrumented code to collect coverage info for cold functions into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">;
HelpText<"Generate instrumented code to collect coverage info for cold functions into <directory>/default.profraw (overridden by LLVM_PROFILE_FILE env var)">;
HelpText<"Generate instrumented code to collect execution counts into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">;
0 commit comments