xcodebuild-helper 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +20 -0
  3. data/.gitignore +1 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +7 -0
  6. data/Gemfile +6 -0
  7. data/Gemfile.lock +110 -0
  8. data/Guardfile +18 -0
  9. data/README.md +7 -0
  10. data/Rakefile +7 -0
  11. data/TODO.md +3 -0
  12. data/bin/oclint +5 -0
  13. data/bin/oclint-0.8 +5 -0
  14. data/bin/oclint-json-compilation-database +5 -0
  15. data/bin/oclint-xcodebuild +5 -0
  16. data/externals/oclint/LICENSE +69 -0
  17. data/externals/oclint/bin/oclint +0 -0
  18. data/externals/oclint/bin/oclint-0.10.2 +0 -0
  19. data/externals/oclint/bin/oclint-json-compilation-database +88 -0
  20. data/externals/oclint/bin/oclint-xcodebuild +218 -0
  21. data/externals/oclint/lib/clang/3.7.0/asan_blacklist.txt +13 -0
  22. data/externals/oclint/lib/clang/3.7.0/include/Intrin.h +958 -0
  23. data/externals/oclint/lib/clang/3.7.0/include/__stddef_max_align_t.h +43 -0
  24. data/externals/oclint/lib/clang/3.7.0/include/__wmmintrin_aes.h +72 -0
  25. data/externals/oclint/lib/clang/3.7.0/include/__wmmintrin_pclmul.h +34 -0
  26. data/externals/oclint/lib/clang/3.7.0/include/adxintrin.h +88 -0
  27. data/externals/oclint/lib/clang/3.7.0/include/altivec.h +13528 -0
  28. data/externals/oclint/lib/clang/3.7.0/include/ammintrin.h +215 -0
  29. data/externals/oclint/lib/clang/3.7.0/include/arm_acle.h +304 -0
  30. data/externals/oclint/lib/clang/3.7.0/include/arm_neon.h +68419 -0
  31. data/externals/oclint/lib/clang/3.7.0/include/avx2intrin.h +1256 -0
  32. data/externals/oclint/lib/clang/3.7.0/include/avx512bwintrin.h +1250 -0
  33. data/externals/oclint/lib/clang/3.7.0/include/avx512cdintrin.h +131 -0
  34. data/externals/oclint/lib/clang/3.7.0/include/avx512dqintrin.h +242 -0
  35. data/externals/oclint/lib/clang/3.7.0/include/avx512erintrin.h +285 -0
  36. data/externals/oclint/lib/clang/3.7.0/include/avx512fintrin.h +2457 -0
  37. data/externals/oclint/lib/clang/3.7.0/include/avx512vlbwintrin.h +1907 -0
  38. data/externals/oclint/lib/clang/3.7.0/include/avx512vldqintrin.h +353 -0
  39. data/externals/oclint/lib/clang/3.7.0/include/avx512vlintrin.h +1982 -0
  40. data/externals/oclint/lib/clang/3.7.0/include/avxintrin.h +1308 -0
  41. data/externals/oclint/lib/clang/3.7.0/include/bmi2intrin.h +99 -0
  42. data/externals/oclint/lib/clang/3.7.0/include/bmiintrin.h +153 -0
  43. data/externals/oclint/lib/clang/3.7.0/include/cpuid.h +209 -0
  44. data/externals/oclint/lib/clang/3.7.0/include/cuda_builtin_vars.h +110 -0
  45. data/externals/oclint/lib/clang/3.7.0/include/emmintrin.h +1480 -0
  46. data/externals/oclint/lib/clang/3.7.0/include/f16cintrin.h +63 -0
  47. data/externals/oclint/lib/clang/3.7.0/include/float.h +124 -0
  48. data/externals/oclint/lib/clang/3.7.0/include/fma4intrin.h +236 -0
  49. data/externals/oclint/lib/clang/3.7.0/include/fmaintrin.h +234 -0
  50. data/externals/oclint/lib/clang/3.7.0/include/fxsrintrin.h +55 -0
  51. data/externals/oclint/lib/clang/3.7.0/include/htmintrin.h +226 -0
  52. data/externals/oclint/lib/clang/3.7.0/include/htmxlintrin.h +363 -0
  53. data/externals/oclint/lib/clang/3.7.0/include/ia32intrin.h +101 -0
  54. data/externals/oclint/lib/clang/3.7.0/include/immintrin.h +203 -0
  55. data/externals/oclint/lib/clang/3.7.0/include/inttypes.h +102 -0
  56. data/externals/oclint/lib/clang/3.7.0/include/iso646.h +43 -0
  57. data/externals/oclint/lib/clang/3.7.0/include/limits.h +118 -0
  58. data/externals/oclint/lib/clang/3.7.0/include/lzcntintrin.h +72 -0
  59. data/externals/oclint/lib/clang/3.7.0/include/mm3dnow.h +167 -0
  60. data/externals/oclint/lib/clang/3.7.0/include/mm_malloc.h +75 -0
  61. data/externals/oclint/lib/clang/3.7.0/include/mmintrin.h +507 -0
  62. data/externals/oclint/lib/clang/3.7.0/include/module.modulemap +196 -0
  63. data/externals/oclint/lib/clang/3.7.0/include/nmmintrin.h +35 -0
  64. data/externals/oclint/lib/clang/3.7.0/include/pmmintrin.h +122 -0
  65. data/externals/oclint/lib/clang/3.7.0/include/popcntintrin.h +50 -0
  66. data/externals/oclint/lib/clang/3.7.0/include/prfchwintrin.h +39 -0
  67. data/externals/oclint/lib/clang/3.7.0/include/rdseedintrin.h +59 -0
  68. data/externals/oclint/lib/clang/3.7.0/include/rtmintrin.h +59 -0
  69. data/externals/oclint/lib/clang/3.7.0/include/s390intrin.h +39 -0
  70. data/externals/oclint/lib/clang/3.7.0/include/sanitizer/allocator_interface.h +66 -0
  71. data/externals/oclint/lib/clang/3.7.0/include/sanitizer/asan_interface.h +155 -0
  72. data/externals/oclint/lib/clang/3.7.0/include/sanitizer/common_interface_defs.h +118 -0
  73. data/externals/oclint/lib/clang/3.7.0/include/sanitizer/coverage_interface.h +63 -0
  74. data/externals/oclint/lib/clang/3.7.0/include/sanitizer/dfsan_interface.h +114 -0
  75. data/externals/oclint/lib/clang/3.7.0/include/sanitizer/linux_syscall_hooks.h +3070 -0
  76. data/externals/oclint/lib/clang/3.7.0/include/sanitizer/lsan_interface.h +84 -0
  77. data/externals/oclint/lib/clang/3.7.0/include/sanitizer/msan_interface.h +107 -0
  78. data/externals/oclint/lib/clang/3.7.0/include/sanitizer/tsan_interface_atomic.h +222 -0
  79. data/externals/oclint/lib/clang/3.7.0/include/shaintrin.h +79 -0
  80. data/externals/oclint/lib/clang/3.7.0/include/smmintrin.h +487 -0
  81. data/externals/oclint/lib/clang/3.7.0/include/stdalign.h +35 -0
  82. data/externals/oclint/lib/clang/3.7.0/include/stdarg.h +52 -0
  83. data/externals/oclint/lib/clang/3.7.0/include/stdatomic.h +190 -0
  84. data/externals/oclint/lib/clang/3.7.0/include/stdbool.h +44 -0
  85. data/externals/oclint/lib/clang/3.7.0/include/stddef.h +137 -0
  86. data/externals/oclint/lib/clang/3.7.0/include/stdint.h +707 -0
  87. data/externals/oclint/lib/clang/3.7.0/include/stdnoreturn.h +30 -0
  88. data/externals/oclint/lib/clang/3.7.0/include/tbmintrin.h +154 -0
  89. data/externals/oclint/lib/clang/3.7.0/include/tgmath.h +1374 -0
  90. data/externals/oclint/lib/clang/3.7.0/include/tmmintrin.h +230 -0
  91. data/externals/oclint/lib/clang/3.7.0/include/unwind.h +282 -0
  92. data/externals/oclint/lib/clang/3.7.0/include/vadefs.h +65 -0
  93. data/externals/oclint/lib/clang/3.7.0/include/varargs.h +26 -0
  94. data/externals/oclint/lib/clang/3.7.0/include/vecintrin.h +8946 -0
  95. data/externals/oclint/lib/clang/3.7.0/include/wmmintrin.h +42 -0
  96. data/externals/oclint/lib/clang/3.7.0/include/x86intrin.h +81 -0
  97. data/externals/oclint/lib/clang/3.7.0/include/xmmintrin.h +1008 -0
  98. data/externals/oclint/lib/clang/3.7.0/include/xopintrin.h +809 -0
  99. data/externals/oclint/lib/clang/3.7.0/include/xtestintrin.h +41 -0
  100. data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.asan_iossim_dynamic.dylib +0 -0
  101. data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib +0 -0
  102. data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.builtins-i386.a +0 -0
  103. data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.builtins-x86_64.a +0 -0
  104. data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.profile_osx.a +0 -0
  105. data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.safestack_osx.a +0 -0
  106. data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.ubsan_iossim_dynamic.dylib +0 -0
  107. data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib +0 -0
  108. data/externals/oclint/lib/oclint/reporters/libHTMLReporter.dylib +0 -0
  109. data/externals/oclint/lib/oclint/reporters/libJSONReporter.dylib +0 -0
  110. data/externals/oclint/lib/oclint/reporters/libPMDReporter.dylib +0 -0
  111. data/externals/oclint/lib/oclint/reporters/libTextReporter.dylib +0 -0
  112. data/externals/oclint/lib/oclint/reporters/libXMLReporter.dylib +0 -0
  113. data/externals/oclint/lib/oclint/reporters/libXcodeReporter.dylib +0 -0
  114. data/externals/oclint/lib/oclint/rules/libAvoidBranchingStatementAsLastInLoopRule.dylib +0 -0
  115. data/externals/oclint/lib/oclint/rules/libAvoidDefaultArgumentsOnVirtualMethodsRule.dylib +0 -0
  116. data/externals/oclint/lib/oclint/rules/libAvoidPrivateStaticMembersRule.dylib +0 -0
  117. data/externals/oclint/lib/oclint/rules/libBaseClassDestructorShouldBeVirtualOrProtectedRule.dylib +0 -0
  118. data/externals/oclint/lib/oclint/rules/libBitwiseOperatorInConditionalRule.dylib +0 -0
  119. data/externals/oclint/lib/oclint/rules/libBrokenNullCheckRule.dylib +0 -0
  120. data/externals/oclint/lib/oclint/rules/libBrokenOddnessCheckRule.dylib +0 -0
  121. data/externals/oclint/lib/oclint/rules/libCollapsibleIfStatementsRule.dylib +0 -0
  122. data/externals/oclint/lib/oclint/rules/libConstantConditionalOperatorRule.dylib +0 -0
  123. data/externals/oclint/lib/oclint/rules/libConstantIfExpressionRule.dylib +0 -0
  124. data/externals/oclint/lib/oclint/rules/libCoveredSwitchStatementsDontNeedDefaultRule.dylib +0 -0
  125. data/externals/oclint/lib/oclint/rules/libCyclomaticComplexityRule.dylib +0 -0
  126. data/externals/oclint/lib/oclint/rules/libDeadCodeRule.dylib +0 -0
  127. data/externals/oclint/lib/oclint/rules/libDefaultLabelNotLastInSwitchStatementRule.dylib +0 -0
  128. data/externals/oclint/lib/oclint/rules/libDestructorOfVirtualClassRule.dylib +0 -0
  129. data/externals/oclint/lib/oclint/rules/libDoubleNegativeRule.dylib +0 -0
  130. data/externals/oclint/lib/oclint/rules/libEmptyCatchStatementRule.dylib +0 -0
  131. data/externals/oclint/lib/oclint/rules/libEmptyDoWhileStatementRule.dylib +0 -0
  132. data/externals/oclint/lib/oclint/rules/libEmptyElseBlockRule.dylib +0 -0
  133. data/externals/oclint/lib/oclint/rules/libEmptyFinallyStatementRule.dylib +0 -0
  134. data/externals/oclint/lib/oclint/rules/libEmptyForStatementRule.dylib +0 -0
  135. data/externals/oclint/lib/oclint/rules/libEmptyIfStatementRule.dylib +0 -0
  136. data/externals/oclint/lib/oclint/rules/libEmptySwitchStatementRule.dylib +0 -0
  137. data/externals/oclint/lib/oclint/rules/libEmptyTryStatementRule.dylib +0 -0
  138. data/externals/oclint/lib/oclint/rules/libEmptyWhileStatementRule.dylib +0 -0
  139. data/externals/oclint/lib/oclint/rules/libForLoopShouldBeWhileLoopRule.dylib +0 -0
  140. data/externals/oclint/lib/oclint/rules/libGotoStatementRule.dylib +0 -0
  141. data/externals/oclint/lib/oclint/rules/libInvertedLogicRule.dylib +0 -0
  142. data/externals/oclint/lib/oclint/rules/libJumbledIncrementerRule.dylib +0 -0
  143. data/externals/oclint/lib/oclint/rules/libLongClassRule.dylib +0 -0
  144. data/externals/oclint/lib/oclint/rules/libLongLineRule.dylib +0 -0
  145. data/externals/oclint/lib/oclint/rules/libLongMethodRule.dylib +0 -0
  146. data/externals/oclint/lib/oclint/rules/libLongVariableNameRule.dylib +0 -0
  147. data/externals/oclint/lib/oclint/rules/libMisplacedNullCheckRule.dylib +0 -0
  148. data/externals/oclint/lib/oclint/rules/libMissingBreakInSwitchStatementRule.dylib +0 -0
  149. data/externals/oclint/lib/oclint/rules/libMultipleUnaryOperatorRule.dylib +0 -0
  150. data/externals/oclint/lib/oclint/rules/libNPathComplexityRule.dylib +0 -0
  151. data/externals/oclint/lib/oclint/rules/libNcssMethodCountRule.dylib +0 -0
  152. data/externals/oclint/lib/oclint/rules/libNestedBlockDepthRule.dylib +0 -0
  153. data/externals/oclint/lib/oclint/rules/libNonCaseLabelInSwitchStatementRule.dylib +0 -0
  154. data/externals/oclint/lib/oclint/rules/libObjCAssignIvarOutsideAccessorsRule.dylib +0 -0
  155. data/externals/oclint/lib/oclint/rules/libObjCBoxedExpressionsRule.dylib +0 -0
  156. data/externals/oclint/lib/oclint/rules/libObjCContainerLiteralsRule.dylib +0 -0
  157. data/externals/oclint/lib/oclint/rules/libObjCNSNumberLiteralsRule.dylib +0 -0
  158. data/externals/oclint/lib/oclint/rules/libObjCObjectSubscriptingRule.dylib +0 -0
  159. data/externals/oclint/lib/oclint/rules/libObjCVerifyIsEqualHashRule.dylib +0 -0
  160. data/externals/oclint/lib/oclint/rules/libObjCVerifyMustCallSuperRule.dylib +0 -0
  161. data/externals/oclint/lib/oclint/rules/libObjCVerifyProhibitedCallRule.dylib +0 -0
  162. data/externals/oclint/lib/oclint/rules/libObjCVerifyProtectedMethodRule.dylib +0 -0
  163. data/externals/oclint/lib/oclint/rules/libObjCVerifySubclassMustImplementRule.dylib +0 -0
  164. data/externals/oclint/lib/oclint/rules/libParameterReassignmentRule.dylib +0 -0
  165. data/externals/oclint/lib/oclint/rules/libPreferEarlyExitRule.dylib +0 -0
  166. data/externals/oclint/lib/oclint/rules/libRedundantConditionalOperatorRule.dylib +0 -0
  167. data/externals/oclint/lib/oclint/rules/libRedundantIfStatementRule.dylib +0 -0
  168. data/externals/oclint/lib/oclint/rules/libRedundantLocalVariableRule.dylib +0 -0
  169. data/externals/oclint/lib/oclint/rules/libRedundantNilCheckRule.dylib +0 -0
  170. data/externals/oclint/lib/oclint/rules/libReturnFromFinallyBlockRule.dylib +0 -0
  171. data/externals/oclint/lib/oclint/rules/libShortVariableNameRule.dylib +0 -0
  172. data/externals/oclint/lib/oclint/rules/libSwitchStatementsShouldHaveDefaultRule.dylib +0 -0
  173. data/externals/oclint/lib/oclint/rules/libThrowExceptionFromFinallyBlockRule.dylib +0 -0
  174. data/externals/oclint/lib/oclint/rules/libTooFewBranchesInSwitchStatementRule.dylib +0 -0
  175. data/externals/oclint/lib/oclint/rules/libTooManyFieldsRule.dylib +0 -0
  176. data/externals/oclint/lib/oclint/rules/libTooManyMethodsRule.dylib +0 -0
  177. data/externals/oclint/lib/oclint/rules/libTooManyParametersRule.dylib +0 -0
  178. data/externals/oclint/lib/oclint/rules/libUnnecessaryElseStatementRule.dylib +0 -0
  179. data/externals/oclint/lib/oclint/rules/libUnnecessaryNullCheckForCXXDeallocRule.dylib +0 -0
  180. data/externals/oclint/lib/oclint/rules/libUnusedLocalVariableRule.dylib +0 -0
  181. data/externals/oclint/lib/oclint/rules/libUnusedMethodParameterRule.dylib +0 -0
  182. data/externals/oclint/lib/oclint/rules/libUselessParenthesesRule.dylib +0 -0
  183. data/lib/coverage_plan.rb +19 -0
  184. data/lib/device.rb +27 -0
  185. data/lib/execute.rb +7 -0
  186. data/lib/lint_plan.rb +41 -0
  187. data/lib/rules.rb +23 -0
  188. data/lib/test_plan.rb +11 -0
  189. data/lib/version.rb +3 -0
  190. data/lib/xcode.rb +128 -0
  191. data/lib/xcodebuild-helper.rb +110 -0
  192. data/spec/coverage_plan_spec.rb +18 -0
  193. data/spec/device_spec.rb +24 -0
  194. data/spec/lint_plan_spec.rb +35 -0
  195. data/spec/rule_spec.rb +37 -0
  196. data/spec/spec_helper.rb +17 -0
  197. data/spec/test_plan_spec.rb +11 -0
  198. data/spec/xcode_dsl_actions_spec.rb +136 -0
  199. data/spec/xcode_dsl_spec.rb +176 -0
  200. data/spec/xcode_spec.rb +79 -0
  201. data/xcodebuild-helper.gemspec +26 -0
  202. metadata +327 -0
@@ -0,0 +1,59 @@
1
+ /*===---- rtmintrin.h - RTM intrinsics -------------------------------------===
2
+ *
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ *===-----------------------------------------------------------------------===
22
+ */
23
+
24
+ #ifndef __IMMINTRIN_H
25
+ #error "Never use <rtmintrin.h> directly; include <immintrin.h> instead."
26
+ #endif
27
+
28
+ #ifndef __RTMINTRIN_H
29
+ #define __RTMINTRIN_H
30
+
31
+ #define _XBEGIN_STARTED (~0u)
32
+ #define _XABORT_EXPLICIT (1 << 0)
33
+ #define _XABORT_RETRY (1 << 1)
34
+ #define _XABORT_CONFLICT (1 << 2)
35
+ #define _XABORT_CAPACITY (1 << 3)
36
+ #define _XABORT_DEBUG (1 << 4)
37
+ #define _XABORT_NESTED (1 << 5)
38
+ #define _XABORT_CODE(x) (((x) >> 24) & 0xFF)
39
+
40
+ /* Define the default attributes for the functions in this file. */
41
+ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
42
+
43
+ static __inline__ unsigned int __DEFAULT_FN_ATTRS
44
+ _xbegin(void)
45
+ {
46
+ return __builtin_ia32_xbegin();
47
+ }
48
+
49
+ static __inline__ void __DEFAULT_FN_ATTRS
50
+ _xend(void)
51
+ {
52
+ __builtin_ia32_xend();
53
+ }
54
+
55
+ #define _xabort(imm) __builtin_ia32_xabort((imm))
56
+
57
+ #undef __DEFAULT_FN_ATTRS
58
+
59
+ #endif /* __RTMINTRIN_H */
@@ -0,0 +1,39 @@
1
+ /*===---- s390intrin.h - SystemZ intrinsics --------------------------------===
2
+ *
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ *===-----------------------------------------------------------------------===
22
+ */
23
+
24
+ #ifndef __S390INTRIN_H
25
+ #define __S390INTRIN_H
26
+
27
+ #ifndef __s390__
28
+ #error "<s390intrin.h> is for s390 only"
29
+ #endif
30
+
31
+ #ifdef __HTM__
32
+ #include <htmintrin.h>
33
+ #endif
34
+
35
+ #ifdef __VEC__
36
+ #include <vecintrin.h>
37
+ #endif
38
+
39
+ #endif /* __S390INTRIN_H*/
@@ -0,0 +1,66 @@
1
+ //===-- allocator_interface.h ---------------------------------------------===//
2
+ //
3
+ // The LLVM Compiler Infrastructure
4
+ //
5
+ // This file is distributed under the University of Illinois Open Source
6
+ // License. See LICENSE.TXT for details.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+ //
10
+ // Public interface header for allocator used in sanitizers (ASan/TSan/MSan).
11
+ //===----------------------------------------------------------------------===//
12
+ #ifndef SANITIZER_ALLOCATOR_INTERFACE_H
13
+ #define SANITIZER_ALLOCATOR_INTERFACE_H
14
+
15
+ #include <stddef.h>
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+ /* Returns the estimated number of bytes that will be reserved by allocator
21
+ for request of "size" bytes. If allocator can't allocate that much
22
+ memory, returns the maximal possible allocation size, otherwise returns
23
+ "size". */
24
+ size_t __sanitizer_get_estimated_allocated_size(size_t size);
25
+
26
+ /* Returns true if p was returned by the allocator and
27
+ is not yet freed. */
28
+ int __sanitizer_get_ownership(const volatile void *p);
29
+
30
+ /* Returns the number of bytes reserved for the pointer p.
31
+ Requires (get_ownership(p) == true) or (p == 0). */
32
+ size_t __sanitizer_get_allocated_size(const volatile void *p);
33
+
34
+ /* Number of bytes, allocated and not yet freed by the application. */
35
+ size_t __sanitizer_get_current_allocated_bytes();
36
+
37
+ /* Number of bytes, mmaped by the allocator to fulfill allocation requests.
38
+ Generally, for request of X bytes, allocator can reserve and add to free
39
+ lists a large number of chunks of size X to use them for future requests.
40
+ All these chunks count toward the heap size. Currently, allocator never
41
+ releases memory to OS (instead, it just puts freed chunks to free
42
+ lists). */
43
+ size_t __sanitizer_get_heap_size();
44
+
45
+ /* Number of bytes, mmaped by the allocator, which can be used to fulfill
46
+ allocation requests. When a user program frees memory chunk, it can first
47
+ fall into quarantine and will count toward __sanitizer_get_free_bytes()
48
+ later. */
49
+ size_t __sanitizer_get_free_bytes();
50
+
51
+ /* Number of bytes in unmapped pages, that are released to OS. Currently,
52
+ always returns 0. */
53
+ size_t __sanitizer_get_unmapped_bytes();
54
+
55
+ /* Malloc hooks that may be optionally provided by user.
56
+ __sanitizer_malloc_hook(ptr, size) is called immediately after
57
+ allocation of "size" bytes, which returned "ptr".
58
+ __sanitizer_free_hook(ptr) is called immediately before
59
+ deallocation of "ptr". */
60
+ void __sanitizer_malloc_hook(const volatile void *ptr, size_t size);
61
+ void __sanitizer_free_hook(const volatile void *ptr);
62
+ #ifdef __cplusplus
63
+ } // extern "C"
64
+ #endif
65
+
66
+ #endif
@@ -0,0 +1,155 @@
1
+ //===-- sanitizer/asan_interface.h ------------------------------*- C++ -*-===//
2
+ //
3
+ // The LLVM Compiler Infrastructure
4
+ //
5
+ // This file is distributed under the University of Illinois Open Source
6
+ // License. See LICENSE.TXT for details.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+ //
10
+ // This file is a part of AddressSanitizer.
11
+ //
12
+ // Public interface header.
13
+ //===----------------------------------------------------------------------===//
14
+ #ifndef SANITIZER_ASAN_INTERFACE_H
15
+ #define SANITIZER_ASAN_INTERFACE_H
16
+
17
+ #include <sanitizer/common_interface_defs.h>
18
+
19
+ #ifdef __cplusplus
20
+ extern "C" {
21
+ #endif
22
+ // Marks memory region [addr, addr+size) as unaddressable.
23
+ // This memory must be previously allocated by the user program. Accessing
24
+ // addresses in this region from instrumented code is forbidden until
25
+ // this region is unpoisoned. This function is not guaranteed to poison
26
+ // the whole region - it may poison only subregion of [addr, addr+size) due
27
+ // to ASan alignment restrictions.
28
+ // Method is NOT thread-safe in the sense that no two threads can
29
+ // (un)poison memory in the same memory region simultaneously.
30
+ void __asan_poison_memory_region(void const volatile *addr, size_t size);
31
+ // Marks memory region [addr, addr+size) as addressable.
32
+ // This memory must be previously allocated by the user program. Accessing
33
+ // addresses in this region is allowed until this region is poisoned again.
34
+ // This function may unpoison a superregion of [addr, addr+size) due to
35
+ // ASan alignment restrictions.
36
+ // Method is NOT thread-safe in the sense that no two threads can
37
+ // (un)poison memory in the same memory region simultaneously.
38
+ void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
39
+
40
+ // User code should use macros instead of functions.
41
+ #if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
42
+ #define ASAN_POISON_MEMORY_REGION(addr, size) \
43
+ __asan_poison_memory_region((addr), (size))
44
+ #define ASAN_UNPOISON_MEMORY_REGION(addr, size) \
45
+ __asan_unpoison_memory_region((addr), (size))
46
+ #else
47
+ #define ASAN_POISON_MEMORY_REGION(addr, size) \
48
+ ((void)(addr), (void)(size))
49
+ #define ASAN_UNPOISON_MEMORY_REGION(addr, size) \
50
+ ((void)(addr), (void)(size))
51
+ #endif
52
+
53
+ // Returns 1 if addr is poisoned (i.e. 1-byte read/write access to this
54
+ // address will result in error report from AddressSanitizer).
55
+ // Otherwise returns 0.
56
+ int __asan_address_is_poisoned(void const volatile *addr);
57
+
58
+ // If at least one byte in [beg, beg+size) is poisoned, return the address
59
+ // of the first such byte. Otherwise return 0.
60
+ void *__asan_region_is_poisoned(void *beg, size_t size);
61
+
62
+ // Print the description of addr (useful when debugging in gdb).
63
+ void __asan_describe_address(void *addr);
64
+
65
+ // Useful for calling from a debugger to get information about an ASan error.
66
+ // Returns 1 if an error has been (or is being) reported, otherwise returns 0.
67
+ int __asan_report_present();
68
+
69
+ // Useful for calling from a debugger to get information about an ASan error.
70
+ // If an error has been (or is being) reported, the following functions return
71
+ // the pc, bp, sp, address, access type (0 = read, 1 = write), access size and
72
+ // bug description (e.g. "heap-use-after-free"). Otherwise they return 0.
73
+ void *__asan_get_report_pc();
74
+ void *__asan_get_report_bp();
75
+ void *__asan_get_report_sp();
76
+ void *__asan_get_report_address();
77
+ int __asan_get_report_access_type();
78
+ size_t __asan_get_report_access_size();
79
+ const char *__asan_get_report_description();
80
+
81
+ // Useful for calling from the debugger to get information about a pointer.
82
+ // Returns the category of the given pointer as a constant string.
83
+ // Possible return values are "global", "stack", "stack-fake", "heap",
84
+ // "heap-invalid", "shadow-low", "shadow-gap", "shadow-high", "unknown".
85
+ // If global or stack, tries to also return the variable name, address and
86
+ // size. If heap, tries to return the chunk address and size. 'name' should
87
+ // point to an allocated buffer of size 'name_size'.
88
+ const char *__asan_locate_address(void *addr, char *name, size_t name_size,
89
+ void **region_address, size_t *region_size);
90
+
91
+ // Useful for calling from the debugger to get the allocation stack trace
92
+ // and thread ID for a heap address. Stores up to 'size' frames into 'trace',
93
+ // returns the number of stored frames or 0 on error.
94
+ size_t __asan_get_alloc_stack(void *addr, void **trace, size_t size,
95
+ int *thread_id);
96
+
97
+ // Useful for calling from the debugger to get the free stack trace
98
+ // and thread ID for a heap address. Stores up to 'size' frames into 'trace',
99
+ // returns the number of stored frames or 0 on error.
100
+ size_t __asan_get_free_stack(void *addr, void **trace, size_t size,
101
+ int *thread_id);
102
+
103
+ // Useful for calling from the debugger to get the current shadow memory
104
+ // mapping.
105
+ void __asan_get_shadow_mapping(size_t *shadow_scale, size_t *shadow_offset);
106
+
107
+ // This is an internal function that is called to report an error.
108
+ // However it is still a part of the interface because users may want to
109
+ // set a breakpoint on this function in a debugger.
110
+ void __asan_report_error(void *pc, void *bp, void *sp,
111
+ void *addr, int is_write, size_t access_size);
112
+
113
+ // Sets the exit code to use when reporting an error.
114
+ // Returns the old value.
115
+ int __asan_set_error_exit_code(int exit_code);
116
+
117
+ // Deprecated. Call __sanitizer_set_death_callback instead.
118
+ void __asan_set_death_callback(void (*callback)(void));
119
+
120
+ void __asan_set_error_report_callback(void (*callback)(const char*));
121
+
122
+ // User may provide function that would be called right when ASan detects
123
+ // an error. This can be used to notice cases when ASan detects an error, but
124
+ // the program crashes before ASan report is printed.
125
+ void __asan_on_error();
126
+
127
+ // Prints accumulated stats to stderr. Used for debugging.
128
+ void __asan_print_accumulated_stats();
129
+
130
+ // This function may be optionally provided by user and should return
131
+ // a string containing ASan runtime options. See asan_flags.h for details.
132
+ const char* __asan_default_options();
133
+
134
+ // The following 2 functions facilitate garbage collection in presence of
135
+ // asan's fake stack.
136
+
137
+ // Returns an opaque handler to be used later in __asan_addr_is_in_fake_stack.
138
+ // Returns NULL if the current thread does not have a fake stack.
139
+ void *__asan_get_current_fake_stack();
140
+
141
+ // If fake_stack is non-NULL and addr belongs to a fake frame in
142
+ // fake_stack, returns the address on real stack that corresponds to
143
+ // the fake frame and sets beg/end to the boundaries of this fake frame.
144
+ // Otherwise returns NULL and does not touch beg/end.
145
+ // If beg/end are NULL, they are not touched.
146
+ // This function may be called from a thread other than the owner of
147
+ // fake_stack, but the owner thread need to be alive.
148
+ void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg,
149
+ void **end);
150
+
151
+ #ifdef __cplusplus
152
+ } // extern "C"
153
+ #endif
154
+
155
+ #endif // SANITIZER_ASAN_INTERFACE_H
@@ -0,0 +1,118 @@
1
+ //===-- sanitizer/common_interface_defs.h -----------------------*- C++ -*-===//
2
+ //
3
+ // The LLVM Compiler Infrastructure
4
+ //
5
+ // This file is distributed under the University of Illinois Open Source
6
+ // License. See LICENSE.TXT for details.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+ //
10
+ // Common part of the public sanitizer interface.
11
+ //===----------------------------------------------------------------------===//
12
+
13
+ #ifndef SANITIZER_COMMON_INTERFACE_DEFS_H
14
+ #define SANITIZER_COMMON_INTERFACE_DEFS_H
15
+
16
+ #include <stddef.h>
17
+ #include <stdint.h>
18
+
19
+ // GCC does not understand __has_feature.
20
+ #if !defined(__has_feature)
21
+ # define __has_feature(x) 0
22
+ #endif
23
+
24
+ #ifdef __cplusplus
25
+ extern "C" {
26
+ #endif
27
+ // Arguments for __sanitizer_sandbox_on_notify() below.
28
+ typedef struct {
29
+ // Enable sandbox support in sanitizer coverage.
30
+ int coverage_sandboxed;
31
+ // File descriptor to write coverage data to. If -1 is passed, a file will
32
+ // be pre-opened by __sanitizer_sandobx_on_notify(). This field has no
33
+ // effect if coverage_sandboxed == 0.
34
+ intptr_t coverage_fd;
35
+ // If non-zero, split the coverage data into well-formed blocks. This is
36
+ // useful when coverage_fd is a socket descriptor. Each block will contain
37
+ // a header, allowing data from multiple processes to be sent over the same
38
+ // socket.
39
+ unsigned int coverage_max_block_size;
40
+ } __sanitizer_sandbox_arguments;
41
+
42
+ // Tell the tools to write their reports to "path.<pid>" instead of stderr.
43
+ void __sanitizer_set_report_path(const char *path);
44
+
45
+ // Notify the tools that the sandbox is going to be turned on. The reserved
46
+ // parameter will be used in the future to hold a structure with functions
47
+ // that the tools may call to bypass the sandbox.
48
+ void __sanitizer_sandbox_on_notify(__sanitizer_sandbox_arguments *args);
49
+
50
+ // This function is called by the tool when it has just finished reporting
51
+ // an error. 'error_summary' is a one-line string that summarizes
52
+ // the error message. This function can be overridden by the client.
53
+ void __sanitizer_report_error_summary(const char *error_summary);
54
+
55
+ // Some of the sanitizers (e.g. asan/tsan) may miss bugs that happen
56
+ // in unaligned loads/stores. In order to find such bugs reliably one needs
57
+ // to replace plain unaligned loads/stores with these calls.
58
+ uint16_t __sanitizer_unaligned_load16(const void *p);
59
+ uint32_t __sanitizer_unaligned_load32(const void *p);
60
+ uint64_t __sanitizer_unaligned_load64(const void *p);
61
+ void __sanitizer_unaligned_store16(void *p, uint16_t x);
62
+ void __sanitizer_unaligned_store32(void *p, uint32_t x);
63
+ void __sanitizer_unaligned_store64(void *p, uint64_t x);
64
+
65
+ // Annotate the current state of a contiguous container, such as
66
+ // std::vector, std::string or similar.
67
+ // A contiguous container is a container that keeps all of its elements
68
+ // in a contiguous region of memory. The container owns the region of memory
69
+ // [beg, end); the memory [beg, mid) is used to store the current elements
70
+ // and the memory [mid, end) is reserved for future elements;
71
+ // beg <= mid <= end. For example, in "std::vector<> v"
72
+ // beg = &v[0];
73
+ // end = beg + v.capacity() * sizeof(v[0]);
74
+ // mid = beg + v.size() * sizeof(v[0]);
75
+ //
76
+ // This annotation tells the Sanitizer tool about the current state of the
77
+ // container so that the tool can report errors when memory from [mid, end)
78
+ // is accessed. Insert this annotation into methods like push_back/pop_back.
79
+ // Supply the old and the new values of mid (old_mid/new_mid).
80
+ // In the initial state mid == end and so should be the final
81
+ // state when the container is destroyed or when it reallocates the storage.
82
+ //
83
+ // Use with caution and don't use for anything other than vector-like classes.
84
+ //
85
+ // For AddressSanitizer, 'beg' should be 8-aligned and 'end' should
86
+ // be either 8-aligned or it should point to the end of a separate heap-,
87
+ // stack-, or global- allocated buffer. I.e. the following will not work:
88
+ // int64_t x[2]; // 16 bytes, 8-aligned.
89
+ // char *beg = (char *)&x[0];
90
+ // char *end = beg + 12; // Not 8 aligned, not the end of the buffer.
91
+ // This however will work fine:
92
+ // int32_t x[3]; // 12 bytes, but 8-aligned under AddressSanitizer.
93
+ // char *beg = (char*)&x[0];
94
+ // char *end = beg + 12; // Not 8-aligned, but is the end of the buffer.
95
+ void __sanitizer_annotate_contiguous_container(const void *beg,
96
+ const void *end,
97
+ const void *old_mid,
98
+ const void *new_mid);
99
+ // Returns true if the contiguous container [beg, end) is properly poisoned
100
+ // (e.g. with __sanitizer_annotate_contiguous_container), i.e. if
101
+ // - [beg, mid) is addressable,
102
+ // - [mid, end) is unaddressable.
103
+ // Full verification requires O(end-beg) time; this function tries to avoid
104
+ // such complexity by touching only parts of the container around beg/mid/end.
105
+ int __sanitizer_verify_contiguous_container(const void *beg, const void *mid,
106
+ const void *end);
107
+
108
+ // Print the stack trace leading to this call. Useful for debugging user code.
109
+ void __sanitizer_print_stack_trace();
110
+
111
+ // Sets the callback to be called right before death on error.
112
+ // Passing 0 will unset the callback.
113
+ void __sanitizer_set_death_callback(void (*callback)(void));
114
+ #ifdef __cplusplus
115
+ } // extern "C"
116
+ #endif
117
+
118
+ #endif // SANITIZER_COMMON_INTERFACE_DEFS_H
@@ -0,0 +1,63 @@
1
+ //===-- sanitizer/coverage_interface.h --------------------------*- C++ -*-===//
2
+ //
3
+ // The LLVM Compiler Infrastructure
4
+ //
5
+ // This file is distributed under the University of Illinois Open Source
6
+ // License. See LICENSE.TXT for details.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+ //
10
+ // Public interface for sanitizer coverage.
11
+ //===----------------------------------------------------------------------===//
12
+
13
+ #ifndef SANITIZER_COVERAG_INTERFACE_H
14
+ #define SANITIZER_COVERAG_INTERFACE_H
15
+
16
+ #include <sanitizer/common_interface_defs.h>
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ // Initialize coverage.
23
+ void __sanitizer_cov_init();
24
+ // Record and dump coverage info.
25
+ void __sanitizer_cov_dump();
26
+ // Open <name>.sancov.packed in the coverage directory and return the file
27
+ // descriptor. Returns -1 on failure, or if coverage dumping is disabled.
28
+ // This is intended for use by sandboxing code.
29
+ intptr_t __sanitizer_maybe_open_cov_file(const char *name);
30
+ // Get the number of total unique covered entities (blocks, edges, calls).
31
+ // This can be useful for coverage-directed in-process fuzzers.
32
+ uintptr_t __sanitizer_get_total_unique_coverage();
33
+
34
+ // Reset the basic-block (edge) coverage to the initial state.
35
+ // Useful for in-process fuzzing to start collecting coverage from scratch.
36
+ // Experimental, will likely not work for multi-threaded process.
37
+ void __sanitizer_reset_coverage();
38
+ // Set *data to the array of covered PCs and return the size of that array.
39
+ // Some of the entries in *data will be zero.
40
+ uintptr_t __sanitizer_get_coverage_guards(uintptr_t **data);
41
+
42
+ // The coverage instrumentation may optionally provide imprecise counters.
43
+ // Rather than exposing the counter values to the user we instead map
44
+ // the counters to a bitset.
45
+ // Every counter is associated with 8 bits in the bitset.
46
+ // We define 8 value ranges: 1, 2, 3, 4-7, 8-15, 16-31, 32-127, 128+
47
+ // The i-th bit is set to 1 if the counter value is in the i-th range.
48
+ // This counter-based coverage implementation is *not* thread-safe.
49
+
50
+ // Returns the number of registered coverage counters.
51
+ uintptr_t __sanitizer_get_number_of_counters();
52
+ // Updates the counter 'bitset', clears the counters and returns the number of
53
+ // new bits in 'bitset'.
54
+ // If 'bitset' is nullptr, only clears the counters.
55
+ // Otherwise 'bitset' should be at least
56
+ // __sanitizer_get_number_of_counters bytes long and 8-aligned.
57
+ uintptr_t
58
+ __sanitizer_update_counter_bitset_and_clear_counters(uint8_t *bitset);
59
+ #ifdef __cplusplus
60
+ } // extern "C"
61
+ #endif
62
+
63
+ #endif // SANITIZER_COVERAG_INTERFACE_H