Skip to content

Commit 69f42e9

Browse files
committed
addressing review comments
1 parent d60d9c7 commit 69f42e9

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

clang/docs/analyzer/checkers.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ The ``SuppressAddressSpaces`` option suppresses
129129
warnings for null dereferences of all pointers with address spaces. You can
130130
disable this behavior with the option
131131
``-analyzer-config core.NullDereference:SuppressAddressSpaces=false``.
132-
Value of this option is used for checker
133-
:ref:`_alpha-core-FixedAddressDereference` too.
132+
Value of this option is also used for checker
133+
:ref:`_alpha-core-FixedAddressDereference`.
134134
*Defaults to true*.
135135

136136
.. code-block:: objc
@@ -2925,19 +2925,7 @@ Check for assignment of a fixed address to a pointer.
29252925
29262926
alpha.core.FixedAddressDereference (C, C++, ObjC)
29272927
"""""""""""""""""""""""""""""""""""""""""""""""""
2928-
Check for dereferences of fixed values used as pointers.
2929-
2930-
Similarly as at :ref:`_core-NullDereference`, the checker specifically does
2931-
not report dereferences for x86 and x86-64 targets when the
2932-
address space is 256 (x86 GS Segment), 257 (x86 FS Segment), or 258 (x86 SS
2933-
segment). (See `X86/X86-64 Language Extensions
2934-
<https://clang.llvm.org/docs/LanguageExtensions.html#memory-references-to-specified-segments>`__
2935-
for reference.)
2936-
2937-
If you want to disable this behavior, set the ``SuppressAddressSpaces`` option
2938-
of checker ``core.NullDereference`` to false, like
2939-
``-analyzer-config core.NullDereference:SuppressAddressSpaces=false``. The value
2940-
of this option is used for both checkers.
2928+
Check for dereferences of fixed addresses.
29412929
29422930
.. code-block:: c
29432931
@@ -2957,6 +2945,18 @@ of this option is used for both checkers.
29572945
int x = (*p_function)('x', 'y'); // NO warning yet at functon pointer calls
29582946
}
29592947
2948+
Similarly to :ref:`_core-NullDereference`, the checker intentionally does
2949+
not report dereferences for x86 and x86-64 targets when the
2950+
address space is 256 (x86 GS Segment), 257 (x86 FS Segment), or 258 (x86 SS
2951+
Segment). (See `X86/X86-64 Language Extensions
2952+
<https://clang.llvm.org/docs/LanguageExtensions.html#memory-references-to-specified-segments>`__
2953+
for reference.)
2954+
2955+
If you want to disable this behavior, set the ``SuppressAddressSpaces`` option
2956+
of checker ``core.NullDereference`` to false, like
2957+
``-analyzer-config core.NullDereference:SuppressAddressSpaces=false``. The value
2958+
of this option is used for both checkers.
2959+
29602960
.. _alpha-core-PointerArithm:
29612961
29622962
alpha.core.PointerArithm (C)

clang/include/clang/StaticAnalyzer/Checkers/Checkers.td

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,17 @@ def DereferenceModeling : Checker<"DereferenceModeling">,
211211
Documentation<NotDocumented>,
212212
Hidden;
213213

214-
def NullDereferenceChecker
215-
: Checker<"NullDereference">,
216-
HelpText<"Check for dereferences of null pointers">,
217-
CheckerOptions<[CmdLineOption<
218-
Boolean, "SuppressAddressSpaces",
219-
"Suppresses warning when pointer dereferences an address space",
220-
"true", Released>]>,
221-
Documentation<HasDocumentation>,
222-
Dependencies<[DereferenceModeling]>;
214+
def NullDereferenceChecker : Checker<"NullDereference">,
215+
HelpText<"Check for dereferences of null pointers">,
216+
CheckerOptions<[
217+
CmdLineOption<Boolean,
218+
"SuppressAddressSpaces",
219+
"Suppresses warning when pointer dereferences an address space",
220+
"true",
221+
Released>
222+
]>,
223+
Documentation<HasDocumentation>,
224+
Dependencies<[DereferenceModeling]>;
223225

224226
def NonNullParamChecker : Checker<"NonNullParamChecker">,
225227
HelpText<"Check for null pointers passed as arguments to a function whose "
@@ -285,7 +287,7 @@ def FixedAddressChecker : Checker<"FixedAddr">,
285287

286288
def FixedAddressDereferenceChecker
287289
: Checker<"FixedAddressDereference">,
288-
HelpText<"Check for dereferences of fixed values used as pointers">,
290+
HelpText<"Check for dereferences of fixed addresses">,
289291
Documentation<HasDocumentation>,
290292
Dependencies<[DereferenceModeling]>;
291293

clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DereferenceChecker
3535
NullPointer,
3636
UndefinedPointerValue,
3737
AddressOfLabel,
38-
FixedAddress
38+
FixedAddress,
3939
};
4040

4141
void reportBug(DerefKind K, ProgramStateRef State, const Stmt *S,

clang/test/Analysis/concrete-address.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extern void __assert_fail (__const char *__assertion, __const char *__file,
77
#define assert(expr) \
88
((expr) ? (void)(0) : __assert_fail (#expr, __FILE__, __LINE__, __func__))
99

10-
typedef unsigned long uintptr_t;
10+
typedef unsigned long long uintptr_t;
1111

1212
void f0(void) {
1313
int *p = (int*) 0x10000; // Should not crash here.

0 commit comments

Comments
 (0)