Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
Line
Count
Source
1
45.4k
//===-- AnalyzerOptions.def - Metadata about Static Analyses ----*- C++ -*-===//
2
45.4k
//
3
45.4k
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
45.4k
// See https://llvm.org/LICENSE.txt for license information.
5
45.4k
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
45.4k
//
7
45.4k
//===----------------------------------------------------------------------===//
8
45.4k
//
9
45.4k
//  This file defines the analyzer options avaible with -analyzer-config.
10
45.4k
//
11
45.4k
//===----------------------------------------------------------------------===//
12
45.4k
13
#ifndef LLVM_ADT_STRINGREF_H
14
#error This .def file is expected to be included in translation units where \
15
"llvm/ADT/StringRef.h" is already included!
16
#endif
17
18
45.4k
#ifdef ANALYZER_OPTION
19
#ifndef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
20
#error If you didnt include this file with the intent of generating methods, \
21
define both 'ANALYZER_OPTION' and 'ANALYZER_OPTION_DEPENDS_ON_USER_MODE' macros!
22
#endif
23
#endif
24
45.4k
25
#ifndef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
26
#ifdef ANALYZER_OPTION
27
#error If you didnt include this file with the intent of generating methods, \
28
define both 'ANALYZER_OPTION' and 'ANALYZER_OPTION_DEPENDS_ON_USER_MODE' macros!
29
#endif
30
#endif
31
32
#ifndef ANALYZER_OPTION
33
/// Create a new analyzer option, but dont generate a method for it in
34
/// AnalyzerOptions.
35
///
36
///   TYPE - The type of the option object that will be stored in
37
///          AnalyzerOptions. This file is expected to be icluded in translation
38
///          units where AnalyzerOptions.h is included, so types from that
39
///          header should be used.
40
///   NAME - The name of the option object.
41
///   CMDFLAG - The command line flag for the option.
42
///             (-analyzer-config CMDFLAG=VALUE)
43
///   DESC - Description of the flag.
44
///   DEFAULT_VAL - The default value for CMDFLAG.
45
#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL)
46
#endif
47
48
#ifndef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
49
/// Create a new analyzer option, but dont generate a method for it in
50
/// AnalyzerOptions. It's value depends on the option "user-mode".
51
///
52
///   TYPE - The type of the option object that will be stored in
53
///          AnalyzerOptions. This file is expected to be icluded in translation
54
///          units where AnalyzerOptions.h is included, so types from that
55
///          header should be used.
56
///   NAME - The name of the option object.
57
///   CMDFLAG - The command line flag for the option.
58
///             (-analyzer-config CMDFLAG=VALUE)
59
///   DESC - Description of the flag.
60
///   SHALLOW_VAL - The default value for CMDFLAG, when "user-mode" was set to
61
///                 "shallow".
62
///   DEEP_VAL - The default value for CMDFLAG, when "user-mode" was set to
63
///              "deep".
64
#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC,        \
65
                                             SHALLOW_VAL, DEEP_VAL)
66
#endif
67
68
45.4k
//===----------------------------------------------------------------------===//
69
45.4k
// The "mode" option. Since some options depend on this, we list it on top of
70
45.4k
// this file in order to make sure that the generated field for it is
71
45.4k
// initialized before the rest.
72
45.4k
//===----------------------------------------------------------------------===//
73
45.4k
74
45.4k
ANALYZER_OPTION(
75
45.4k
    StringRef, UserMode, "mode",
76
45.4k
    "(string) Controls the high-level analyzer mode, which influences the "
77
45.4k
    "default settings for some of the lower-level config options (such as "
78
45.4k
    "IPAMode). Value: \"deep\", \"shallow\".",
79
45.4k
    "deep")
80
45.4k
81
45.4k
//===----------------------------------------------------------------------===//
82
45.4k
// Boolean analyzer options.
83
45.4k
//===----------------------------------------------------------------------===//
84
45.4k
85
45.4k
ANALYZER_OPTION(bool, ShouldIncludeImplicitDtorsInCFG, "cfg-implicit-dtors",
86
45.4k
                "Whether or not implicit destructors for C++ objects "
87
45.4k
                "should be included in the CFG.",
88
45.4k
                true)
89
45.4k
90
45.4k
ANALYZER_OPTION(bool, ShouldIncludeTemporaryDtorsInCFG, "cfg-temporary-dtors",
91
45.4k
                "Whether or not the destructors for C++ temporary "
92
45.4k
                "objects should be included in the CFG.",
93
45.4k
                true)
94
45.4k
95
45.4k
ANALYZER_OPTION(
96
45.4k
    bool, ShouldIncludeLifetimeInCFG, "cfg-lifetime",
97
45.4k
    "Whether or not end-of-lifetime information should be included in the CFG.",
98
45.4k
    false)
99
45.4k
100
45.4k
ANALYZER_OPTION(bool, ShouldIncludeLoopExitInCFG, "cfg-loopexit",
101
45.4k
                "Whether or not the end of the loop information should "
102
45.4k
                "be included in the CFG.",
103
45.4k
                false)
104
45.4k
105
45.4k
ANALYZER_OPTION(bool, ShouldIncludeRichConstructorsInCFG,
106
45.4k
                "cfg-rich-constructors",
107
45.4k
                "Whether or not construction site information should be "
108
45.4k
                "included in the CFG C++ constructor elements.",
109
45.4k
                true)
110
45.4k
111
45.4k
ANALYZER_OPTION(
112
45.4k
    bool, ShouldIncludeScopesInCFG, "cfg-scopes",
113
45.4k
    "Whether or not scope information should be included in the CFG.", false)
114
45.4k
115
45.4k
ANALYZER_OPTION(
116
45.4k
    bool, MayInlineTemplateFunctions, "c++-template-inlining",
117
45.4k
    "Whether or not templated functions may be considered for inlining.", true)
118
45.4k
119
45.4k
ANALYZER_OPTION(bool, MayInlineCXXStandardLibrary, "c++-stdlib-inlining",
120
45.4k
                "Whether or not C++ standard library functions may be "
121
45.4k
                "considered for inlining.",
122
45.4k
                true)
123
45.4k
124
45.4k
ANALYZER_OPTION(bool, MayInlineCXXAllocator, "c++-allocator-inlining",
125
45.4k
                "Whether or not allocator call may be considered for inlining.",
126
45.4k
                true)
127
45.4k
128
45.4k
ANALYZER_OPTION(
129
45.4k
    bool, MayInlineCXXSharedPtrDtor, "c++-shared_ptr-inlining",
130
45.4k
    "Whether or not the destructor of C++ 'shared_ptr' may be considered for "
131
45.4k
    "inlining. This covers std::shared_ptr, std::tr1::shared_ptr, and "
132
45.4k
    "boost::shared_ptr, and indeed any destructor named '~shared_ptr'.",
133
45.4k
    false)
134
45.4k
135
45.4k
ANALYZER_OPTION(bool, MayInlineCXXTemporaryDtors, "c++-temp-dtor-inlining",
136
45.4k
                "Whether C++ temporary destructors should be inlined "
137
45.4k
                "during analysis. If temporary destructors are disabled "
138
45.4k
                "in the CFG via the 'cfg-temporary-dtors' option, "
139
45.4k
                "temporary destructors would not be inlined anyway.",
140
45.4k
                true)
141
45.4k
142
45.4k
ANALYZER_OPTION(
143
45.4k
    bool, ShouldSuppressNullReturnPaths, "suppress-null-return-paths",
144
45.4k
    "Whether or not paths that go through null returns should be suppressed. "
145
45.4k
    "This is a heuristic for avoiding bug reports with paths that go through "
146
45.4k
    "inlined functions that are more defensive than their callers.",
147
45.4k
    true)
148
45.4k
149
45.4k
ANALYZER_OPTION(
150
45.4k
    bool, ShouldAvoidSuppressingNullArgumentPaths,
151
45.4k
    "avoid-suppressing-null-argument-paths",
152
45.4k
    "Whether a bug report should not be suppressed if its path includes a call "
153
45.4k
    "with a null argument, even if that call has a null return. This option "
154
45.4k
    "has no effect when ShouldSuppressNullReturnPaths is false. This is a "
155
45.4k
    "counter-heuristic to avoid false negatives.",
156
45.4k
    false)
157
45.4k
158
45.4k
ANALYZER_OPTION(bool, ShouldSuppressInlinedDefensiveChecks,
159
45.4k
                "suppress-inlined-defensive-checks",
160
45.4k
                "Whether or not diagnostics containing inlined "
161
45.4k
                "defensive NULL checks should be suppressed.",
162
45.4k
                true)
163
45.4k
164
45.4k
ANALYZER_OPTION(bool, MayInlineCXXContainerMethods, "c++-container-inlining",
165
45.4k
                "Whether or not methods of C++ container objects may be "
166
45.4k
                "considered for inlining.",
167
45.4k
                false)
168
45.4k
169
45.4k
ANALYZER_OPTION(bool, ShouldSuppressFromCXXStandardLibrary,
170
45.4k
                "suppress-c++-stdlib",
171
45.4k
                "Whether or not diagnostics reported within the C++ "
172
45.4k
                "standard library should be suppressed.",
173
45.4k
                true)
174
45.4k
175
45.4k
ANALYZER_OPTION(bool, ShouldCrosscheckWithZ3, "crosscheck-with-z3",
176
45.4k
                "Whether bug reports should be crosschecked with the Z3 "
177
45.4k
                "constraint manager backend.",
178
45.4k
                false)
179
45.4k
180
45.4k
ANALYZER_OPTION(bool, ShouldReportIssuesInMainSourceFile,
181
45.4k
                "report-in-main-source-file",
182
45.4k
                "Whether or not the diagnostic report should be always "
183
45.4k
                "reported in the main source file and not the headers.",
184
45.4k
                false)
185
45.4k
186
45.4k
ANALYZER_OPTION(bool, ShouldWriteStableReportFilename, "stable-report-filename",
187
45.4k
                "Whether or not the report filename should be random or not.",
188
45.4k
                false)
189
45.4k
190
45.4k
ANALYZER_OPTION(
191
45.4k
    bool, ShouldSerializeStats, "serialize-stats",
192
45.4k
    "Whether the analyzer should serialize statistics to plist output. "
193
45.4k
    "Statistics would be serialized in JSON format inside the main dictionary "
194
45.4k
    "under the statistics key. Available only if compiled in assert mode or "
195
45.4k
    "with LLVM statistics explicitly enabled.",
196
45.4k
    false)
197
45.4k
198
45.4k
ANALYZER_OPTION(bool, MayInlineObjCMethod, "objc-inlining",
199
45.4k
                "Whether ObjectiveC inlining is enabled, false otherwise.",
200
45.4k
                true)
201
45.4k
202
45.4k
ANALYZER_OPTION(bool, ShouldPrunePaths, "prune-paths",
203
45.4k
                "Whether irrelevant parts of a bug report path should "
204
45.4k
                "be pruned out of the final output.",
205
45.4k
                true)
206
45.4k
207
45.4k
ANALYZER_OPTION(bool, ShouldAddPopUpNotes, "add-pop-up-notes",
208
45.4k
                "Whether pop-up notes should be added to the final output.",
209
45.4k
                true)
210
45.4k
211
45.4k
ANALYZER_OPTION(
212
45.4k
    bool, ShouldConditionalizeStaticInitializers,
213
45.4k
    "cfg-conditional-static-initializers",
214
45.4k
    "Whether 'static' initializers should be in conditional logic in the CFG.",
215
45.4k
    true)
216
45.4k
217
45.4k
ANALYZER_OPTION(bool, ShouldSynthesizeBodies, "faux-bodies",
218
45.4k
                "Whether the analyzer engine should synthesize fake "
219
45.4k
                "bodies for well-known functions.",
220
45.4k
                true)
221
45.4k
222
45.4k
ANALYZER_OPTION(
223
45.4k
    bool, ShouldElideConstructors, "elide-constructors",
224
45.4k
    "Whether elidable C++ copy-constructors and move-constructors should be "
225
45.4k
    "actually elided during analysis. Both behaviors are allowed by the C++ "
226
45.4k
    "standard, and the analyzer, like CodeGen, defaults to eliding. Starting "
227
45.4k
    "with C++17 some elisions become mandatory, and in these cases the option "
228
45.4k
    "will be ignored.",
229
45.4k
    true)
230
45.4k
231
45.4k
ANALYZER_OPTION(
232
45.4k
    bool, ShouldInlineLambdas, "inline-lambdas",
233
45.4k
    "Whether lambdas should be inlined. Otherwise a sink node will be "
234
45.4k
    "generated each time a LambdaExpr is visited.",
235
45.4k
    true)
236
45.4k
237
45.4k
ANALYZER_OPTION(bool, ShouldWidenLoops, "widen-loops",
238
45.4k
                "Whether the analysis should try to widen loops.", false)
239
45.4k
240
45.4k
ANALYZER_OPTION(
241
45.4k
    bool, ShouldUnrollLoops, "unroll-loops",
242
45.4k
    "Whether the analysis should try to unroll loops with known bounds.", false)
243
45.4k
244
45.4k
ANALYZER_OPTION(
245
45.4k
    bool, ShouldDisplayNotesAsEvents, "notes-as-events",
246
45.4k
    "Whether the bug reporter should transparently treat extra note diagnostic "
247
45.4k
    "pieces as event diagnostic pieces. Useful when the diagnostic consumer "
248
45.4k
    "doesn't support the extra note pieces.",
249
45.4k
    false)
250
45.4k
251
45.4k
ANALYZER_OPTION(
252
45.4k
    bool, ShouldAggressivelySimplifyBinaryOperation,
253
45.4k
    "aggressive-binary-operation-simplification",
254
45.4k
    "Whether SValBuilder should rearrange comparisons and additive operations "
255
45.4k
    "of symbolic expressions which consist of a sum of a symbol and a concrete "
256
45.4k
    "integer into the format where symbols are on the left-hand side and the "
257
45.4k
    "integer is on the right. This is only done if both symbols and both "
258
45.4k
    "concrete integers are signed, greater than or equal to the quarter of the "
259
45.4k
    "minimum value of the type and less than or equal to the quarter of the "
260
45.4k
    "maximum value of that type. A + n <OP> B + m becomes A - B <OP> m - n, "
261
45.4k
    "where A and B symbolic, n and m are integers. <OP> is any of '==', '!=', "
262
45.4k
    "'<', '<=', '>', '>=', '+' or '-'. The rearrangement also happens with '-' "
263
45.4k
    "instead of '+' on either or both side and also if any or both integers "
264
45.4k
    "are missing.",
265
45.4k
    false)
266
45.4k
267
45.4k
ANALYZER_OPTION(
268
45.4k
    bool, ShouldEagerlyAssume, "eagerly-assume",
269
45.4k
    "Whether we should eagerly assume evaluations of conditionals, thus, "
270
45.4k
    "bifurcating the path. This indicates how the engine should handle "
271
45.4k
    "expressions such as: 'x = (y != 0)'. When this is true then the "
272
45.4k
    "subexpression 'y != 0' will be eagerly assumed to be true or false, thus "
273
45.4k
    "evaluating it to the integers 0 or 1 respectively. The upside is that "
274
45.4k
    "this can increase analysis precision until we have a better way to lazily "
275
45.4k
    "evaluate such logic. The downside is that it eagerly bifurcates paths.",
276
45.4k
    true)
277
45.4k
278
45.4k
ANALYZER_OPTION(
279
45.4k
    bool, IsNaiveCTUEnabled, "experimental-enable-naive-ctu-analysis",
280
45.4k
    "Whether naive cross translation unit analysis is enabled. This is an "
281
45.4k
    "experimental feature to inline functions from other translation units.",
282
45.4k
    false)
283
45.4k
284
45.4k
ANALYZER_OPTION(bool, ShouldDisplayMacroExpansions, "expand-macros",
285
45.4k
                "Whether macros related to the bugpath should be "
286
45.4k
                "expanded and included in the plist output.",
287
45.4k
                false)
288
45.4k
289
45.4k
ANALYZER_OPTION(bool, DisplayCTUProgress, "display-ctu-progress",
290
45.4k
                "Whether to emit verbose output about "
291
45.4k
                "the analyzer's progress related to ctu.",
292
45.4k
                false)
293
45.4k
294
45.4k
ANALYZER_OPTION(bool, ShouldTrackConditions, "track-conditions",
295
45.4k
                "Whether to track conditions that are a control dependency of "
296
45.4k
                "an already tracked variable.",
297
45.4k
                false)
298
45.4k
299
45.4k
ANALYZER_OPTION(bool, ShouldTrackConditionsDebug, "track-conditions-debug",
300
45.4k
                "Whether to place an event at each tracked condition.",
301
45.4k
                false)
302
45.4k
303
45.4k
ANALYZER_OPTION(unsigned, CTUImportThreshold, "ctu-import-threshold",
304
45.4k
                "The maximal amount of translation units that is considered "
305
45.4k
                "for import when inlining functions during CTU analysis. "
306
45.4k
                "Lowering this threshold can alleviate the memory burder of "
307
45.4k
                "analysis with many interdependent definitions located in "
308
45.4k
                "various translation units.",
309
45.4k
                100u)
310
45.4k
311
45.4k
//===----------------------------------------------------------------------===//
312
45.4k
// Unsinged analyzer options.
313
45.4k
//===----------------------------------------------------------------------===//
314
45.4k
315
45.4k
ANALYZER_OPTION(
316
45.4k
    unsigned, AlwaysInlineSize, "ipa-always-inline-size",
317
45.4k
    "The size of the functions (in basic blocks), which should be considered "
318
45.4k
    "to be small enough to always inline.",
319
45.4k
    3)
320
45.4k
321
45.4k
ANALYZER_OPTION(
322
45.4k
    unsigned, GraphTrimInterval, "graph-trim-interval",
323
45.4k
    "How often nodes in the ExplodedGraph should be recycled to save memory. "
324
45.4k
    "To disable node reclamation, set the option to 0.",
325
45.4k
    1000)
326
45.4k
327
45.4k
ANALYZER_OPTION(
328
45.4k
    unsigned, MinCFGSizeTreatFunctionsAsLarge,
329
45.4k
    "min-cfg-size-treat-functions-as-large",
330
45.4k
    "The number of basic blocks a function needs to have to be considered "
331
45.4k
    "large for the 'max-times-inline-large' config option.",
332
45.4k
    14)
333
45.4k
334
45.4k
ANALYZER_OPTION(unsigned, MaxSymbolComplexity, "max-symbol-complexity",
335
45.4k
                "The maximum complexity of symbolic constraint.", 35)
336
45.4k
337
45.4k
ANALYZER_OPTION(unsigned, MaxTimesInlineLarge, "max-times-inline-large",
338
45.4k
                "The maximum times a large function could be inlined.", 32)
339
45.4k
340
45.4k
ANALYZER_OPTION_DEPENDS_ON_USER_MODE(
341
45.4k
    unsigned, MaxInlinableSize, "max-inlinable-size",
342
45.4k
    "The bound on the number of basic blocks in an inlined function.",
343
45.4k
    /* SHALLOW_VAL */ 4, /* DEEP_VAL */ 100)
344
45.4k
345
45.4k
ANALYZER_OPTION_DEPENDS_ON_USER_MODE(
346
45.4k
    unsigned, MaxNodesPerTopLevelFunction, "max-nodes",
347
45.4k
    "The maximum number of nodes the analyzer can generate while exploring a "
348
45.4k
    "top level function (for each exploded graph). 0 means no limit.",
349
45.4k
    /* SHALLOW_VAL */ 75000, /* DEEP_VAL */ 225000)
350
45.4k
351
45.4k
ANALYZER_OPTION(
352
45.4k
    unsigned, RegionStoreSmallStructLimit, "region-store-small-struct-limit",
353
45.4k
    "The largest number of fields a struct can have and still be considered "
354
45.4k
    "small This is currently used to decide whether or not it is worth forcing "
355
45.4k
    "a LazyCompoundVal on bind. To disable all small-struct-dependent "
356
45.4k
    "behavior, set the option to 0.",
357
45.4k
    2)
358
45.4k
359
45.4k
//===----------------------------------------------------------------------===//
360
45.4k
// String analyzer options.
361
45.4k
//===----------------------------------------------------------------------===//
362
45.4k
363
45.4k
ANALYZER_OPTION(StringRef, CTUDir, "ctu-dir",
364
45.4k
                "The directory containing the CTU related files.", "")
365
45.4k
366
45.4k
ANALYZER_OPTION(StringRef, CTUIndexName, "ctu-index-name",
367
45.4k
                "the name of the file containing the CTU index of definitions.",
368
45.4k
                "externalDefMap.txt")
369
45.4k
370
45.4k
ANALYZER_OPTION(
371
45.4k
    StringRef, ModelPath, "model-path",
372
45.4k
    "The analyzer can inline an alternative implementation written in C at the "
373
45.4k
    "call site if the called function's body is not available. This is a path "
374
45.4k
    "where to look for those alternative implementations (called models).",
375
45.4k
    "")
376
45.4k
377
45.4k
ANALYZER_OPTION(
378
45.4k
    StringRef, CXXMemberInliningMode, "c++-inlining",
379
45.4k
    "Controls which C++ member functions will be considered for inlining. "
380
45.4k
    "Value: \"constructors\", \"destructors\", \"methods\".",
381
45.4k
    "destructors")
382
45.4k
383
45.4k
ANALYZER_OPTION_DEPENDS_ON_USER_MODE(
384
45.4k
    StringRef, IPAMode, "ipa",
385
45.4k
    "Controls the mode of inter-procedural analysis. Value: \"none\", "
386
45.4k
    "\"basic-inlining\", \"inlining\", \"dynamic\", \"dynamic-bifurcate\".",
387
45.4k
    /* SHALLOW_VAL */ "inlining", /* DEEP_VAL */ "dynamic-bifurcate")
388
45.4k
389
45.4k
ANALYZER_OPTION(
390
45.4k
    StringRef, ExplorationStrategy, "exploration_strategy",
391
45.4k
    "Value: \"dfs\", \"bfs\", \"unexplored_first\", "
392
45.4k
    "\"unexplored_first_queue\", \"unexplored_first_location_queue\", "
393
45.4k
    "\"bfs_block_dfs_contents\".",
394
45.4k
    "unexplored_first_queue")
395
45.4k
396
45.4k
#undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
397
45.4k
#undef ANALYZER_OPTION