[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file

2018-11-02 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus closed this revision.
Szelethus added a comment.

Interesting, I didn't get a mail about this :/ In any case, let's hope no more 
problems arise.


Repository:
  rL LLVM

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] Collect all -analyzer-config options in a .def file

2018-11-02 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

In https://reviews.llvm.org/D53277#1285777, @george.karpenkov wrote:

> @NoQ @Szelethus Actually pushed a fix.


Just saw this -- Thank you! :D


Repository:
  rL LLVM

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] Collect all -analyzer-config options in a .def file

2018-11-02 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added a comment.

@NoQ @Szelethus Actually pushed a fix.


Repository:
  rL LLVM

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] Collect all -analyzer-config options in a .def file

2018-11-02 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added a comment.

@Szelethus @NoQ OK it seems you need to annotate those headers in modulemap.

E.g. take a look at:

  george1@/Volumes/Transcend/code/monorepo/llvm-project/clang (master)≻ rg 
SVals.def
  include/clang/module.modulemap
  131:  textual header "StaticAnalyzer/Core/PathSensitive/SVals.def"
  
  include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
  58:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
  68:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
  82:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
  
  include/clang/StaticAnalyzer/Core/PathSensitive/SValVisitor.h
  39:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
  44:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
  51:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
  66:#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
  
  include/clang/StaticAnalyzer/Core/PathSensitive/SVals.def
  1://===-- SVals.def - Metadata about SVal kinds ---*- C++ 
-*-===//


Repository:
  rL LLVM

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] Collect all -analyzer-config options in a .def file

2018-11-02 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added a comment.

@Szelethus you can see the command required to get modules build in the 
mentioned log. I think -DLLVM_ENABLE_MODULES=On might be enough.


Repository:
  rL LLVM

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] Collect all -analyzer-config options in a .def file

2018-11-02 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Ugh, this breaks builds with //modules//, eg. 
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/12074/console

I'm bad with modules, but you might consult my own failure of this kind: 
https://reviews.llvm.org/D15448#325856 - especially the 
`include/clang/module.modulemap` part.

There must be a cmake flag for this. I guess please try to revert and reproduce 
the build failure locally and ask me if you need any help with that :)


Repository:
  rL LLVM

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] Collect all -analyzer-config options in a .def file

2018-11-02 Thread Umann Kristóf via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL345986: [analyzer][NFC] Collect all -analyzer-config options 
in a .def file (authored by Szelethus, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53277?vs=170417=172375#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53277

Files:
  cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
  cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp

Index: cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ cfe/trunk/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();
   }
   llvm_unreachable("Unknown AnalyzerOptions::ExplorationStrategyKind");
Index: cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
@@ -49,91 +49,87 @@
   return Result;
 }
 
-AnalyzerOptions::UserModeKind AnalyzerOptions::getUserMode() {
+UserModeKind AnalyzerOptions::getUserMode() {
   if (!UserMode.hasValue()) {
-StringRef ModeStr = getOptionAsString("mode", "deep");
-UserMode = llvm::StringSwitch>(ModeStr)
-  .Case("shallow", UMK_Shallow)
-  .Case("deep", UMK_Deep)
-  .Default(None);
-assert(UserMode.getValue() && "User mode is invalid.");
+UserMode = getOptionAsString("mode", "deep");
   }
-  return UserMode.getValue();
+
+  auto K = llvm::StringSwitch>(*UserMode)
+.Case("shallow", UMK_Shallow)
+.Case("deep", UMK_Deep)
+.Default(None);
+  assert(UserMode.hasValue() && "User mode is invalid.");
+  return K.getValue();
 }
 
-AnalyzerOptions::ExplorationStrategyKind
+ExplorationStrategyKind
 AnalyzerOptions::getExplorationStrategy() {
   if (!ExplorationStrategy.hasValue()) {
-StringRef StratStr = getOptionAsString("exploration_strategy",
-   "unexplored_first_queue");
-ExplorationStrategy =
-llvm::StringSwitch>(StratStr)
-.Case("dfs", ExplorationStrategyKind::DFS)
-.Case("bfs", ExplorationStrategyKind::BFS)
-.Case("unexplored_first",
-  ExplorationStrategyKind::UnexploredFirst)
-.Case("unexplored_first_queue",
-  ExplorationStrategyKind::UnexploredFirstQueue)
-.Case("unexplored_first_location_queue",
-  ExplorationStrategyKind::UnexploredFirstLocationQueue)
-.Case("bfs_block_dfs_contents",
-  ExplorationStrategyKind::BFSBlockDFSContents)
-.Default(None);
-assert(ExplorationStrategy.hasValue() &&
-   "User mode is invalid.");
+ExplorationStrategy = getOptionAsString("exploration_strategy",
+"unexplored_first_queue");
   }
-  return ExplorationStrategy.getValue();
+  auto K =
+llvm::StringSwitch>(
+   *ExplorationStrategy)
+  .Case("dfs", ExplorationStrategyKind::DFS)
+  .Case("bfs", ExplorationStrategyKind::BFS)
+  .Case("unexplored_first",
+ExplorationStrategyKind::UnexploredFirst)
+  .Case("unexplored_first_queue",
+ExplorationStrategyKind::UnexploredFirstQueue)
+  .Case("unexplored_first_location_queue",
+ExplorationStrategyKind::UnexploredFirstLocationQueue)
+  .Case("bfs_block_dfs_contents",
+

[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file

2018-11-01 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.

In https://reviews.llvm.org/D53277#1270141, @Szelethus wrote:

> In https://reviews.llvm.org/D53277#1269960, @NoQ wrote:
>
> > I think this is awesome o_o
>
>
> I'm glad you like it ^-^


I mean, do i have a choice? Like, seriously, it's... beautiful...


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] Collect all -analyzer-config options in a .def file

2018-10-22 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus updated this revision to Diff 170417.
Szelethus added a comment.

- Removed redundant information (like the type or default value of the command 
line argument), these are now auto-generated in followup patches
- Added description for `"model-path"`.


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,91 +49,87 @@
   return Result;
 }
 
-AnalyzerOptions::UserModeKind AnalyzerOptions::getUserMode() {
+UserModeKind AnalyzerOptions::getUserMode() {
   if (!UserMode.hasValue()) {
-StringRef ModeStr = getOptionAsString("mode", "deep");
-UserMode = llvm::StringSwitch>(ModeStr)
-  .Case("shallow", UMK_Shallow)
-  .Case("deep", UMK_Deep)
-  .Default(None);
-assert(UserMode.getValue() && "User mode is invalid.");
+UserMode = getOptionAsString("mode", "deep");
   }
-  return UserMode.getValue();
+
+  auto K = llvm::StringSwitch>(*UserMode)
+.Case("shallow", UMK_Shallow)
+.Case("deep", UMK_Deep)
+.Default(None);
+  assert(UserMode.hasValue() && "User mode is invalid.");
+  return K.getValue();
 }
 
-AnalyzerOptions::ExplorationStrategyKind
+ExplorationStrategyKind
 AnalyzerOptions::getExplorationStrategy() {
   if (!ExplorationStrategy.hasValue()) {
-StringRef StratStr = getOptionAsString("exploration_strategy",
-   "unexplored_first_queue");
-ExplorationStrategy =
-llvm::StringSwitch>(StratStr)
-.Case("dfs", ExplorationStrategyKind::DFS)
-.Case("bfs", ExplorationStrategyKind::BFS)
-.Case("unexplored_first",
-  ExplorationStrategyKind::UnexploredFirst)
-.Case("unexplored_first_queue",
-  ExplorationStrategyKind::UnexploredFirstQueue)
-.Case("unexplored_first_location_queue",
-  ExplorationStrategyKind::UnexploredFirstLocationQueue)
-.Case("bfs_block_dfs_contents",
-  ExplorationStrategyKind::BFSBlockDFSContents)
-.Default(None);
-assert(ExplorationStrategy.hasValue() &&
-   "User mode is invalid.");
+ExplorationStrategy = getOptionAsString("exploration_strategy",
+"unexplored_first_queue");
   }
-  return ExplorationStrategy.getValue();
+  auto K =
+llvm::StringSwitch>(
+   *ExplorationStrategy)
+  .Case("dfs", ExplorationStrategyKind::DFS)
+  .Case("bfs", ExplorationStrategyKind::BFS)
+  .Case("unexplored_first",
+ExplorationStrategyKind::UnexploredFirst)
+  .Case("unexplored_first_queue",
+ExplorationStrategyKind::UnexploredFirstQueue)
+  .Case("unexplored_first_location_queue",
+ExplorationStrategyKind::UnexploredFirstLocationQueue)
+  .Case("bfs_block_dfs_contents",
+ExplorationStrategyKind::BFSBlockDFSContents)
+  .Default(None);
+  assert(K.hasValue() && "User mode is invalid.");
+  return K.getValue();
 }
 
 IPAKind AnalyzerOptions::getIPAMode() {
   if (!IPAMode.hasValue()) {
-// Use the User Mode to set the default IPA value.
-

[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file

2018-10-22 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added inline comments.



Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.def:445
+
+ANALYZER_OPTION_GEN_FN(StringRef, ModelPath, "model-path", "", "", 
getModelPath)
+

Should we explain the feature in the commad line path? 

The description might be somethinge like:
`(string) The analyzer can inline an alternative implementation written in C at 
the call site if the called function's body is not available. This is a path 
where to look for those alternative implementations (called models).`


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] Collect all -analyzer-config options in a .def file

2018-10-21 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus updated this revision to Diff 170343.
Szelethus added a comment.

Added default value to `ANALYZER_OPTION` and split it upto

- `ANALYZER_OPTION` and
- `ANALYZER_OPTION_DEPENDS_ON_USER_MODE`.

The `TYPE` entry only holds `bool`, `unsigned` and `StringRef now. These things 
will make followup patches significantly more pleasant to implement.


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,91 +49,87 @@
   return Result;
 }
 
-AnalyzerOptions::UserModeKind AnalyzerOptions::getUserMode() {
+UserModeKind AnalyzerOptions::getUserMode() {
   if (!UserMode.hasValue()) {
-StringRef ModeStr = getOptionAsString("mode", "deep");
-UserMode = llvm::StringSwitch>(ModeStr)
-  .Case("shallow", UMK_Shallow)
-  .Case("deep", UMK_Deep)
-  .Default(None);
-assert(UserMode.getValue() && "User mode is invalid.");
+UserMode = getOptionAsString("mode", "deep");
   }
-  return UserMode.getValue();
+
+  auto K = llvm::StringSwitch>(*UserMode)
+.Case("shallow", UMK_Shallow)
+.Case("deep", UMK_Deep)
+.Default(None);
+  assert(UserMode.hasValue() && "User mode is invalid.");
+  return K.getValue();
 }
 
-AnalyzerOptions::ExplorationStrategyKind
+ExplorationStrategyKind
 AnalyzerOptions::getExplorationStrategy() {
   if (!ExplorationStrategy.hasValue()) {
-StringRef StratStr = getOptionAsString("exploration_strategy",
-   "unexplored_first_queue");
-ExplorationStrategy =
-llvm::StringSwitch>(StratStr)
-.Case("dfs", ExplorationStrategyKind::DFS)
-.Case("bfs", ExplorationStrategyKind::BFS)
-.Case("unexplored_first",
-  ExplorationStrategyKind::UnexploredFirst)
-.Case("unexplored_first_queue",
-  ExplorationStrategyKind::UnexploredFirstQueue)
-.Case("unexplored_first_location_queue",
-  ExplorationStrategyKind::UnexploredFirstLocationQueue)
-.Case("bfs_block_dfs_contents",
-  ExplorationStrategyKind::BFSBlockDFSContents)
-.Default(None);
-assert(ExplorationStrategy.hasValue() &&
-   "User mode is invalid.");
+ExplorationStrategy = getOptionAsString("exploration_strategy",
+"unexplored_first_queue");
   }
-  return ExplorationStrategy.getValue();
+  auto K =
+llvm::StringSwitch>(
+   *ExplorationStrategy)
+  .Case("dfs", ExplorationStrategyKind::DFS)
+  .Case("bfs", ExplorationStrategyKind::BFS)
+  .Case("unexplored_first",
+ExplorationStrategyKind::UnexploredFirst)
+  .Case("unexplored_first_queue",
+ExplorationStrategyKind::UnexploredFirstQueue)
+  .Case("unexplored_first_location_queue",
+ExplorationStrategyKind::UnexploredFirstLocationQueue)
+  .Case("bfs_block_dfs_contents",
+ExplorationStrategyKind::BFSBlockDFSContents)
+  .Default(None);
+  assert(K.hasValue() && "User mode is invalid.");
+  return K.getValue();
 }
 
 IPAKind AnalyzerOptions::getIPAMode() 

[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file

2018-10-21 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added inline comments.



Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.def:386
+
+ANALYZER_OPTION_WITH_FN(StringRef, ModelPath, "model-path", "", "",
+getModelPath)

Szelethus wrote:
> Found the use for this here: 
> https://github.com/llvm-mirror/clang/blob/master/lib/StaticAnalyzer/Frontend/ModelInjector.cpp#L51
> 
> Which was added by this commit:
> https://github.com/llvm-mirror/clang/commit/fdf0d3513240fd8e4da6942e9cd26d2d730eb37b#diff-6e67e63f578935f02bd1d5b20488ea8c
> >This patch was contributed by Gábor Horváth as part of his Google Summer of 
> >Code project.
> 
> @xazax.hun, what would be a good description for this flag?
This inline was meant for:
`ANALYZER_OPTION_GEN_FN(StringRef, ModelPath, "model-path", "", "", 
getModelPath)`


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] Collect all -analyzer-config options in a .def file

2018-10-21 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus updated this revision to Diff 170333.
Szelethus added a comment.

Split `ANALYZER_OPTION_WITH_FN` up to

- `ANALYZER_OPTION_GEN_FN`
- `ANALYZER_OPTION_GEN_FN_DEPENDS_ON_USER_MODE`

and added some `#error` directives to make it harder to misuse the .def file.


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",
@@ -183,137 +183,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 

[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file

2018-10-20 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

In https://reviews.llvm.org/D53277#1269960, @NoQ wrote:

> I think this is awesome o_o







Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.def:386
+
+ANALYZER_OPTION_WITH_FN(StringRef, ModelPath, "model-path", "", "",
+getModelPath)

Found the use for this here: 
https://github.com/llvm-mirror/clang/blob/master/lib/StaticAnalyzer/Frontend/ModelInjector.cpp#L51

Which was added by this commit:
https://github.com/llvm-mirror/clang/commit/fdf0d3513240fd8e4da6942e9cd26d2d730eb37b#diff-6e67e63f578935f02bd1d5b20488ea8c
>This patch was contributed by Gábor Horváth as part of his Google Summer of 
>Code project.

@xazax.hun, what would be a good description for this flag?


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] Collect all -analyzer-config options in a .def file

2018-10-20 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus updated this revision to Diff 170318.
Szelethus added a comment.

Removed doxygen comments, rebased to `D53276`.

Please don't mind me saying this, but damn that's one pretty .def file compared 
to the mess that `AnalyzerOptions` currently is :).


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",
@@ -183,137 +183,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 

[PATCH] D53277: [analyzer][NFC] Collect all -analyzer-config options in a .def file

2018-10-19 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

I think this is awesome o_o




Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.def:70-71
+
+/// Controls the high-level analyzer mode, which influences the default
+/// settings for some of the lower-level config options (such as IPAMode).
+ANALYZER_OPTION(

I think it's unnecessary to duplicate the --help text in 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

Xcode uses shallow mode when you tick the checkbox to run static analyzer 
during normal build, so that not to slow down builds too much.

> rewriting the function generating macro

This seems indeed fancier because it makes everything constexpr, which opens up 
more possibilities. But i don't see any actual possibilities that it opens up. 
I guess we can always change it when it becomes necessary. Also it's probably 
better to make a separate macro for options that have different default values 
in shallow and deep modes, so that not to duplicate every default value twice.


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] Collect all -analyzer-config options in a .def file

2018-10-15 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus updated this revision to Diff 169731.
Szelethus retitled this revision from "[analyzer][NFC][WIP] Collect all 
-analyzer-config options in a .def file" to "[analyzer][NFC] Collect all 
-analyzer-config options in a .def file".
Szelethus edited the summary of this revision.
Szelethus added a comment.

Added descriptions.


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",
-