[PATCH] D53277: [analyzer][NFC][WIP] Collect all -analyzer-config options in a .def file
Szelethus updated this revision to Diff 169697. https://reviews.llvm.org/D53277 Files: include/clang/StaticAnalyzer/Core/AnalyzerOptions.def include/clang/StaticAnalyzer/Core/AnalyzerOptions.h lib/StaticAnalyzer/Core/AnalyzerOptions.cpp lib/StaticAnalyzer/Core/CoreEngine.cpp Index: lib/StaticAnalyzer/Core/CoreEngine.cpp === --- lib/StaticAnalyzer/Core/CoreEngine.cpp +++ lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -56,17 +56,17 @@ static std::unique_ptr generateWorkList(AnalyzerOptions , SubEngine ) { switch (Opts.getExplorationStrategy()) { -case AnalyzerOptions::ExplorationStrategyKind::DFS: +case ExplorationStrategyKind::DFS: return WorkList::makeDFS(); -case AnalyzerOptions::ExplorationStrategyKind::BFS: +case ExplorationStrategyKind::BFS: return WorkList::makeBFS(); -case AnalyzerOptions::ExplorationStrategyKind::BFSBlockDFSContents: +case ExplorationStrategyKind::BFSBlockDFSContents: return WorkList::makeBFSBlockDFSContents(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirst: +case ExplorationStrategyKind::UnexploredFirst: return WorkList::makeUnexploredFirst(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirstQueue: +case ExplorationStrategyKind::UnexploredFirstQueue: return WorkList::makeUnexploredFirstPriorityQueue(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirstLocationQueue: +case ExplorationStrategyKind::UnexploredFirstLocationQueue: return WorkList::makeUnexploredFirstPriorityLocationQueue(); } } Index: lib/StaticAnalyzer/Core/AnalyzerOptions.cpp === --- lib/StaticAnalyzer/Core/AnalyzerOptions.cpp +++ lib/StaticAnalyzer/Core/AnalyzerOptions.cpp @@ -49,7 +49,7 @@ return Result; } -AnalyzerOptions::UserModeKind AnalyzerOptions::getUserMode() { +UserModeKind AnalyzerOptions::getUserMode() { if (!UserMode.hasValue()) { StringRef ModeStr = getOptionAsString("mode", "deep"); UserMode = llvm::StringSwitch>(ModeStr) @@ -61,7 +61,7 @@ return UserMode.getValue(); } -AnalyzerOptions::ExplorationStrategyKind +ExplorationStrategyKind AnalyzerOptions::getExplorationStrategy() { if (!ExplorationStrategy.hasValue()) { StringRef StratStr = getOptionAsString("exploration_strategy", @@ -182,137 +182,6 @@ return V.getValue(); } -bool AnalyzerOptions::includeTemporaryDtorsInCFG() { - return getBooleanOption(IncludeTemporaryDtorsInCFG, - "cfg-temporary-dtors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeImplicitDtorsInCFG() { - return getBooleanOption(IncludeImplicitDtorsInCFG, - "cfg-implicit-dtors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeLifetimeInCFG() { - return getBooleanOption(IncludeLifetimeInCFG, "cfg-lifetime", - /* Default = */ false); -} - -bool AnalyzerOptions::includeLoopExitInCFG() { - return getBooleanOption(IncludeLoopExitInCFG, "cfg-loopexit", - /* Default = */ false); -} - -bool AnalyzerOptions::includeRichConstructorsInCFG() { - return getBooleanOption(IncludeRichConstructorsInCFG, - "cfg-rich-constructors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeScopesInCFG() { - return getBooleanOption(IncludeScopesInCFG, - "cfg-scopes", - /* Default = */ false); -} - -bool AnalyzerOptions::mayInlineCXXStandardLibrary() { - return getBooleanOption(InlineCXXStandardLibrary, - "c++-stdlib-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineTemplateFunctions() { - return getBooleanOption(InlineTemplateFunctions, - "c++-template-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineCXXAllocator() { - return getBooleanOption(InlineCXXAllocator, - "c++-allocator-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineCXXContainerMethods() { - return getBooleanOption(InlineCXXContainerMethods, - "c++-container-inlining", - /*Default=*/false); -} - -bool AnalyzerOptions::mayInlineCXXSharedPtrDtor() { - return getBooleanOption(InlineCXXSharedPtrDtor, - "c++-shared_ptr-inlining", - /*Default=*/false); -} - -bool AnalyzerOptions::mayInlineCXXTemporaryDtors() { - return getBooleanOption(InlineCXXTemporaryDtors, - "c++-temp-dtor-inlining", - /*Default=*/true); -} - -bool
[PATCH] D53277: [analyzer][NFC][WIP] Collect all -analyzer-config options in a .def file
Szelethus updated this revision to Diff 169696. https://reviews.llvm.org/D53277 Files: include/clang/StaticAnalyzer/Core/AnalyzerOptions.def include/clang/StaticAnalyzer/Core/AnalyzerOptions.h lib/StaticAnalyzer/Core/AnalyzerOptions.cpp lib/StaticAnalyzer/Core/CoreEngine.cpp Index: lib/StaticAnalyzer/Core/CoreEngine.cpp === --- lib/StaticAnalyzer/Core/CoreEngine.cpp +++ lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -56,17 +56,17 @@ static std::unique_ptr generateWorkList(AnalyzerOptions , SubEngine ) { switch (Opts.getExplorationStrategy()) { -case AnalyzerOptions::ExplorationStrategyKind::DFS: +case ExplorationStrategyKind::DFS: return WorkList::makeDFS(); -case AnalyzerOptions::ExplorationStrategyKind::BFS: +case ExplorationStrategyKind::BFS: return WorkList::makeBFS(); -case AnalyzerOptions::ExplorationStrategyKind::BFSBlockDFSContents: +case ExplorationStrategyKind::BFSBlockDFSContents: return WorkList::makeBFSBlockDFSContents(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirst: +case ExplorationStrategyKind::UnexploredFirst: return WorkList::makeUnexploredFirst(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirstQueue: +case ExplorationStrategyKind::UnexploredFirstQueue: return WorkList::makeUnexploredFirstPriorityQueue(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirstLocationQueue: +case ExplorationStrategyKind::UnexploredFirstLocationQueue: return WorkList::makeUnexploredFirstPriorityLocationQueue(); } } Index: lib/StaticAnalyzer/Core/AnalyzerOptions.cpp === --- lib/StaticAnalyzer/Core/AnalyzerOptions.cpp +++ lib/StaticAnalyzer/Core/AnalyzerOptions.cpp @@ -49,7 +49,7 @@ return Result; } -AnalyzerOptions::UserModeKind AnalyzerOptions::getUserMode() { +UserModeKind AnalyzerOptions::getUserMode() { if (!UserMode.hasValue()) { StringRef ModeStr = getOptionAsString("mode", "deep"); UserMode = llvm::StringSwitch>(ModeStr) @@ -61,7 +61,7 @@ return UserMode.getValue(); } -AnalyzerOptions::ExplorationStrategyKind +ExplorationStrategyKind AnalyzerOptions::getExplorationStrategy() { if (!ExplorationStrategy.hasValue()) { StringRef StratStr = getOptionAsString("exploration_strategy", @@ -182,137 +182,6 @@ return V.getValue(); } -bool AnalyzerOptions::includeTemporaryDtorsInCFG() { - return getBooleanOption(IncludeTemporaryDtorsInCFG, - "cfg-temporary-dtors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeImplicitDtorsInCFG() { - return getBooleanOption(IncludeImplicitDtorsInCFG, - "cfg-implicit-dtors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeLifetimeInCFG() { - return getBooleanOption(IncludeLifetimeInCFG, "cfg-lifetime", - /* Default = */ false); -} - -bool AnalyzerOptions::includeLoopExitInCFG() { - return getBooleanOption(IncludeLoopExitInCFG, "cfg-loopexit", - /* Default = */ false); -} - -bool AnalyzerOptions::includeRichConstructorsInCFG() { - return getBooleanOption(IncludeRichConstructorsInCFG, - "cfg-rich-constructors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeScopesInCFG() { - return getBooleanOption(IncludeScopesInCFG, - "cfg-scopes", - /* Default = */ false); -} - -bool AnalyzerOptions::mayInlineCXXStandardLibrary() { - return getBooleanOption(InlineCXXStandardLibrary, - "c++-stdlib-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineTemplateFunctions() { - return getBooleanOption(InlineTemplateFunctions, - "c++-template-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineCXXAllocator() { - return getBooleanOption(InlineCXXAllocator, - "c++-allocator-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineCXXContainerMethods() { - return getBooleanOption(InlineCXXContainerMethods, - "c++-container-inlining", - /*Default=*/false); -} - -bool AnalyzerOptions::mayInlineCXXSharedPtrDtor() { - return getBooleanOption(InlineCXXSharedPtrDtor, - "c++-shared_ptr-inlining", - /*Default=*/false); -} - -bool AnalyzerOptions::mayInlineCXXTemporaryDtors() { - return getBooleanOption(InlineCXXTemporaryDtors, - "c++-temp-dtor-inlining", - /*Default=*/true); -} - -bool
[PATCH] D53277: [analyzer][NFC][WIP] Collect all -analyzer-config options in a .def file
Szelethus added inline comments. Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:128-135 +/// Describes the kinds for high-level analyzer mode. +enum UserModeKind { + /// Perform shallow but fast analyzes. + UMK_Shallow = 1, + + /// Perform deep analyzes. + UMK_Deep = 2 Do we actually //ever// use `UMK_SHALLOW`? If not, the whole .def file can be simplified, because the use of `getDefaultValForUserMode(/* ShallowVal */, /* DeepVal */)` is clunky. If we do, I'd also be fine with rewriting the function generating macro from ``` #define ANALYZER_OPTION_WITH_FN(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL, \ CREATE_FN) ``` to ``` #define ANALYZER_OPTION_WITH_FN(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL, \ DEEP_VAL, CREATE_FN) ``` because that'd be nicer than the current solution. https://reviews.llvm.org/D53277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53277: [analyzer][NFC][WIP] Collect all -analyzer-config options in a .def file
Szelethus updated this revision to Diff 169688. https://reviews.llvm.org/D53277 Files: include/clang/StaticAnalyzer/Core/AnalyzerOptions.def include/clang/StaticAnalyzer/Core/AnalyzerOptions.h lib/StaticAnalyzer/Core/AnalyzerOptions.cpp lib/StaticAnalyzer/Core/CoreEngine.cpp Index: lib/StaticAnalyzer/Core/CoreEngine.cpp === --- lib/StaticAnalyzer/Core/CoreEngine.cpp +++ lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -56,17 +56,17 @@ static std::unique_ptr generateWorkList(AnalyzerOptions , SubEngine ) { switch (Opts.getExplorationStrategy()) { -case AnalyzerOptions::ExplorationStrategyKind::DFS: +case ExplorationStrategyKind::DFS: return WorkList::makeDFS(); -case AnalyzerOptions::ExplorationStrategyKind::BFS: +case ExplorationStrategyKind::BFS: return WorkList::makeBFS(); -case AnalyzerOptions::ExplorationStrategyKind::BFSBlockDFSContents: +case ExplorationStrategyKind::BFSBlockDFSContents: return WorkList::makeBFSBlockDFSContents(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirst: +case ExplorationStrategyKind::UnexploredFirst: return WorkList::makeUnexploredFirst(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirstQueue: +case ExplorationStrategyKind::UnexploredFirstQueue: return WorkList::makeUnexploredFirstPriorityQueue(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirstLocationQueue: +case ExplorationStrategyKind::UnexploredFirstLocationQueue: return WorkList::makeUnexploredFirstPriorityLocationQueue(); } } Index: lib/StaticAnalyzer/Core/AnalyzerOptions.cpp === --- lib/StaticAnalyzer/Core/AnalyzerOptions.cpp +++ lib/StaticAnalyzer/Core/AnalyzerOptions.cpp @@ -49,7 +49,7 @@ return Result; } -AnalyzerOptions::UserModeKind AnalyzerOptions::getUserMode() { +UserModeKind AnalyzerOptions::getUserMode() { if (!UserMode.hasValue()) { StringRef ModeStr = getOptionAsString("mode", "deep"); UserMode = llvm::StringSwitch>(ModeStr) @@ -61,7 +61,7 @@ return UserMode.getValue(); } -AnalyzerOptions::ExplorationStrategyKind +ExplorationStrategyKind AnalyzerOptions::getExplorationStrategy() { if (!ExplorationStrategy.hasValue()) { StringRef StratStr = getOptionAsString("exploration_strategy", @@ -182,137 +182,6 @@ return V.getValue(); } -bool AnalyzerOptions::includeTemporaryDtorsInCFG() { - return getBooleanOption(IncludeTemporaryDtorsInCFG, - "cfg-temporary-dtors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeImplicitDtorsInCFG() { - return getBooleanOption(IncludeImplicitDtorsInCFG, - "cfg-implicit-dtors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeLifetimeInCFG() { - return getBooleanOption(IncludeLifetimeInCFG, "cfg-lifetime", - /* Default = */ false); -} - -bool AnalyzerOptions::includeLoopExitInCFG() { - return getBooleanOption(IncludeLoopExitInCFG, "cfg-loopexit", - /* Default = */ false); -} - -bool AnalyzerOptions::includeRichConstructorsInCFG() { - return getBooleanOption(IncludeRichConstructorsInCFG, - "cfg-rich-constructors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeScopesInCFG() { - return getBooleanOption(IncludeScopesInCFG, - "cfg-scopes", - /* Default = */ false); -} - -bool AnalyzerOptions::mayInlineCXXStandardLibrary() { - return getBooleanOption(InlineCXXStandardLibrary, - "c++-stdlib-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineTemplateFunctions() { - return getBooleanOption(InlineTemplateFunctions, - "c++-template-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineCXXAllocator() { - return getBooleanOption(InlineCXXAllocator, - "c++-allocator-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineCXXContainerMethods() { - return getBooleanOption(InlineCXXContainerMethods, - "c++-container-inlining", - /*Default=*/false); -} - -bool AnalyzerOptions::mayInlineCXXSharedPtrDtor() { - return getBooleanOption(InlineCXXSharedPtrDtor, - "c++-shared_ptr-inlining", - /*Default=*/false); -} - -bool AnalyzerOptions::mayInlineCXXTemporaryDtors() { - return getBooleanOption(InlineCXXTemporaryDtors, - "c++-temp-dtor-inlining", - /*Default=*/true); -} - -bool
[PATCH] D53277: [analyzer][NFC][WIP] Collect all -analyzer-config options in a .def file
Szelethus added a comment. Also, this patch does not contain checker options. That I would suspect be a little more invasive, so I'll do that in a followup patch. Repository: rC Clang https://reviews.llvm.org/D53277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53277: [analyzer][NFC][WIP] Collect all -analyzer-config options in a .def file
Szelethus created this revision. Szelethus added reviewers: NoQ, george.karpenkov, xazax.hun, rnkovacs, MTC. Herald added subscribers: cfe-commits, donat.nagy, mikhail.ramalho, a.sidorin, szepet, whisperity. I'm in the process of refactoring AnalyzerOptions. The main motivation behind here is to emit warnings if an invalid -analyzer-config option is given from the command line, and be able to list them all. In this patch, I'm moving **//all//** analyzer options to a def file, and move 2 enums to global namespace. This patch is WIP, because I didn't add descriptions just yet. Repository: rC Clang https://reviews.llvm.org/D53277 Files: include/clang/StaticAnalyzer/Core/AnalyzerOptions.def include/clang/StaticAnalyzer/Core/AnalyzerOptions.h lib/StaticAnalyzer/Core/AnalyzerOptions.cpp lib/StaticAnalyzer/Core/CoreEngine.cpp Index: lib/StaticAnalyzer/Core/CoreEngine.cpp === --- lib/StaticAnalyzer/Core/CoreEngine.cpp +++ lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -56,17 +56,17 @@ static std::unique_ptr generateWorkList(AnalyzerOptions , SubEngine ) { switch (Opts.getExplorationStrategy()) { -case AnalyzerOptions::ExplorationStrategyKind::DFS: +case ExplorationStrategyKind::DFS: return WorkList::makeDFS(); -case AnalyzerOptions::ExplorationStrategyKind::BFS: +case ExplorationStrategyKind::BFS: return WorkList::makeBFS(); -case AnalyzerOptions::ExplorationStrategyKind::BFSBlockDFSContents: +case ExplorationStrategyKind::BFSBlockDFSContents: return WorkList::makeBFSBlockDFSContents(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirst: +case ExplorationStrategyKind::UnexploredFirst: return WorkList::makeUnexploredFirst(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirstQueue: +case ExplorationStrategyKind::UnexploredFirstQueue: return WorkList::makeUnexploredFirstPriorityQueue(); -case AnalyzerOptions::ExplorationStrategyKind::UnexploredFirstLocationQueue: +case ExplorationStrategyKind::UnexploredFirstLocationQueue: return WorkList::makeUnexploredFirstPriorityLocationQueue(); } } Index: lib/StaticAnalyzer/Core/AnalyzerOptions.cpp === --- lib/StaticAnalyzer/Core/AnalyzerOptions.cpp +++ lib/StaticAnalyzer/Core/AnalyzerOptions.cpp @@ -49,7 +49,7 @@ return Result; } -AnalyzerOptions::UserModeKind AnalyzerOptions::getUserMode() { +UserModeKind AnalyzerOptions::getUserMode() { if (!UserMode.hasValue()) { StringRef ModeStr = getOptionAsString("mode", "deep"); UserMode = llvm::StringSwitch>(ModeStr) @@ -61,7 +61,7 @@ return UserMode.getValue(); } -AnalyzerOptions::ExplorationStrategyKind +ExplorationStrategyKind AnalyzerOptions::getExplorationStrategy() { if (!ExplorationStrategy.hasValue()) { StringRef StratStr = getOptionAsString("exploration_strategy", @@ -182,137 +182,6 @@ return V.getValue(); } -bool AnalyzerOptions::includeTemporaryDtorsInCFG() { - return getBooleanOption(IncludeTemporaryDtorsInCFG, - "cfg-temporary-dtors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeImplicitDtorsInCFG() { - return getBooleanOption(IncludeImplicitDtorsInCFG, - "cfg-implicit-dtors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeLifetimeInCFG() { - return getBooleanOption(IncludeLifetimeInCFG, "cfg-lifetime", - /* Default = */ false); -} - -bool AnalyzerOptions::includeLoopExitInCFG() { - return getBooleanOption(IncludeLoopExitInCFG, "cfg-loopexit", - /* Default = */ false); -} - -bool AnalyzerOptions::includeRichConstructorsInCFG() { - return getBooleanOption(IncludeRichConstructorsInCFG, - "cfg-rich-constructors", - /* Default = */ true); -} - -bool AnalyzerOptions::includeScopesInCFG() { - return getBooleanOption(IncludeScopesInCFG, - "cfg-scopes", - /* Default = */ false); -} - -bool AnalyzerOptions::mayInlineCXXStandardLibrary() { - return getBooleanOption(InlineCXXStandardLibrary, - "c++-stdlib-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineTemplateFunctions() { - return getBooleanOption(InlineTemplateFunctions, - "c++-template-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineCXXAllocator() { - return getBooleanOption(InlineCXXAllocator, - "c++-allocator-inlining", - /*Default=*/true); -} - -bool AnalyzerOptions::mayInlineCXXContainerMethods() { - return getBooleanOption(InlineCXXContainerMethods,