clang  7.0.0svn
AnalyzerOptions.h
Go to the documentation of this file.
1 //===- AnalyzerOptions.h - Analysis Engine Options --------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This header defines various options for the static analyzer that are set
11 // by the frontend and are consulted throughout the analyzer.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H
16 #define LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H
17 
18 #include "clang/Basic/LLVM.h"
19 #include "llvm/ADT/IntrusiveRefCntPtr.h"
20 #include "llvm/ADT/Optional.h"
21 #include "llvm/ADT/StringMap.h"
22 #include "llvm/ADT/StringRef.h"
23 #include <string>
24 #include <utility>
25 #include <vector>
26 
27 namespace clang {
28 
29 namespace ento {
30 
31 class CheckerBase;
32 
33 } // namespace ento
34 
35 /// Analysis - Set of available source code analyses.
36 enum Analyses {
37 #define ANALYSIS(NAME, CMDFLAG, DESC, SCOPE) NAME,
38 #include "clang/StaticAnalyzer/Core/Analyses.def"
40 };
41 
42 /// AnalysisStores - Set of available analysis store models.
44 #define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN) NAME##Model,
45 #include "clang/StaticAnalyzer/Core/Analyses.def"
47 };
48 
49 /// AnalysisConstraints - Set of available constraint models.
51 #define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) NAME##Model,
52 #include "clang/StaticAnalyzer/Core/Analyses.def"
54 };
55 
56 /// AnalysisDiagClients - Set of available diagnostic clients for rendering
57 /// analysis results.
59 #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN) PD_##NAME,
60 #include "clang/StaticAnalyzer/Core/Analyses.def"
63 };
64 
65 /// AnalysisPurgeModes - Set of available strategies for dead symbol removal.
67 #define ANALYSIS_PURGE(NAME, CMDFLAG, DESC) NAME,
68 #include "clang/StaticAnalyzer/Core/Analyses.def"
70 };
71 
72 /// AnalysisInlineFunctionSelection - Set of inlining function selection heuristics.
74 #define ANALYSIS_INLINING_MODE(NAME, CMDFLAG, DESC) NAME,
75 #include "clang/StaticAnalyzer/Core/Analyses.def"
77 };
78 
79 /// Describes the different kinds of C++ member functions which can be
80 /// considered for inlining by the analyzer.
81 ///
82 /// These options are cumulative; enabling one kind of member function will
83 /// enable all kinds with lower enum values.
85  // Uninitialized = 0,
86 
87  /// A dummy mode in which no C++ inlining is enabled.
88  CIMK_None = 1,
89 
90  /// Refers to regular member function and operator calls.
92 
93  /// Refers to constructors (implicit or explicit).
94  ///
95  /// Note that a constructor will not be inlined if the corresponding
96  /// destructor is non-trivial.
98 
99  /// Refers to destructors (implicit or explicit).
101 };
102 
103 /// Describes the different modes of inter-procedural analysis.
104 enum IPAKind {
106 
107  /// Perform only intra-procedural analysis.
109 
110  /// Inline C functions and blocks when their definitions are available.
112 
113  /// Inline callees(C, C++, ObjC) when their definitions are available.
115 
116  /// Enable inlining of dynamically dispatched methods.
118 
119  /// Enable inlining of dynamically dispatched methods, bifurcate paths when
120  /// exact type info is unavailable.
122 };
123 
124 class AnalyzerOptions : public RefCountedBase<AnalyzerOptions> {
125 public:
126  using ConfigTable = llvm::StringMap<std::string>;
127 
128  static std::vector<StringRef>
129  getRegisteredCheckers(bool IncludeExperimental = false);
130 
131  /// Pair of checker name and enable/disable.
132  std::vector<std::pair<std::string, bool>> CheckersControlList;
133 
134  /// A key-value table of use-specified configuration values.
136  AnalysisStores AnalysisStoreOpt = RegionStoreModel;
137  AnalysisConstraints AnalysisConstraintsOpt = RangeConstraintsModel;
138  AnalysisDiagClients AnalysisDiagOpt = PD_HTML;
139  AnalysisPurgeMode AnalysisPurgeOpt = PurgeStmt;
140 
142 
143  /// Store full compiler invocation for reproducible instructions in the
144  /// generated report.
146 
147  /// The maximum number of times the analyzer visits a block.
149 
150  /// Disable all analyzer checks.
151  ///
152  /// This flag allows one to disable analyzer checks on the code processed by
153  /// the given analysis consumer. Note, the code will get parsed and the
154  /// command-line options will get checked.
155  unsigned DisableAllChecks : 1;
156 
157  unsigned ShowCheckerHelp : 1;
159  unsigned AnalyzeAll : 1;
161  unsigned AnalyzeNestedBlocks : 1;
162 
163  /// The flag regulates if we should eagerly assume evaluations of
164  /// conditionals, thus, bifurcating the path.
165  ///
166  /// This flag indicates how the engine should handle expressions such as: 'x =
167  /// (y != 0)'. When this flag is true then the subexpression 'y != 0' will be
168  /// eagerly assumed to be true or false, thus evaluating it to the integers 0
169  /// or 1 respectively. The upside is that this can increase analysis
170  /// precision until we have a better way to lazily evaluate such logic. The
171  /// downside is that it eagerly bifurcates paths.
173 
174  unsigned TrimGraph : 1;
177  unsigned UnoptimizedCFG : 1;
178  unsigned PrintStats : 1;
179 
180  /// Do not re-analyze paths leading to exhausted nodes with a different
181  /// strategy. We get better code coverage when retry is enabled.
182  unsigned NoRetryExhausted : 1;
183 
184  /// The inlining stack depth limit.
185  // Cap the stack depth at 4 calls (5 stack frames, base + 4 calls).
186  unsigned InlineMaxStackDepth = 5;
187 
188  /// The mode of function selection used during inlining.
189  AnalysisInliningMode InliningMode = NoRedundancy;
190 
192  DFS,
193  BFS,
194  UnexploredFirst,
195  UnexploredFirstQueue,
196  BFSBlockDFSContents,
197  NotSet
198  };
199 
200 private:
201  ExplorationStrategyKind ExplorationStrategy = ExplorationStrategyKind::NotSet;
202 
203  /// Describes the kinds for high-level analyzer mode.
204  enum UserModeKind {
205  UMK_NotSet = 0,
206 
207  /// Perform shallow but fast analyzes.
208  UMK_Shallow = 1,
209 
210  /// Perform deep analyzes.
211  UMK_Deep = 2
212  };
213 
214  /// Controls the high-level analyzer mode, which influences the default
215  /// settings for some of the lower-level config options (such as IPAMode).
216  /// \sa getUserMode
217  UserModeKind UserMode = UMK_NotSet;
218 
219  /// Controls the mode of inter-procedural analysis.
220  IPAKind IPAMode = IPAK_NotSet;
221 
222  /// Controls which C++ member functions will be considered for inlining.
223  CXXInlineableMemberKind CXXMemberInliningMode;
224 
225  /// \sa includeImplicitDtorsInCFG
226  Optional<bool> IncludeImplicitDtorsInCFG;
227 
228  /// \sa includeTemporaryDtorsInCFG
229  Optional<bool> IncludeTemporaryDtorsInCFG;
230 
231  /// \sa IncludeLifetimeInCFG
232  Optional<bool> IncludeLifetimeInCFG;
233 
234  /// \sa IncludeLoopExitInCFG
235  Optional<bool> IncludeLoopExitInCFG;
236 
237  /// \sa IncludeRichConstructorsInCFG
238  Optional<bool> IncludeRichConstructorsInCFG;
239 
240  /// \sa mayInlineCXXStandardLibrary
241  Optional<bool> InlineCXXStandardLibrary;
242 
243  /// \sa includeScopesInCFG
244  Optional<bool> IncludeScopesInCFG;
245 
246  /// \sa mayInlineTemplateFunctions
247  Optional<bool> InlineTemplateFunctions;
248 
249  /// \sa mayInlineCXXAllocator
250  Optional<bool> InlineCXXAllocator;
251 
252  /// \sa mayInlineCXXContainerMethods
253  Optional<bool> InlineCXXContainerMethods;
254 
255  /// \sa mayInlineCXXSharedPtrDtor
256  Optional<bool> InlineCXXSharedPtrDtor;
257 
258  /// \sa mayInlineCXXTemporaryDtors
259  Optional<bool> InlineCXXTemporaryDtors;
260 
261  /// \sa mayInlineObjCMethod
262  Optional<bool> ObjCInliningMode;
263 
264  // Cache of the "ipa-always-inline-size" setting.
265  // \sa getAlwaysInlineSize
266  Optional<unsigned> AlwaysInlineSize;
267 
268  /// \sa shouldSuppressNullReturnPaths
269  Optional<bool> SuppressNullReturnPaths;
270 
271  // \sa getMaxInlinableSize
272  Optional<unsigned> MaxInlinableSize;
273 
274  /// \sa shouldAvoidSuppressingNullArgumentPaths
275  Optional<bool> AvoidSuppressingNullArgumentPaths;
276 
277  /// \sa shouldSuppressInlinedDefensiveChecks
278  Optional<bool> SuppressInlinedDefensiveChecks;
279 
280  /// \sa shouldSuppressFromCXXStandardLibrary
281  Optional<bool> SuppressFromCXXStandardLibrary;
282 
283  /// \sa shouldCrosscheckWithZ3
284  Optional<bool> CrosscheckWithZ3;
285 
286  /// \sa reportIssuesInMainSourceFile
287  Optional<bool> ReportIssuesInMainSourceFile;
288 
289  /// \sa StableReportFilename
290  Optional<bool> StableReportFilename;
291 
292  Optional<bool> SerializeStats;
293 
294  /// \sa getGraphTrimInterval
295  Optional<unsigned> GraphTrimInterval;
296 
297  /// \sa getMaxTimesInlineLarge
298  Optional<unsigned> MaxTimesInlineLarge;
299 
300  /// \sa getMinCFGSizeTreatFunctionsAsLarge
301  Optional<unsigned> MinCFGSizeTreatFunctionsAsLarge;
302 
303  /// \sa getMaxNodesPerTopLevelFunction
304  Optional<unsigned> MaxNodesPerTopLevelFunction;
305 
306  /// \sa shouldInlineLambdas
307  Optional<bool> InlineLambdas;
308 
309  /// \sa shouldWidenLoops
310  Optional<bool> WidenLoops;
311 
312  /// \sa shouldUnrollLoops
313  Optional<bool> UnrollLoops;
314 
315  /// \sa shouldDisplayNotesAsEvents
316  Optional<bool> DisplayNotesAsEvents;
317 
318  /// \sa shouldAggressivelySimplifyRelationalComparison
319  Optional<bool> AggressiveRelationalComparisonSimplification;
320 
321  /// \sa getCTUDir
322  Optional<StringRef> CTUDir;
323 
324  /// \sa getCTUIndexName
325  Optional<StringRef> CTUIndexName;
326 
327  /// \sa naiveCTUEnabled
328  Optional<bool> NaiveCTU;
329 
330 
331  /// A helper function that retrieves option for a given full-qualified
332  /// checker name.
333  /// Options for checkers can be specified via 'analyzer-config' command-line
334  /// option.
335  /// Example:
336  /// @code-analyzer-config unix.Malloc:OptionName=CheckerOptionValue @endcode
337  /// or @code-analyzer-config unix:OptionName=GroupOptionValue @endcode
338  /// for groups of checkers.
339  /// @param [in] CheckerName Full-qualified checker name, like
340  /// alpha.unix.StreamChecker.
341  /// @param [in] OptionName Name of the option to get.
342  /// @param [in] Default Default value if no option is specified.
343  /// @param [in] SearchInParents If set to true and the searched option was not
344  /// specified for the given checker the options for the parent packages will
345  /// be searched as well. The inner packages take precedence over the outer
346  /// ones.
347  /// @retval CheckerOptionValue An option for a checker if it was specified.
348  /// @retval GroupOptionValue An option for group if it was specified and no
349  /// checker-specific options were found. The closer group to checker,
350  /// the more priority it has. For example, @c coregroup.subgroup has more
351  /// priority than @c coregroup for @c coregroup.subgroup.CheckerName checker.
352  /// @retval Default If nor checker option, nor group option was found.
353  StringRef getCheckerOption(StringRef CheckerName, StringRef OptionName,
354  StringRef Default,
355  bool SearchInParents = false);
356 
357 public:
359  : DisableAllChecks(false), ShowCheckerHelp(false),
360  ShowEnabledCheckerList(false), AnalyzeAll(false),
361  AnalyzerDisplayProgress(false), AnalyzeNestedBlocks(false),
362  eagerlyAssumeBinOpBifurcation(false), TrimGraph(false),
363  visualizeExplodedGraphWithGraphViz(false),
364  visualizeExplodedGraphWithUbiGraph(false), UnoptimizedCFG(false),
365  PrintStats(false), NoRetryExhausted(false), CXXMemberInliningMode() {}
366 
367  /// Interprets an option's string value as a boolean. The "true" string is
368  /// interpreted as true and the "false" string is interpreted as false.
369  ///
370  /// If an option value is not provided, returns the given \p DefaultVal.
371  /// @param [in] Name Name for option to retrieve.
372  /// @param [in] DefaultVal Default value returned if no such option was
373  /// specified.
374  /// @param [in] C The optional checker parameter that can be used to restrict
375  /// the search to the options of this particular checker (and its parents
376  /// depending on search mode).
377  /// @param [in] SearchInParents If set to true and the searched option was not
378  /// specified for the given checker the options for the parent packages will
379  /// be searched as well. The inner packages take precedence over the outer
380  /// ones.
381  bool getBooleanOption(StringRef Name, bool DefaultVal,
382  const ento::CheckerBase *C = nullptr,
383  bool SearchInParents = false);
384 
385  /// Variant that accepts a Optional value to cache the result.
386  ///
387  /// @param [in,out] V Return value storage, returned if parameter contains
388  /// an existing valid option, else it is used to store a return value
389  /// @param [in] Name Name for option to retrieve.
390  /// @param [in] DefaultVal Default value returned if no such option was
391  /// specified.
392  /// @param [in] C The optional checker parameter that can be used to restrict
393  /// the search to the options of this particular checker (and its parents
394  /// depending on search mode).
395  /// @param [in] SearchInParents If set to true and the searched option was not
396  /// specified for the given checker the options for the parent packages will
397  /// be searched as well. The inner packages take precedence over the outer
398  /// ones.
399  bool getBooleanOption(Optional<bool> &V, StringRef Name, bool DefaultVal,
400  const ento::CheckerBase *C = nullptr,
401  bool SearchInParents = false);
402 
403  /// Interprets an option's string value as an integer value.
404  ///
405  /// If an option value is not provided, returns the given \p DefaultVal.
406  /// @param [in] Name Name for option to retrieve.
407  /// @param [in] DefaultVal Default value returned if no such option was
408  /// specified.
409  /// @param [in] C The optional checker parameter that can be used to restrict
410  /// the search to the options of this particular checker (and its parents
411  /// depending on search mode).
412  /// @param [in] SearchInParents If set to true and the searched option was not
413  /// specified for the given checker the options for the parent packages will
414  /// be searched as well. The inner packages take precedence over the outer
415  /// ones.
416  int getOptionAsInteger(StringRef Name, int DefaultVal,
417  const ento::CheckerBase *C = nullptr,
418  bool SearchInParents = false);
419 
420  /// Query an option's string value.
421  ///
422  /// If an option value is not provided, returns the given \p DefaultVal.
423  /// @param [in] Name Name for option to retrieve.
424  /// @param [in] DefaultVal Default value returned if no such option was
425  /// specified.
426  /// @param [in] C The optional checker parameter that can be used to restrict
427  /// the search to the options of this particular checker (and its parents
428  /// depending on search mode).
429  /// @param [in] SearchInParents If set to true and the searched option was not
430  /// specified for the given checker the options for the parent packages will
431  /// be searched as well. The inner packages take precedence over the outer
432  /// ones.
433  StringRef getOptionAsString(StringRef Name, StringRef DefaultVal,
434  const ento::CheckerBase *C = nullptr,
435  bool SearchInParents = false);
436 
437  /// Retrieves and sets the UserMode. This is a high-level option,
438  /// which is used to set other low-level options. It is not accessible
439  /// outside of AnalyzerOptions.
440  UserModeKind getUserMode();
441 
442  ExplorationStrategyKind getExplorationStrategy();
443 
444  /// Returns the inter-procedural analysis mode.
445  IPAKind getIPAMode();
446 
447  /// Returns the option controlling which C++ member functions will be
448  /// considered for inlining.
449  ///
450  /// This is controlled by the 'c++-inlining' config option.
451  ///
452  /// \sa CXXMemberInliningMode
453  bool mayInlineCXXMemberFunction(CXXInlineableMemberKind K);
454 
455  /// Returns true if ObjectiveC inlining is enabled, false otherwise.
456  bool mayInlineObjCMethod();
457 
458  /// Returns whether or not the destructors for C++ temporary objects should
459  /// be included in the CFG.
460  ///
461  /// This is controlled by the 'cfg-temporary-dtors' config option, which
462  /// accepts the values "true" and "false".
463  bool includeTemporaryDtorsInCFG();
464 
465  /// Returns whether or not implicit destructors for C++ objects should
466  /// be included in the CFG.
467  ///
468  /// This is controlled by the 'cfg-implicit-dtors' config option, which
469  /// accepts the values "true" and "false".
470  bool includeImplicitDtorsInCFG();
471 
472  /// Returns whether or not end-of-lifetime information should be included in
473  /// the CFG.
474  ///
475  /// This is controlled by the 'cfg-lifetime' config option, which accepts
476  /// the values "true" and "false".
477  bool includeLifetimeInCFG();
478 
479  /// Returns whether or not the end of the loop information should be included
480  /// in the CFG.
481  ///
482  /// This is controlled by the 'cfg-loopexit' config option, which accepts
483  /// the values "true" and "false".
484  bool includeLoopExitInCFG();
485 
486  /// Returns whether or not construction site information should be included
487  /// in the CFG C++ constructor elements.
488  ///
489  /// This is controlled by the 'cfg-rich-constructors' config options,
490  /// which accepts the values "true" and "false".
491  bool includeRichConstructorsInCFG();
492 
493  /// Returns whether or not scope information should be included in the CFG.
494  ///
495  /// This is controlled by the 'cfg-scope-info' config option, which accepts
496  /// the values "true" and "false".
497  bool includeScopesInCFG();
498 
499  /// Returns whether or not C++ standard library functions may be considered
500  /// for inlining.
501  ///
502  /// This is controlled by the 'c++-stdlib-inlining' config option, which
503  /// accepts the values "true" and "false".
504  bool mayInlineCXXStandardLibrary();
505 
506  /// Returns whether or not templated functions may be considered for inlining.
507  ///
508  /// This is controlled by the 'c++-template-inlining' config option, which
509  /// accepts the values "true" and "false".
510  bool mayInlineTemplateFunctions();
511 
512  /// Returns whether or not allocator call may be considered for inlining.
513  ///
514  /// This is controlled by the 'c++-allocator-inlining' config option, which
515  /// accepts the values "true" and "false".
516  bool mayInlineCXXAllocator();
517 
518  /// Returns whether or not methods of C++ container objects may be considered
519  /// for inlining.
520  ///
521  /// This is controlled by the 'c++-container-inlining' config option, which
522  /// accepts the values "true" and "false".
523  bool mayInlineCXXContainerMethods();
524 
525  /// Returns whether or not the destructor of C++ 'shared_ptr' may be
526  /// considered for inlining.
527  ///
528  /// This covers std::shared_ptr, std::tr1::shared_ptr, and boost::shared_ptr,
529  /// and indeed any destructor named "~shared_ptr".
530  ///
531  /// This is controlled by the 'c++-shared_ptr-inlining' config option, which
532  /// accepts the values "true" and "false".
533  bool mayInlineCXXSharedPtrDtor();
534 
535  /// Returns true if C++ temporary destructors should be inlined during
536  /// analysis.
537  ///
538  /// If temporary destructors are disabled in the CFG via the
539  /// 'cfg-temporary-dtors' option, temporary destructors would not be
540  /// inlined anyway.
541  ///
542  /// This is controlled by the 'c++-temp-dtor-inlining' config option, which
543  /// accepts the values "true" and "false".
544  bool mayInlineCXXTemporaryDtors();
545 
546  /// Returns whether or not paths that go through null returns should be
547  /// suppressed.
548  ///
549  /// This is a heuristic for avoiding bug reports with paths that go through
550  /// inlined functions that are more defensive than their callers.
551  ///
552  /// This is controlled by the 'suppress-null-return-paths' config option,
553  /// which accepts the values "true" and "false".
554  bool shouldSuppressNullReturnPaths();
555 
556  /// Returns whether a bug report should \em not be suppressed if its path
557  /// includes a call with a null argument, even if that call has a null return.
558  ///
559  /// This option has no effect when #shouldSuppressNullReturnPaths() is false.
560  ///
561  /// This is a counter-heuristic to avoid false negatives.
562  ///
563  /// This is controlled by the 'avoid-suppressing-null-argument-paths' config
564  /// option, which accepts the values "true" and "false".
565  bool shouldAvoidSuppressingNullArgumentPaths();
566 
567  /// Returns whether or not diagnostics containing inlined defensive NULL
568  /// checks should be suppressed.
569  ///
570  /// This is controlled by the 'suppress-inlined-defensive-checks' config
571  /// option, which accepts the values "true" and "false".
572  bool shouldSuppressInlinedDefensiveChecks();
573 
574  /// Returns whether or not diagnostics reported within the C++ standard
575  /// library should be suppressed.
576  ///
577  /// This is controlled by the 'suppress-c++-stdlib' config option,
578  /// which accepts the values "true" and "false".
579  bool shouldSuppressFromCXXStandardLibrary();
580 
581  /// Returns whether bug reports should be crosschecked with the Z3
582  /// constraint manager backend.
583  ///
584  /// This is controlled by the 'crosscheck-with-z3' config option,
585  /// which accepts the values "true" and "false".
586  bool shouldCrosscheckWithZ3();
587 
588  /// Returns whether or not the diagnostic report should be always reported
589  /// in the main source file and not the headers.
590  ///
591  /// This is controlled by the 'report-in-main-source-file' config option,
592  /// which accepts the values "true" and "false".
593  bool shouldReportIssuesInMainSourceFile();
594 
595  /// Returns whether or not the report filename should be random or not.
596  ///
597  /// This is controlled by the 'stable-report-filename' config option,
598  /// which accepts the values "true" and "false". Default = false
599  bool shouldWriteStableReportFilename();
600 
601  /// \return Whether the analyzer should
602  /// serialize statistics to plist output.
603  /// Statistics would be serialized in JSON format inside the main dictionary
604  /// under the \c statistics key.
605  /// Available only if compiled in assert mode or with LLVM statistics
606  /// explicitly enabled.
607  bool shouldSerializeStats();
608 
609  /// Returns whether irrelevant parts of a bug report path should be pruned
610  /// out of the final output.
611  ///
612  /// This is controlled by the 'prune-paths' config option, which accepts the
613  /// values "true" and "false".
614  bool shouldPrunePaths();
615 
616  /// Returns true if 'static' initializers should be in conditional logic
617  /// in the CFG.
618  bool shouldConditionalizeStaticInitializers();
619 
620  // Returns the size of the functions (in basic blocks), which should be
621  // considered to be small enough to always inline.
622  //
623  // This is controlled by "ipa-always-inline-size" analyzer-config option.
624  unsigned getAlwaysInlineSize();
625 
626  // Returns the bound on the number of basic blocks in an inlined function
627  // (50 by default).
628  //
629  // This is controlled by "-analyzer-config max-inlinable-size" option.
630  unsigned getMaxInlinableSize();
631 
632  /// Returns true if the analyzer engine should synthesize fake bodies
633  /// for well-known functions.
634  bool shouldSynthesizeBodies();
635 
636  /// Returns how often nodes in the ExplodedGraph should be recycled to save
637  /// memory.
638  ///
639  /// This is controlled by the 'graph-trim-interval' config option. To disable
640  /// node reclamation, set the option to "0".
641  unsigned getGraphTrimInterval();
642 
643  /// Returns the maximum times a large function could be inlined.
644  ///
645  /// This is controlled by the 'max-times-inline-large' config option.
646  unsigned getMaxTimesInlineLarge();
647 
648  /// Returns the number of basic blocks a function needs to have to be
649  /// considered large for the 'max-times-inline-large' config option.
650  ///
651  /// This is controlled by the 'min-cfg-size-treat-functions-as-large' config
652  /// option.
653  unsigned getMinCFGSizeTreatFunctionsAsLarge();
654 
655  /// Returns the maximum number of nodes the analyzer can generate while
656  /// exploring a top level function (for each exploded graph).
657  /// 150000 is default; 0 means no limit.
658  ///
659  /// This is controlled by the 'max-nodes' config option.
660  unsigned getMaxNodesPerTopLevelFunction();
661 
662  /// Returns true if lambdas should be inlined. Otherwise a sink node will be
663  /// generated each time a LambdaExpr is visited.
664  bool shouldInlineLambdas();
665 
666  /// Returns true if the analysis should try to widen loops.
667  /// This is controlled by the 'widen-loops' config option.
668  bool shouldWidenLoops();
669 
670  /// Returns true if the analysis should try to unroll loops with known bounds.
671  /// This is controlled by the 'unroll-loops' config option.
672  bool shouldUnrollLoops();
673 
674  /// Returns true if the bug reporter should transparently treat extra note
675  /// diagnostic pieces as event diagnostic pieces. Useful when the diagnostic
676  /// consumer doesn't support the extra note pieces.
677  ///
678  /// This is controlled by the 'extra-notes-as-events' option, which defaults
679  /// to false when unset.
680  bool shouldDisplayNotesAsEvents();
681 
682  /// Returns true if SValBuilder should rearrange comparisons of symbolic
683  /// expressions which consist of a sum of a symbol and a concrete integer
684  /// into the format where symbols are on the left-hand side and the integer
685  /// is on the right. This is only done if both symbols and both concrete
686  /// integers are signed, greater than or equal to the quarter of the minimum
687  /// value of the type and less than or equal to the quarter of the maximum
688  /// value of that type.
689  ///
690  /// A + n <REL> B + m becomes A - B <REL> m - n, where A and B symbolic,
691  /// n and m are integers. <REL> is any of '==', '!=', '<', '<=', '>' or '>='.
692  /// The rearrangement also happens with '-' instead of '+' on either or both
693  /// side and also if any or both integers are missing.
694  bool shouldAggressivelySimplifyRelationalComparison();
695 
696  /// Returns the directory containing the CTU related files.
697  StringRef getCTUDir();
698 
699  /// Returns the name of the file containing the CTU index of functions.
700  StringRef getCTUIndexName();
701 
702  /// Returns true when naive cross translation unit analysis is enabled.
703  /// This is an experimental feature to inline functions from another
704  /// translation units.
705  bool naiveCTUEnabled();
706 };
707 
709 
710 } // namespace clang
711 
712 #endif // LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H
Inline C functions and blocks when their definitions are available.
IPAKind
Describes the different modes of inter-procedural analysis.
unsigned visualizeExplodedGraphWithGraphViz
Perform only intra-procedural analysis.
A dummy mode in which no C++ inlining is enabled.
Inline callees(C, C++, ObjC) when their definitions are available.
unsigned eagerlyAssumeBinOpBifurcation
The flag regulates if we should eagerly assume evaluations of conditionals, thus, bifurcating the pat...
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
std::string FullCompilerInvocation
Store full compiler invocation for reproducible instructions in the generated report.
std::vector< std::pair< std::string, bool > > CheckersControlList
Pair of checker name and enable/disable.
AnalysisStores
AnalysisStores - Set of available analysis store models.
Refers to regular member function and operator calls.
AnalysisInliningMode
AnalysisInlineFunctionSelection - Set of inlining function selection heuristics.
Refers to constructors (implicit or explicit).
Enable inlining of dynamically dispatched methods.
#define false
Definition: stdbool.h:33
AnalysisConstraints
AnalysisConstraints - Set of available constraint models.
llvm::StringMap< std::string > ConfigTable
ConfigTable Config
A key-value table of use-specified configuration values.
unsigned visualizeExplodedGraphWithUbiGraph
Refers to destructors (implicit or explicit).
unsigned maxBlockVisitOnPath
The maximum number of times the analyzer visits a block.
unsigned DisableAllChecks
Disable all analyzer checks.
Dataflow Directional Tag Classes.
std::string AnalyzeSpecificFunction
AnalysisPurgeMode
AnalysisPurgeModes - Set of available strategies for dead symbol removal.
unsigned NoRetryExhausted
Do not re-analyze paths leading to exhausted nodes with a different strategy.
Analyses
Analysis - Set of available source code analyses.
CXXInlineableMemberKind
Describes the different kinds of C++ member functions which can be considered for inlining by the ana...
Enable inlining of dynamically dispatched methods, bifurcate paths when exact type info is unavailabl...
AnalysisDiagClients
AnalysisDiagClients - Set of available diagnostic clients for rendering analysis results.