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
// CHECK-LABEL: GS-PACRET: Warning: pac-ret analysis could not analyze this return instruction in function f_eretaa, basic block .LBB{{[0-9]+}},ataddress
728
+
// CHECK-LABEL: GS-PACRET: Warning: pac-ret analysis could not analyze this return instruction in function f_eretaa, basic block {{[0-9a-zA-Z.]+}},ataddress
729
729
// CHECK-NEXT: The return instruction is {{[0-9a-f]+}}: eretaa
730
730
eretaa
731
731
.size f_eretaa, .-f_eretaa
@@ -739,7 +739,7 @@ f_eretab:
739
739
bl g
740
740
add x0, x0, #3
741
741
ldp x29, x30,[sp], #16
742
-
// CHECK-LABEL: GS-PACRET: Warning: pac-ret analysis could not analyze this return instruction in function f_eretab, basic block .LBB{{[0-9]+}},ataddress
742
+
// CHECK-LABEL: GS-PACRET: Warning: pac-ret analysis could not analyze this return instruction in function f_eretab, basic block {{[0-9a-zA-Z.]+}},ataddress
743
743
// CHECK-NEXT: The return instruction is {{[0-9a-f]+}}: eretab
744
744
eretab
745
745
.size f_eretab, .-f_eretab
@@ -753,15 +753,15 @@ f_eret:
753
753
bl g
754
754
add x0, x0, #3
755
755
ldp x29, x30,[sp], #16
756
-
// CHECK-LABEL: GS-PACRET: Warning: pac-ret analysis could not analyze this return instruction in function f_eret, basic block .LBB{{[0-9]+}},ataddress
756
+
// CHECK-LABEL: GS-PACRET: Warning: pac-ret analysis could not analyze this return instruction in function f_eret, basic block {{[0-9a-zA-Z.]+}},ataddress
757
757
// CHECK-NEXT: The return instruction is {{[0-9a-f]+}}: eret
758
758
eret
759
759
.size f_eret, .-f_eret
760
760
761
761
.globl f_movx30reg
762
762
.type f_movx30reg,@function
763
763
f_movx30reg:
764
-
// CHECK-LABEL: GS-PACRET: non-protected ret found in function f_movx30reg, basic block .LBB{{[0-9]+}},ataddress
764
+
// CHECK-LABEL: GS-PACRET: non-protected ret found in function f_movx30reg, basic block {{[0-9a-zA-Z.]+}},ataddress
765
765
// CHECK-NEXT: The return instruction is {{[0-9a-f]+}}: ret
766
766
// CHECK-NEXT: The 1 instructions thatwrite to the return register after any authentication are:
767
767
// CHECK-NEXT: 1. {{[0-9a-f]+}}: mov x30, x22
@@ -908,7 +908,7 @@ f_autia171615:
908
908
add x0, x0, #3
909
909
ldp x29, x30,[sp], #16
910
910
autia171615
911
-
// CHECK-LABEL: GS-PACRET: non-protected ret found in function f_autia171615, basic block .LBB{{[0-9]+}},ataddress
911
+
// CHECK-LABEL: GS-PACRET: non-protected ret found in function f_autia171615, basic block {{[0-9a-zA-Z.]+}},ataddress
912
912
// CHECK-NEXT: The return instruction is {{[0-9a-f]+}}: ret
913
913
// CHECK-NEXT: The 1 instructions thatwrite to the return register after any authentication are:
Copy file name to clipboardExpand all lines: clang/docs/analyzer/checkers.rst
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3668,6 +3668,51 @@ Here are some examples of situations that we warn about as they *might* be poten
3668
3668
RefCountable* uncounted = counted.get(); // warn
3669
3669
}
3670
3670
3671
+
alpha.webkit.UnretainedLocalVarsChecker
3672
+
"""""""""""""""""""""""""""""""""""""""
3673
+
The goal of this rule is to make sure that any NS or CF local variable is backed by a RetainPtr with lifetime that is strictly larger than the scope of the unretained local variable. To be on the safe side we require the scope of an unretained variable to be embedded in the scope of Retainptr object that backs it.
3674
+
3675
+
The rules of when to use and not to use RetainPtr are same as alpha.webkit.UncountedCallArgsChecker for ref-counted objects.
3676
+
3677
+
These are examples of cases that we consider safe:
3678
+
3679
+
.. code-block:: cpp
3680
+
3681
+
void foo1() {
3682
+
RetainPtr<NSObject> retained;
3683
+
// The scope of unretained is EMBEDDED in the scope of retained.
3684
+
{
3685
+
NSObject* unretained = retained.get(); // ok
3686
+
}
3687
+
}
3688
+
3689
+
void foo2(RetainPtr<NSObject> retained_param) {
3690
+
NSObject* unretained = retained_param.get(); // ok
3691
+
}
3692
+
3693
+
void FooClass::foo_method() {
3694
+
NSObject* unretained = this; // ok
3695
+
}
3696
+
3697
+
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.
0 commit comments