Skip to content

Commit 36fb493

Browse files
authored
[analyzer] Clean up bug types in CallAndMessageChecker (#156073)
In CallAndMessageChecker the initialization of bug types was highly obfuscated (even compared to other `mutable std::unique_ptr` hacks). This commit cleans up this situation and removes a totally superfluous hidded 'modeling' sub-checker that did not have any role apart from obstructing the normal initialization of bug types. (Note that if we need to reintroduce CallAndMessageModeling in the future, we can do it cleanly within the CheckerFamily framework, so we wouldn't need to re-obfuscate the bug type initialization.) This change is mostly non-functional, the only visible change is the removal of the hidden modeling checker.
1 parent 9e75544 commit 36fb493

File tree

4 files changed

+102
-187
lines changed

4 files changed

+102
-187
lines changed

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

Lines changed: 43 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -143,68 +143,49 @@ def BitwiseShiftChecker : Checker<"BitwiseShift">,
143143
]>,
144144
Documentation<HasDocumentation>;
145145

146-
def CallAndMessageModeling : Checker<"CallAndMessageModeling">,
147-
HelpText<"Responsible for essential modeling and assumptions after a "
148-
"function/method call. For instance, if we can't reason about the "
149-
"nullability of the implicit this parameter after a method call, "
150-
"this checker conservatively assumes it to be non-null">,
151-
Documentation<HasDocumentation>,
152-
Hidden;
153-
154-
def CallAndMessageChecker : Checker<"CallAndMessage">,
155-
HelpText<"Check for logical errors for function calls and Objective-C "
156-
"message expressions (e.g., uninitialized arguments, null function "
157-
"pointers)">,
158-
CheckerOptions<[
159-
CmdLineOption<Boolean,
160-
"FunctionPointer",
161-
"Check whether a called function pointer is null or "
162-
"undefined",
163-
"true",
164-
Released>,
165-
CmdLineOption<Boolean,
166-
"ParameterCount",
167-
"Check whether a function was called with the appropriate "
168-
"number of arguments",
169-
"true",
170-
Released>,
171-
CmdLineOption<Boolean,
172-
"CXXThisMethodCall",
173-
"Check whether the implicit this parameter is null or "
174-
"undefined upon a method call",
175-
"true",
176-
Released>,
177-
CmdLineOption<Boolean,
178-
"CXXDeallocationArg",
179-
"Check whether the argument of operator delete is undefined",
180-
"true",
181-
Released>,
182-
CmdLineOption<Boolean,
183-
"ArgInitializedness",
184-
"Check whether any of the pass-by-value parameters is "
185-
"undefined",
186-
"true",
187-
Released>,
188-
CmdLineOption<Boolean,
189-
"ArgPointeeInitializedness",
190-
"Check whether the pointee of a pass-by-reference or "
191-
"pass-by-pointer is undefined",
192-
"false",
193-
InAlpha>,
194-
CmdLineOption<Boolean,
195-
"NilReceiver",
196-
"Check whether the reciever in the message expression is nil",
197-
"true",
198-
Released>,
199-
CmdLineOption<Boolean,
200-
"UndefReceiver",
201-
"Check whether the reciever in the message expression is "
202-
"undefined",
203-
"true",
204-
Released>,
205-
]>,
206-
Documentation<HasDocumentation>,
207-
Dependencies<[CallAndMessageModeling]>;
146+
def CallAndMessageChecker
147+
: Checker<"CallAndMessage">,
148+
HelpText<
149+
"Check for logical errors for function calls and Objective-C "
150+
"message expressions (e.g., uninitialized arguments, null function "
151+
"pointers)">,
152+
CheckerOptions<
153+
[CmdLineOption<Boolean, "FunctionPointer",
154+
"Check whether a called function pointer is null or "
155+
"undefined",
156+
"true", Released>,
157+
CmdLineOption<
158+
Boolean, "ParameterCount",
159+
"Check whether a function was called with the appropriate "
160+
"number of arguments",
161+
"true", Released>,
162+
CmdLineOption<Boolean, "CXXThisMethodCall",
163+
"Check whether the implicit this parameter is null or "
164+
"undefined upon a method call",
165+
"true", Released>,
166+
CmdLineOption<
167+
Boolean, "CXXDeallocationArg",
168+
"Check whether the argument of operator delete is undefined",
169+
"true", Released>,
170+
CmdLineOption<Boolean, "ArgInitializedness",
171+
"Check whether any of the pass-by-value parameters is "
172+
"undefined",
173+
"true", Released>,
174+
CmdLineOption<Boolean, "ArgPointeeInitializedness",
175+
"Check whether the pointee of a pass-by-reference or "
176+
"pass-by-pointer is undefined",
177+
"false", InAlpha>,
178+
CmdLineOption<
179+
Boolean, "NilReceiver",
180+
"Check whether the reciever in the message expression is nil",
181+
"true", Released>,
182+
CmdLineOption<
183+
Boolean, "UndefReceiver",
184+
"Check whether the reciever in the message expression is "
185+
"undefined",
186+
"true", Released>,
187+
]>,
188+
Documentation<HasDocumentation>;
208189

209190
def FixedAddressDereferenceChecker
210191
: Checker<"FixedAddressDereference">,

0 commit comments

Comments
 (0)