svf-lib 1.0.2319 → 1.0.2321

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/WorkList.h +0 -0
  2. package/SVF-linux-aarch64/Release-build/lib/cmake/SVF/Modules/FindZ3.cmake +93 -0
  3. package/SVF-linux-aarch64/Release-build/lib/cmake/SVF/SVFConfig.cmake +106 -0
  4. package/SVF-linux-aarch64/Release-build/lib/cmake/SVF/SVFConfigVersion.cmake +43 -0
  5. package/SVF-linux-aarch64/Release-build/lib/cmake/SVF/SVFTargets-release.cmake +101 -0
  6. package/SVF-linux-aarch64/Release-build/lib/cmake/SVF/SVFTargets.cmake +180 -0
  7. package/SVF-linux-aarch64/Release-build/lib/libSvfCore.so.3.1 +0 -0
  8. package/SVF-linux-aarch64/Release-build/lib/libSvfLLVM.so.3.1 +0 -0
  9. package/SVF-linux-aarch64/Release-build/lib/pkgconfig/SVF.pc +12 -0
  10. package/SVF-osx/Release-build/bin/ae +0 -0
  11. package/SVF-osx/Release-build/bin/cfl +0 -0
  12. package/SVF-osx/Release-build/bin/dvf +0 -0
  13. package/SVF-osx/Release-build/bin/llvm2svf +0 -0
  14. package/SVF-osx/Release-build/bin/mta +0 -0
  15. package/SVF-osx/Release-build/bin/saber +0 -0
  16. package/SVF-osx/Release-build/bin/svf-ex +0 -0
  17. package/SVF-osx/Release-build/bin/wpa +0 -0
  18. package/SVF-osx/Release-build/include/SVF/AE/Core/AbstractState.h +425 -0
  19. package/SVF-osx/Release-build/include/SVF/AE/Core/AbstractValue.h +157 -0
  20. package/SVF-osx/Release-build/include/SVF/AE/Core/AddressValue.h +225 -0
  21. package/SVF-osx/Release-build/include/SVF/AE/Core/ICFGWTO.h +135 -0
  22. package/SVF-osx/Release-build/include/SVF/AE/Core/IntervalValue.h +1055 -0
  23. package/SVF-osx/Release-build/include/SVF/AE/Core/NumericValue.h +1292 -0
  24. package/SVF-osx/Release-build/include/SVF/AE/Core/RelExeState.h +226 -0
  25. package/SVF-osx/Release-build/include/SVF/AE/Core/RelationSolver.h +91 -0
  26. package/SVF-osx/Release-build/include/SVF/AE/Svfexe/AEDetector.h +439 -0
  27. package/SVF-osx/Release-build/include/SVF/AE/Svfexe/AbsExtAPI.h +138 -0
  28. package/SVF-osx/Release-build/include/SVF/AE/Svfexe/AbstractInterpretation.h +384 -0
  29. package/SVF-osx/Release-build/include/SVF/CFL/CFGNormalizer.h +84 -0
  30. package/SVF-osx/Release-build/include/SVF/CFL/CFGrammar.h +468 -0
  31. package/SVF-osx/Release-build/include/SVF/CFL/CFLAlias.h +168 -0
  32. package/SVF-osx/Release-build/include/SVF/CFL/CFLBase.h +118 -0
  33. package/SVF-osx/Release-build/include/SVF/CFL/CFLGramGraphChecker.h +74 -0
  34. package/SVF-osx/Release-build/include/SVF/CFL/CFLGraphBuilder.h +168 -0
  35. package/SVF-osx/Release-build/include/SVF/CFL/CFLSVFGBuilder.h +58 -0
  36. package/SVF-osx/Release-build/include/SVF/CFL/CFLSolver.h +374 -0
  37. package/SVF-osx/Release-build/include/SVF/CFL/CFLStat.h +67 -0
  38. package/SVF-osx/Release-build/include/SVF/CFL/CFLVF.h +68 -0
  39. package/SVF-osx/Release-build/include/SVF/CFL/GrammarBuilder.h +100 -0
  40. package/SVF-osx/Release-build/include/SVF/DDA/ContextDDA.h +230 -0
  41. package/SVF-osx/Release-build/include/SVF/DDA/DDAClient.h +163 -0
  42. package/SVF-osx/Release-build/include/SVF/DDA/DDAPass.h +102 -0
  43. package/SVF-osx/Release-build/include/SVF/DDA/DDAStat.h +121 -0
  44. package/SVF-osx/Release-build/include/SVF/DDA/DDAVFSolver.h +794 -0
  45. package/SVF-osx/Release-build/include/SVF/DDA/FlowDDA.h +178 -0
  46. package/SVF-osx/Release-build/include/SVF/FastCluster/fastcluster.h +80 -0
  47. package/SVF-osx/Release-build/include/SVF/Graphs/BasicBlockG.h +318 -0
  48. package/SVF-osx/Release-build/include/SVF/Graphs/CDG.h +482 -0
  49. package/SVF-osx/Release-build/include/SVF/Graphs/CFLGraph.h +232 -0
  50. package/SVF-osx/Release-build/include/SVF/Graphs/CHG.h +368 -0
  51. package/SVF-osx/Release-build/include/SVF/Graphs/CallGraph.h +497 -0
  52. package/SVF-osx/Release-build/include/SVF/Graphs/ConsG.h +402 -0
  53. package/SVF-osx/Release-build/include/SVF/Graphs/ConsGEdge.h +355 -0
  54. package/SVF-osx/Release-build/include/SVF/Graphs/ConsGNode.h +418 -0
  55. package/SVF-osx/Release-build/include/SVF/Graphs/DOTGraphTraits.h +188 -0
  56. package/SVF-osx/Release-build/include/SVF/Graphs/GenericGraph.h +628 -0
  57. package/SVF-osx/Release-build/include/SVF/Graphs/GraphPrinter.h +111 -0
  58. package/SVF-osx/Release-build/include/SVF/Graphs/GraphTraits.h +150 -0
  59. package/SVF-osx/Release-build/include/SVF/Graphs/GraphWriter.h +380 -0
  60. package/SVF-osx/Release-build/include/SVF/Graphs/ICFG.h +331 -0
  61. package/SVF-osx/Release-build/include/SVF/Graphs/ICFGEdge.h +281 -0
  62. package/SVF-osx/Release-build/include/SVF/Graphs/ICFGNode.h +669 -0
  63. package/SVF-osx/Release-build/include/SVF/Graphs/ICFGStat.h +164 -0
  64. package/SVF-osx/Release-build/include/SVF/Graphs/IRGraph.h +398 -0
  65. package/SVF-osx/Release-build/include/SVF/Graphs/SCC.h +375 -0
  66. package/SVF-osx/Release-build/include/SVF/Graphs/SVFG.h +491 -0
  67. package/SVF-osx/Release-build/include/SVF/Graphs/SVFGEdge.h +237 -0
  68. package/SVF-osx/Release-build/include/SVF/Graphs/SVFGNode.h +501 -0
  69. package/SVF-osx/Release-build/include/SVF/Graphs/SVFGOPT.h +372 -0
  70. package/SVF-osx/Release-build/include/SVF/Graphs/SVFGStat.h +273 -0
  71. package/SVF-osx/Release-build/include/SVF/Graphs/ThreadCallGraph.h +399 -0
  72. package/SVF-osx/Release-build/include/SVF/Graphs/VFG.h +726 -0
  73. package/SVF-osx/Release-build/include/SVF/Graphs/VFGEdge.h +295 -0
  74. package/SVF-osx/Release-build/include/SVF/Graphs/VFGNode.h +1266 -0
  75. package/SVF-osx/Release-build/include/SVF/Graphs/WTO.h +872 -0
  76. package/SVF-osx/Release-build/include/SVF/MSSA/MSSAMuChi.h +722 -0
  77. package/SVF-osx/Release-build/include/SVF/MSSA/MemPartition.h +169 -0
  78. package/SVF-osx/Release-build/include/SVF/MSSA/MemRegion.h +489 -0
  79. package/SVF-osx/Release-build/include/SVF/MSSA/MemSSA.h +452 -0
  80. package/SVF-osx/Release-build/include/SVF/MSSA/SVFGBuilder.h +104 -0
  81. package/SVF-osx/Release-build/include/SVF/MTA/LockAnalysis.h +533 -0
  82. package/SVF-osx/Release-build/include/SVF/MTA/MHP.h +546 -0
  83. package/SVF-osx/Release-build/include/SVF/MTA/MTA.h +97 -0
  84. package/SVF-osx/Release-build/include/SVF/MTA/MTAStat.h +73 -0
  85. package/SVF-osx/Release-build/include/SVF/MTA/TCT.h +620 -0
  86. package/SVF-osx/Release-build/include/SVF/MemoryModel/AbstractPointsToDS.h +316 -0
  87. package/SVF-osx/Release-build/include/SVF/MemoryModel/AccessPath.h +194 -0
  88. package/SVF-osx/Release-build/include/SVF/MemoryModel/ConditionalPT.h +878 -0
  89. package/SVF-osx/Release-build/include/SVF/MemoryModel/MutablePointsToDS.h +1025 -0
  90. package/SVF-osx/Release-build/include/SVF/MemoryModel/PersistentPointsToCache.h +463 -0
  91. package/SVF-osx/Release-build/include/SVF/MemoryModel/PersistentPointsToDS.h +955 -0
  92. package/SVF-osx/Release-build/include/SVF/MemoryModel/PointerAnalysis.h +428 -0
  93. package/SVF-osx/Release-build/include/SVF/MemoryModel/PointerAnalysisImpl.h +602 -0
  94. package/SVF-osx/Release-build/include/SVF/MemoryModel/PointsTo.h +255 -0
  95. package/SVF-osx/Release-build/include/SVF/MemoryModel/SVFLoop.h +167 -0
  96. package/SVF-osx/Release-build/include/SVF/SABER/DoubleFreeChecker.h +76 -0
  97. package/SVF-osx/Release-build/include/SVF/SABER/FileChecker.h +80 -0
  98. package/SVF-osx/Release-build/include/SVF/SABER/LeakChecker.h +122 -0
  99. package/SVF-osx/Release-build/include/SVF/SABER/ProgSlice.h +327 -0
  100. package/SVF-osx/Release-build/include/SVF/SABER/SaberCheckerAPI.h +151 -0
  101. package/SVF-osx/Release-build/include/SVF/SABER/SaberCondAllocator.h +317 -0
  102. package/SVF-osx/Release-build/include/SVF/SABER/SaberSVFGBuilder.h +114 -0
  103. package/SVF-osx/Release-build/include/SVF/SABER/SrcSnkDDA.h +327 -0
  104. package/SVF-osx/Release-build/include/SVF/SABER/SrcSnkSolver.h +186 -0
  105. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/BasicTypes.h +280 -0
  106. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/BreakConstantExpr.h +93 -0
  107. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/CHGBuilder.h +78 -0
  108. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/CppUtil.h +184 -0
  109. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/DCHG.h +474 -0
  110. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/GEPTypeBridgeIterator.h +183 -0
  111. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/ICFGBuilder.h +160 -0
  112. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/LLVMLoopAnalysis.h +60 -0
  113. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/LLVMModule.h +527 -0
  114. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/LLVMUtil.h +433 -0
  115. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/ObjTypeInference.h +129 -0
  116. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/SVFIRBuilder.h +523 -0
  117. package/SVF-osx/Release-build/include/SVF/SVF-LLVM/SymbolTableBuilder.h +132 -0
  118. package/SVF-osx/Release-build/include/SVF/SVFIR/ObjTypeInfo.h +224 -0
  119. package/SVF-osx/Release-build/include/SVF/SVFIR/PAGBuilderFromFile.h +80 -0
  120. package/SVF-osx/Release-build/include/SVF/SVFIR/SVFIR.h +856 -0
  121. package/SVF-osx/Release-build/include/SVF/SVFIR/SVFStatements.h +1330 -0
  122. package/SVF-osx/Release-build/include/SVF/SVFIR/SVFType.h +606 -0
  123. package/SVF-osx/Release-build/include/SVF/SVFIR/SVFValue.h +338 -0
  124. package/SVF-osx/Release-build/include/SVF/SVFIR/SVFVariables.h +2212 -0
  125. package/SVF-osx/Release-build/include/SVF/Util/Annotator.h +180 -0
  126. package/SVF-osx/Release-build/include/SVF/Util/BitVector.h +55 -0
  127. package/SVF-osx/Release-build/include/SVF/Util/CDGBuilder.h +107 -0
  128. package/SVF-osx/Release-build/include/SVF/Util/CallGraphBuilder.h +61 -0
  129. package/SVF-osx/Release-build/include/SVF/Util/Casting.h +426 -0
  130. package/SVF-osx/Release-build/include/SVF/Util/CommandLine.h +530 -0
  131. package/SVF-osx/Release-build/include/SVF/Util/CoreBitVector.h +214 -0
  132. package/SVF-osx/Release-build/include/SVF/Util/CxtStmt.h +502 -0
  133. package/SVF-osx/Release-build/include/SVF/Util/DPItem.h +618 -0
  134. package/SVF-osx/Release-build/include/SVF/Util/ExtAPI.h +117 -0
  135. package/SVF-osx/Release-build/include/SVF/Util/GeneralType.h +127 -0
  136. package/SVF-osx/Release-build/include/SVF/Util/GraphReachSolver.h +186 -0
  137. package/SVF-osx/Release-build/include/SVF/Util/NodeIDAllocator.h +203 -0
  138. package/SVF-osx/Release-build/include/SVF/Util/Options.h +273 -0
  139. package/SVF-osx/Release-build/include/SVF/Util/PTAStat.h +83 -0
  140. package/SVF-osx/Release-build/include/SVF/Util/SVFBugReport.h +427 -0
  141. package/SVF-osx/Release-build/include/SVF/Util/SVFLoopAndDomInfo.h +169 -0
  142. package/SVF-osx/Release-build/include/SVF/Util/SVFStat.h +103 -0
  143. package/SVF-osx/Release-build/include/SVF/Util/SVFUtil.h +478 -0
  144. package/SVF-osx/Release-build/include/SVF/Util/SparseBitVector.h +1252 -0
  145. package/SVF-osx/Release-build/include/SVF/Util/ThreadAPI.h +188 -0
  146. package/SVF-osx/Release-build/include/SVF/Util/WorkList.h +317 -0
  147. package/SVF-osx/Release-build/include/SVF/Util/Z3Expr.h +325 -0
  148. package/SVF-osx/Release-build/include/SVF/Util/cJSON.h +300 -0
  149. package/SVF-osx/Release-build/include/SVF/Util/config.h +46 -0
  150. package/SVF-osx/Release-build/include/SVF/Util/iterator.h +407 -0
  151. package/SVF-osx/Release-build/include/SVF/Util/iterator_range.h +76 -0
  152. package/SVF-osx/Release-build/include/SVF/WPA/Andersen.h +434 -0
  153. package/SVF-osx/Release-build/include/SVF/WPA/AndersenPWC.h +160 -0
  154. package/SVF-osx/Release-build/include/SVF/WPA/CSC.h +95 -0
  155. package/SVF-osx/Release-build/include/SVF/WPA/FlowSensitive.h +322 -0
  156. package/SVF-osx/Release-build/include/SVF/WPA/Steensgaard.h +131 -0
  157. package/SVF-osx/Release-build/include/SVF/WPA/TypeAnalysis.h +90 -0
  158. package/SVF-osx/Release-build/include/SVF/WPA/VersionedFlowSensitive.h +295 -0
  159. package/SVF-osx/Release-build/include/SVF/WPA/WPAFSSolver.h +246 -0
  160. package/SVF-osx/Release-build/include/SVF/WPA/WPAPass.h +115 -0
  161. package/SVF-osx/Release-build/include/SVF/WPA/WPASolver.h +205 -0
  162. package/SVF-osx/Release-build/include/SVF/WPA/WPAStat.h +222 -0
  163. package/SVF-osx/Release-build/include/SVF/extapi.bc +2384 -0
  164. package/SVF-osx/Release-build/lib/cmake/SVF/Modules/FindZ3.cmake +93 -0
  165. package/SVF-osx/Release-build/lib/cmake/SVF/SVFConfig.cmake +106 -0
  166. package/SVF-osx/Release-build/lib/cmake/SVF/SVFConfigVersion.cmake +43 -0
  167. package/SVF-osx/Release-build/lib/cmake/SVF/SVFTargets-release.cmake +101 -0
  168. package/SVF-osx/Release-build/lib/cmake/SVF/SVFTargets.cmake +180 -0
  169. package/SVF-osx/Release-build/lib/libSvfCore.3.1.dylib +0 -0
  170. package/SVF-osx/Release-build/lib/libSvfLLVM.3.1.dylib +0 -0
  171. package/SVF-osx/Release-build/lib/pkgconfig/SVF.pc +12 -0
  172. package/package.json +1 -1
  173. package/SVF-linux-aarch64/Release-build/include/CFL/grammar/PAGGrammar.txt +0 -15
  174. package/SVF-linux-aarch64/Release-build/include/CFL/grammar/PEGGrammar.txt +0 -11
  175. package/SVF-linux-aarch64/Release-build/include/CFL/grammar/VFGGrammar.txt +0 -7
  176. package/SVF-linux-aarch64/Release-build/include/FastCluster/LICENSE.TXT +0 -13
  177. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Core/AbstractState.h +0 -0
  178. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Core/AbstractValue.h +0 -0
  179. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Core/AddressValue.h +0 -0
  180. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Core/ICFGWTO.h +0 -0
  181. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Core/IntervalValue.h +0 -0
  182. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Core/NumericValue.h +0 -0
  183. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Core/RelExeState.h +0 -0
  184. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Core/RelationSolver.h +0 -0
  185. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Svfexe/AEDetector.h +0 -0
  186. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Svfexe/AbsExtAPI.h +0 -0
  187. /package/SVF-linux-aarch64/Release-build/include/{AE → SVF/AE}/Svfexe/AbstractInterpretation.h +0 -0
  188. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/CFGNormalizer.h +0 -0
  189. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/CFGrammar.h +0 -0
  190. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/CFLAlias.h +0 -0
  191. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/CFLBase.h +0 -0
  192. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/CFLGramGraphChecker.h +0 -0
  193. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/CFLGraphBuilder.h +0 -0
  194. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/CFLSVFGBuilder.h +0 -0
  195. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/CFLSolver.h +0 -0
  196. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/CFLStat.h +0 -0
  197. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/CFLVF.h +0 -0
  198. /package/SVF-linux-aarch64/Release-build/include/{CFL → SVF/CFL}/GrammarBuilder.h +0 -0
  199. /package/SVF-linux-aarch64/Release-build/include/{DDA → SVF/DDA}/ContextDDA.h +0 -0
  200. /package/SVF-linux-aarch64/Release-build/include/{DDA → SVF/DDA}/DDAClient.h +0 -0
  201. /package/SVF-linux-aarch64/Release-build/include/{DDA → SVF/DDA}/DDAPass.h +0 -0
  202. /package/SVF-linux-aarch64/Release-build/include/{DDA → SVF/DDA}/DDAStat.h +0 -0
  203. /package/SVF-linux-aarch64/Release-build/include/{DDA → SVF/DDA}/DDAVFSolver.h +0 -0
  204. /package/SVF-linux-aarch64/Release-build/include/{DDA → SVF/DDA}/FlowDDA.h +0 -0
  205. /package/SVF-linux-aarch64/Release-build/include/{FastCluster → SVF/FastCluster}/fastcluster.h +0 -0
  206. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/BasicBlockG.h +0 -0
  207. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/CDG.h +0 -0
  208. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/CFLGraph.h +0 -0
  209. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/CHG.h +0 -0
  210. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/CallGraph.h +0 -0
  211. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/ConsG.h +0 -0
  212. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/ConsGEdge.h +0 -0
  213. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/ConsGNode.h +0 -0
  214. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/DOTGraphTraits.h +0 -0
  215. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/GenericGraph.h +0 -0
  216. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/GraphPrinter.h +0 -0
  217. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/GraphTraits.h +0 -0
  218. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/GraphWriter.h +0 -0
  219. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/ICFG.h +0 -0
  220. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/ICFGEdge.h +0 -0
  221. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/ICFGNode.h +0 -0
  222. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/ICFGStat.h +0 -0
  223. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/IRGraph.h +0 -0
  224. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/SCC.h +0 -0
  225. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/SVFG.h +0 -0
  226. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/SVFGEdge.h +0 -0
  227. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/SVFGNode.h +0 -0
  228. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/SVFGOPT.h +0 -0
  229. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/SVFGStat.h +0 -0
  230. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/ThreadCallGraph.h +0 -0
  231. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/VFG.h +0 -0
  232. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/VFGEdge.h +0 -0
  233. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/VFGNode.h +0 -0
  234. /package/SVF-linux-aarch64/Release-build/include/{Graphs → SVF/Graphs}/WTO.h +0 -0
  235. /package/SVF-linux-aarch64/Release-build/include/{MSSA → SVF/MSSA}/MSSAMuChi.h +0 -0
  236. /package/SVF-linux-aarch64/Release-build/include/{MSSA → SVF/MSSA}/MemPartition.h +0 -0
  237. /package/SVF-linux-aarch64/Release-build/include/{MSSA → SVF/MSSA}/MemRegion.h +0 -0
  238. /package/SVF-linux-aarch64/Release-build/include/{MSSA → SVF/MSSA}/MemSSA.h +0 -0
  239. /package/SVF-linux-aarch64/Release-build/include/{MSSA → SVF/MSSA}/SVFGBuilder.h +0 -0
  240. /package/SVF-linux-aarch64/Release-build/include/{MTA → SVF/MTA}/LockAnalysis.h +0 -0
  241. /package/SVF-linux-aarch64/Release-build/include/{MTA → SVF/MTA}/MHP.h +0 -0
  242. /package/SVF-linux-aarch64/Release-build/include/{MTA → SVF/MTA}/MTA.h +0 -0
  243. /package/SVF-linux-aarch64/Release-build/include/{MTA → SVF/MTA}/MTAStat.h +0 -0
  244. /package/SVF-linux-aarch64/Release-build/include/{MTA → SVF/MTA}/TCT.h +0 -0
  245. /package/SVF-linux-aarch64/Release-build/include/{MemoryModel → SVF/MemoryModel}/AbstractPointsToDS.h +0 -0
  246. /package/SVF-linux-aarch64/Release-build/include/{MemoryModel → SVF/MemoryModel}/AccessPath.h +0 -0
  247. /package/SVF-linux-aarch64/Release-build/include/{MemoryModel → SVF/MemoryModel}/ConditionalPT.h +0 -0
  248. /package/SVF-linux-aarch64/Release-build/include/{MemoryModel → SVF/MemoryModel}/MutablePointsToDS.h +0 -0
  249. /package/SVF-linux-aarch64/Release-build/include/{MemoryModel → SVF/MemoryModel}/PersistentPointsToCache.h +0 -0
  250. /package/SVF-linux-aarch64/Release-build/include/{MemoryModel → SVF/MemoryModel}/PersistentPointsToDS.h +0 -0
  251. /package/SVF-linux-aarch64/Release-build/include/{MemoryModel → SVF/MemoryModel}/PointerAnalysis.h +0 -0
  252. /package/SVF-linux-aarch64/Release-build/include/{MemoryModel → SVF/MemoryModel}/PointerAnalysisImpl.h +0 -0
  253. /package/SVF-linux-aarch64/Release-build/include/{MemoryModel → SVF/MemoryModel}/PointsTo.h +0 -0
  254. /package/SVF-linux-aarch64/Release-build/include/{MemoryModel → SVF/MemoryModel}/SVFLoop.h +0 -0
  255. /package/SVF-linux-aarch64/Release-build/include/{SABER → SVF/SABER}/DoubleFreeChecker.h +0 -0
  256. /package/SVF-linux-aarch64/Release-build/include/{SABER → SVF/SABER}/FileChecker.h +0 -0
  257. /package/SVF-linux-aarch64/Release-build/include/{SABER → SVF/SABER}/LeakChecker.h +0 -0
  258. /package/SVF-linux-aarch64/Release-build/include/{SABER → SVF/SABER}/ProgSlice.h +0 -0
  259. /package/SVF-linux-aarch64/Release-build/include/{SABER → SVF/SABER}/SaberCheckerAPI.h +0 -0
  260. /package/SVF-linux-aarch64/Release-build/include/{SABER → SVF/SABER}/SaberCondAllocator.h +0 -0
  261. /package/SVF-linux-aarch64/Release-build/include/{SABER → SVF/SABER}/SaberSVFGBuilder.h +0 -0
  262. /package/SVF-linux-aarch64/Release-build/include/{SABER → SVF/SABER}/SrcSnkDDA.h +0 -0
  263. /package/SVF-linux-aarch64/Release-build/include/{SABER → SVF/SABER}/SrcSnkSolver.h +0 -0
  264. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/BasicTypes.h +0 -0
  265. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/BreakConstantExpr.h +0 -0
  266. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/CHGBuilder.h +0 -0
  267. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/CppUtil.h +0 -0
  268. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/DCHG.h +0 -0
  269. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/GEPTypeBridgeIterator.h +0 -0
  270. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/ICFGBuilder.h +0 -0
  271. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/LLVMLoopAnalysis.h +0 -0
  272. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/LLVMModule.h +0 -0
  273. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/LLVMUtil.h +0 -0
  274. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/ObjTypeInference.h +0 -0
  275. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/SVFIRBuilder.h +0 -0
  276. /package/SVF-linux-aarch64/Release-build/include/{SVF-LLVM → SVF/SVF-LLVM}/SymbolTableBuilder.h +0 -0
  277. /package/SVF-linux-aarch64/Release-build/include/{SVFIR → SVF/SVFIR}/ObjTypeInfo.h +0 -0
  278. /package/SVF-linux-aarch64/Release-build/include/{SVFIR → SVF/SVFIR}/PAGBuilderFromFile.h +0 -0
  279. /package/SVF-linux-aarch64/Release-build/include/{SVFIR → SVF/SVFIR}/SVFIR.h +0 -0
  280. /package/SVF-linux-aarch64/Release-build/include/{SVFIR → SVF/SVFIR}/SVFStatements.h +0 -0
  281. /package/SVF-linux-aarch64/Release-build/include/{SVFIR → SVF/SVFIR}/SVFType.h +0 -0
  282. /package/SVF-linux-aarch64/Release-build/include/{SVFIR → SVF/SVFIR}/SVFValue.h +0 -0
  283. /package/SVF-linux-aarch64/Release-build/include/{SVFIR → SVF/SVFIR}/SVFVariables.h +0 -0
  284. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/Annotator.h +0 -0
  285. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/BitVector.h +0 -0
  286. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/CDGBuilder.h +0 -0
  287. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/CallGraphBuilder.h +0 -0
  288. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/Casting.h +0 -0
  289. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/CommandLine.h +0 -0
  290. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/CoreBitVector.h +0 -0
  291. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/CxtStmt.h +0 -0
  292. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/DPItem.h +0 -0
  293. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/ExtAPI.h +0 -0
  294. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/GeneralType.h +0 -0
  295. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/GraphReachSolver.h +0 -0
  296. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/NodeIDAllocator.h +0 -0
  297. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/Options.h +0 -0
  298. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/PTAStat.h +0 -0
  299. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/SVFBugReport.h +0 -0
  300. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/SVFLoopAndDomInfo.h +0 -0
  301. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/SVFStat.h +0 -0
  302. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/SVFUtil.h +0 -0
  303. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/SparseBitVector.h +0 -0
  304. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/ThreadAPI.h +0 -0
  305. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/Z3Expr.h +0 -0
  306. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/cJSON.h +0 -0
  307. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/iterator.h +0 -0
  308. /package/SVF-linux-aarch64/Release-build/include/{Util → SVF/Util}/iterator_range.h +0 -0
  309. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/Andersen.h +0 -0
  310. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/AndersenPWC.h +0 -0
  311. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/CSC.h +0 -0
  312. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/FlowSensitive.h +0 -0
  313. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/Steensgaard.h +0 -0
  314. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/TypeAnalysis.h +0 -0
  315. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/VersionedFlowSensitive.h +0 -0
  316. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/WPAFSSolver.h +0 -0
  317. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/WPAPass.h +0 -0
  318. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/WPASolver.h +0 -0
  319. /package/SVF-linux-aarch64/Release-build/include/{WPA → SVF/WPA}/WPAStat.h +0 -0
  320. /package/SVF-linux-aarch64/Release-build/{lib → include/SVF}/extapi.bc +0 -0
@@ -0,0 +1,530 @@
1
+ #ifndef COMMANDLINE_H_
2
+ #define COMMANDLINE_H_
3
+
4
+ #include <algorithm>
5
+ #include <cassert>
6
+ #include <string>
7
+ #include <tuple>
8
+ #include <type_traits>
9
+ #include <unordered_map>
10
+ #include <unordered_set>
11
+ #include <limits>
12
+ #include <map>
13
+ #include <vector>
14
+ #include <cstdlib>
15
+ #include <iostream>
16
+ #include <sstream>
17
+
18
+ typedef unsigned u32_t;
19
+
20
+ class OptionBase
21
+ {
22
+ protected:
23
+ /// Name/description pairs.
24
+ typedef std::pair<std::string, std::string> PossibilityDescription;
25
+ typedef std::vector<std::pair<std::string, std::string>> PossibilityDescriptions;
26
+
27
+ /// Value/name/description tuples. If [1] is the value on the commandline for an option, we'd
28
+ /// set the value for the associated Option to [0].
29
+ template <typename T>
30
+ using OptionPossibility = std::tuple<T, std::string, std::string>;
31
+
32
+ protected:
33
+ OptionBase(std::string name, std::string description)
34
+ : OptionBase(name, description, {})
35
+ {
36
+ }
37
+
38
+ OptionBase(std::string name, std::string description, PossibilityDescriptions possibilityDescriptions)
39
+ : name(name), description(description), possibilityDescriptions(possibilityDescriptions)
40
+ {
41
+ assert(name[0] != '-' && "OptionBase: name starts with '-'");
42
+ assert(!isHelpName(name) && "OptionBase: reserved help name");
43
+ assert(getOptionsMap().find(name) == getOptionsMap().end() && "OptionBase: duplicate option");
44
+
45
+ // Types with empty names (i.e., OptionMultiple) can handle things themselves.
46
+ if (!name.empty())
47
+ {
48
+ // Standard name=value option.
49
+ getOptionsMap()[name] = this;
50
+ }
51
+ }
52
+
53
+ /// From a given string, set the value of this option.
54
+ virtual bool parseAndSetValue(const std::string value) = 0;
55
+
56
+ /// Whether this option represents a boolean. Important as such
57
+ /// arguments don't require a value.
58
+ virtual bool isBool(void) const
59
+ {
60
+ return false;
61
+ }
62
+
63
+ /// Whether this option is an OptionMultiple.
64
+ virtual bool isMultiple(void) const
65
+ {
66
+ return false;
67
+ }
68
+
69
+ /// Can this option be set?
70
+ virtual bool canSet(void) const = 0;
71
+
72
+ public:
73
+ /// Parse all constructed OptionBase children, returning positional arguments
74
+ /// in the order they appeared.
75
+ static std::vector<std::string> parseOptions(int argc, char *argv[], std::string description, std::string callFormat)
76
+ {
77
+ const std::string usage = buildUsage(description, std::string(argv[0]), callFormat);
78
+
79
+ std::vector<std::string> positionalArguments;
80
+
81
+ for (int i = 1; i < argc; ++i)
82
+ {
83
+ std::string arg(argv[i]);
84
+ if (arg.empty()) continue;
85
+ if (arg[0] != '-')
86
+ {
87
+ // Positional argument. NOT a value to another argument because we
88
+ // "skip" over evaluating those without the corresponding argument.
89
+ positionalArguments.push_back(arg);
90
+ continue;
91
+ }
92
+
93
+ // Chop off '-'.
94
+ arg = arg.substr(1);
95
+
96
+ std::string argName;
97
+ std::string argValue;
98
+ OptionBase *opt = nullptr;
99
+
100
+ size_t equalsSign = arg.find('=');
101
+ if (equalsSign != std::string::npos)
102
+ {
103
+ // Argument has an equal sign, i.e. argName=argValue
104
+ argName = arg.substr(0, equalsSign);
105
+ if (isHelpName(argName)) usageAndExit(usage, false);
106
+
107
+ opt = getOption(argName);
108
+ if (opt == nullptr)
109
+ {
110
+ std::cerr << "Unknown option: " << argName << std::endl;
111
+ usageAndExit(usage, true);
112
+ }
113
+
114
+ argValue = arg.substr(equalsSign + 1);
115
+ }
116
+ else
117
+ {
118
+ argName = arg;
119
+ if (isHelpName(argName)) usageAndExit(usage, false);
120
+
121
+ opt = getOption(argName);
122
+ if (opt == nullptr)
123
+ {
124
+ std::cerr << "Unknown option: " << argName << std::endl;
125
+ usageAndExit(usage, true);
126
+ }
127
+
128
+ // No equals sign means we may need next argument.
129
+ if (opt->isBool())
130
+ {
131
+ // Booleans do not accept -arg true/-arg false.
132
+ // They must be -arg=true/-arg=false.
133
+ argValue = "true";
134
+ }
135
+ else if (opt->isMultiple())
136
+ {
137
+ // Name is the value and will be converted to an enum.
138
+ argValue = argName;
139
+ }
140
+ else if (i + 1 < argc)
141
+ {
142
+ // On iteration, we'll skip the value.
143
+ ++i;
144
+ argValue = std::string(argv[i]);
145
+ }
146
+ else
147
+ {
148
+ std::cerr << "Expected value for: " << argName << std::endl;
149
+ usageAndExit(usage, true);
150
+ }
151
+ }
152
+
153
+ if (!opt->canSet())
154
+ {
155
+ std::cerr << "Unable to set: " << argName << "; check for duplicates" << std::endl;
156
+ usageAndExit(usage, true);
157
+ }
158
+
159
+ bool valueSet = opt->parseAndSetValue(argValue);
160
+ if (!valueSet)
161
+ {
162
+ std::cerr << "Bad value for: " << argName << std::endl;
163
+ usageAndExit(usage, true);
164
+ }
165
+ }
166
+
167
+ return positionalArguments;
168
+ }
169
+
170
+ private:
171
+ /// Sets the usage member to a usage string, built from the static list of options.
172
+ /// argv0 is argv[0] and callFormat is how the command should be used, minus the command
173
+ /// name (e.g. "[options] <input-bitcode...>".
174
+ static std::string buildUsage(
175
+ const std::string description, const std::string argv0, const std::string callFormat
176
+ )
177
+ {
178
+ // Determine longest option to split into two columns: options and descriptions.
179
+ unsigned longest = 0;
180
+ for (const std::pair<std::string, OptionBase *> nopt : getOptionsMap())
181
+ {
182
+ const std::string name = std::get<0>(nopt);
183
+ const OptionBase *option = std::get<1>(nopt);
184
+ if (option->isMultiple())
185
+ {
186
+ // For Multiple, description goes in left column.
187
+ if (option->description.length() > longest) longest = option->description.length();
188
+ }
189
+ else
190
+ {
191
+ if (name.length() > longest) longest = name.length();
192
+ }
193
+
194
+ for (const PossibilityDescription &pd : option->possibilityDescriptions)
195
+ {
196
+ const std::string possibility = std::get<0>(pd);
197
+ if (possibility.length() + 3 > longest) longest = possibility.length() + 3;
198
+ }
199
+ }
200
+
201
+ std::stringstream ss;
202
+
203
+ ss << description << std::endl << std::endl;
204
+
205
+ ss << "USAGE:" << std::endl;
206
+ ss << " " << argv0 << " " << callFormat << std::endl;
207
+ ss << std::endl;
208
+
209
+ ss << "OPTIONS:" << std::endl;
210
+
211
+ // Required as we have OptionMultiples doing a many-to-one in options.
212
+ std::unordered_set<const OptionBase *> handled;
213
+ for (const std::pair<std::string, OptionBase *> nopt : getOptionsMap())
214
+ {
215
+ const std::string name = std::get<0>(nopt);
216
+ const OptionBase *option = std::get<1>(nopt);
217
+ if (handled.find(option) != handled.end()) continue;
218
+ handled.insert(option);
219
+
220
+ if (option->isMultiple())
221
+ {
222
+ // description
223
+ // -name1 - description
224
+ // -name2 - description
225
+ // ...
226
+ ss << " " << option->description << std::endl;
227
+ for (const PossibilityDescription &pd : option->possibilityDescriptions)
228
+ {
229
+ const std::string possibility = std::get<0>(pd);
230
+ const std::string description = std::get<1>(pd);
231
+ ss << " -" << possibility << std::string(longest - possibility.length() + 2, ' ');
232
+ ss << "- " << description << std::endl;
233
+ }
234
+ }
235
+ else
236
+ {
237
+ // name - description
238
+ // or
239
+ // name - description
240
+ // =opt1 - description
241
+ // =opt2 - description
242
+ // ...
243
+ ss << " -" << name << std::string(longest - name.length() + 2, ' ');
244
+ ss << "- " << option->description << std::endl;
245
+ for (const PossibilityDescription &pd : option->possibilityDescriptions)
246
+ {
247
+ const std::string possibility = std::get<0>(pd);
248
+ const std::string description = std::get<1>(pd);
249
+ ss << " =" << possibility << std::string(longest - possibility.length() + 2, ' ');
250
+ ss << "- " << description << std::endl;
251
+ }
252
+ }
253
+ }
254
+
255
+ // Help message.
256
+ ss << std::endl;
257
+ ss << " -help" << std::string(longest - 4 + 2, ' ') << "- show usage and exit" << std::endl;
258
+ ss << " -h" << std::string(longest - 1 + 2, ' ') << "- show usage and exit" << std::endl;
259
+
260
+ // How to set boolean options.
261
+ ss << std::endl;
262
+ ss << "Note: for boolean options, -name true and -name false are invalid." << std::endl;
263
+ ss << " Use -name, -name=true, or -name=false." << std::endl;
264
+
265
+ return ss.str();
266
+ }
267
+
268
+ /// Find option based on name in options map. Returns nullptr if not found.
269
+ static OptionBase *getOption(const std::string optName)
270
+ {
271
+ auto optIt = getOptionsMap().find(optName);
272
+ if (optIt == getOptionsMap().end()) return nullptr;
273
+ else return optIt->second;
274
+ }
275
+
276
+ /// Print usage and exit. If error is set, print to stderr and exits with code 1.
277
+ static void usageAndExit(const std::string usage, bool error)
278
+ {
279
+ if (error) std::cerr << usage;
280
+ else std::cout << usage;
281
+ std::exit(error ? 1 : 0);
282
+ }
283
+
284
+ /// Returns whether name is one of the reserved help options.
285
+ static bool isHelpName(const std::string name)
286
+ {
287
+ static std::vector<std::string> helpNames = {"help", "h", "-help"};
288
+ return std::find(helpNames.begin(), helpNames.end(), name) != helpNames.end();
289
+ }
290
+
291
+ protected:
292
+ // Return the name/description part of OptionsPossibilities (second and third fields).
293
+ template<typename T>
294
+ static PossibilityDescriptions extractPossibilityDescriptions(const std::vector<OptionPossibility<T>> possibilities)
295
+ {
296
+ PossibilityDescriptions possibilityDescriptions;
297
+ for (const OptionPossibility<T> &op : possibilities)
298
+ {
299
+ possibilityDescriptions.push_back(std::make_pair(std::get<1>(op), std::get<2>(op)));
300
+ }
301
+
302
+ return possibilityDescriptions;
303
+ }
304
+
305
+ /// Not unordered map so we can have sorted names when building the usage string.
306
+ /// Map of option names to their object.
307
+ static std::map<std::string, OptionBase *> &getOptionsMap(void)
308
+ {
309
+ // Not static member to avoid initialisation order problems.
310
+ static std::map<std::string, OptionBase *> options;
311
+ return options;
312
+ }
313
+
314
+
315
+ protected:
316
+ std::string name;
317
+ std::string description;
318
+ /// For when we have possibilities like in an OptionMap.
319
+ PossibilityDescriptions possibilityDescriptions;
320
+ };
321
+
322
+ /// General -name=value options.
323
+ /// Retrieve value by Opt().
324
+ template <typename T>
325
+ class Option : public OptionBase
326
+ {
327
+ public:
328
+ Option(const std::string& name, const std::string& description, T init)
329
+ : OptionBase(name, description), isExplicitlySet(false), value(init)
330
+ {
331
+ assert(!name.empty() && "Option: empty option name given");
332
+ }
333
+
334
+ virtual bool canSet(void) const override
335
+ {
336
+ // Don't allow duplicates.
337
+ return !isExplicitlySet;
338
+ }
339
+
340
+ virtual bool parseAndSetValue(const std::string s) override
341
+ {
342
+ isExplicitlySet = fromString(s, value);
343
+ return isExplicitlySet;
344
+ }
345
+
346
+ virtual bool isBool(void) const override
347
+ {
348
+ return std::is_same<T, bool>::value;
349
+ }
350
+
351
+ void setValue(T v)
352
+ {
353
+ value = v;
354
+ }
355
+
356
+ T operator()(void) const
357
+ {
358
+ return value;
359
+ }
360
+
361
+ private:
362
+ // Convert string to boolean, returning whether we succeeded.
363
+ static bool fromString(const std::string& s, bool& value)
364
+ {
365
+ if (s == "true")
366
+ value = true;
367
+ else if (s == "false")
368
+ value = false;
369
+ else
370
+ return false;
371
+ return true;
372
+ }
373
+
374
+ // Convert string to string, always succeeds.
375
+ static bool fromString(const std::string s, std::string &value)
376
+ {
377
+ value = s;
378
+ return true;
379
+ }
380
+
381
+ // Convert string to u32_t, returning whether we succeeded.
382
+ static bool fromString(const std::string s, u32_t &value)
383
+ {
384
+ // We won't allow anything except [0-9]+.
385
+ if (s.empty()) return false;
386
+ for (char c : s)
387
+ {
388
+ if (!(c >= '0' && c <= '9')) return false;
389
+ }
390
+
391
+ // Use strtoul because we're not using exceptions.
392
+ assert(sizeof(unsigned long) >= sizeof(u32_t));
393
+ const unsigned long sv = std::strtoul(s.c_str(), nullptr, 10);
394
+
395
+ // Out of range according to strtoul, or according to us compared to u32_t.
396
+ if (errno == ERANGE || sv > std::numeric_limits<u32_t>::max()) return false;
397
+ value = sv;
398
+ return true;
399
+ }
400
+
401
+ private:
402
+ bool isExplicitlySet;
403
+ T value;
404
+ };
405
+
406
+ /// Option allowing a limited range of values, probably corresponding to an enum.
407
+ /// Opt() gives the value.
408
+ template <typename T>
409
+ class OptionMap : public OptionBase
410
+ {
411
+ public:
412
+ typedef std::vector<OptionPossibility<T>> OptionPossibilities;
413
+
414
+ OptionMap(std::string name, std::string description, T init, OptionPossibilities possibilities)
415
+ : OptionBase(name, description, extractPossibilityDescriptions(possibilities)),
416
+ isExplicitlySet(false), value(init), possibilities(possibilities)
417
+ {
418
+ assert(!name.empty() && "OptionMap: empty option name given");
419
+ }
420
+
421
+ virtual bool canSet(void) const override
422
+ {
423
+ return !isExplicitlySet;
424
+ }
425
+
426
+ virtual bool parseAndSetValue(const std::string s) override
427
+ {
428
+ for (const OptionPossibility<T> &op : possibilities)
429
+ {
430
+ // Check if the given string is a valid one.
431
+ if (s == std::get<1>(op))
432
+ {
433
+ // What that string maps to.
434
+ value = std::get<0>(op);
435
+ isExplicitlySet = true;
436
+ break;
437
+ }
438
+ }
439
+
440
+ return isExplicitlySet;
441
+ }
442
+
443
+ T operator()(void) const
444
+ {
445
+ return value;
446
+ }
447
+
448
+ private:
449
+ bool isExplicitlySet;
450
+ T value;
451
+ OptionPossibilities possibilities;
452
+ };
453
+
454
+ /// Options which form a kind of bit set. There are multiple names and n of them can be set.
455
+ /// Opt(v) tests whether v had been set, aborting if v is invalid.
456
+ template <typename T>
457
+ class OptionMultiple : public OptionBase
458
+ {
459
+ public:
460
+ typedef std::vector<OptionPossibility<T>> OptionPossibilities;
461
+
462
+ OptionMultiple(std::string description, OptionPossibilities possibilities)
463
+ : OptionBase("", description, extractPossibilityDescriptions(possibilities)), possibilities(possibilities)
464
+ {
465
+ for (const OptionPossibility<T> &op : possibilities)
466
+ {
467
+ optionValues[std::get<0>(op)] = false;
468
+ }
469
+
470
+ for (const OptionPossibility<T> &op : possibilities)
471
+ {
472
+ std::string possibilityName = std::get<1>(op);
473
+ getOptionsMap()[possibilityName] = this;
474
+ }
475
+ }
476
+
477
+ virtual bool canSet(void) const override
478
+ {
479
+ return true;
480
+ }
481
+
482
+ virtual bool parseAndSetValue(const std::string s) override
483
+ {
484
+ // Like in OptionMap basically, except we can have many values.
485
+ for (const OptionPossibility<T> &op : possibilities)
486
+ {
487
+ if (s == std::get<1>(op))
488
+ {
489
+ optionValues[std::get<0>(op)] = true;
490
+ return true;
491
+ }
492
+ }
493
+
494
+ return false;
495
+ }
496
+
497
+ virtual bool isMultiple(void) const override
498
+ {
499
+ return true;
500
+ }
501
+
502
+ /// If the bitset is empty.
503
+ bool nothingSet(void) const
504
+ {
505
+ for (const std::pair<T, bool> tb : optionValues)
506
+ {
507
+ if (tb.second) return false;
508
+ }
509
+
510
+ return true;
511
+ }
512
+
513
+ /// Returns whether the value v had been set as an option.
514
+ bool operator()(const T v) const
515
+ {
516
+ typename std::unordered_map<T, bool>::const_iterator ovIt = optionValues.find(v);
517
+ // TODO: disabled as we check for "invalid" values in some places.
518
+ // assert(ovIt != optionValues.end() && "OptionMultiple: bad value checked");
519
+ if (ovIt == optionValues.end()) return false;
520
+ return ovIt->second;
521
+ }
522
+
523
+ private:
524
+ /// Is the option set? Use a map rather than a set because it's now easier in one
525
+ /// DS to determine whether something is 1) valid, and 2) set.
526
+ std::unordered_map<T, bool> optionValues;
527
+ OptionPossibilities possibilities;
528
+ };
529
+
530
+ #endif /* COMMANDLINE_H_ */