| 281 | } |
| 282 | |
| 283 | bool UTModify::generateHeader(const std::string &BasePath) { |
| 284 | const std::string CheckerMacro = "AUTOFUZZ"; |
| 285 | const std::string HeaderGuard = CheckerMacro + "_H"; |
| 286 | const std::string ExceptionName = "AutofuzzException"; |
| 287 | const std::string Content = |
| 288 | "#ifndef " + HeaderGuard + |
| 289 | "\n" |
| 290 | "#define " + |
| 291 | HeaderGuard + |
| 292 | "\n\n" |
| 293 | "#ifndef " + |
| 294 | CheckerMacro + |
| 295 | "\n" |
| 296 | "#error " + |
| 297 | CheckerMacro + |
| 298 | " is not defined. Do not include this header " |
| 299 | "without " + |
| 300 | CheckerMacro + |
| 301 | " Definition.\n" |
| 302 | "#endif // " + |
| 303 | CheckerMacro + |
| 304 | "\n\n" |
| 305 | "#ifndef " + |
| 306 | FilePathPrefix + |
| 307 | "\n" |
| 308 | "#define " + |
| 309 | FilePathPrefix + |
| 310 | " \"\"\n" |
| 311 | "#endif // " + |
| 312 | FilePathPrefix + |
| 313 | "\n\n" |
| 314 | "#ifdef __cplusplus\n" |
| 315 | "#include <exception>\n" |
| 316 | "#include <ostream>\n" |
| 317 | "#include <string>\n\n" |
| 318 | "struct " + |
| 319 | ExceptionName + " : public std::exception {\n" + util::getIndent(1) + |
| 320 | ExceptionName + "(const std::string Src) {}\n" + util::getIndent(1) + |
| 321 | "template <typename T>\n" + util::getIndent(1) + ExceptionName + |
| 322 | " &operator<<(const T Rhs) { " + "return *this; }\n" + |
| 323 | util::getIndent(1) + ExceptionName + " &operator<<(" + |
| 324 | "std::ostream& (&Src)(std::ostream&)) { return *this; }\n" |
| 325 | "};\n\n" |
| 326 | "#undef GTEST_PRED_FORMAT2_\n" |
| 327 | "#define THROW_AUTOFUZZ_EXCEPTION(Msg) throw " + |
| 328 | ExceptionName + |
| 329 | "(Msg)\n" |
| 330 | "#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure) \\\n" + |
| 331 | util::getIndent(1) + "GTEST_ASSERT_(\\\n" + util::getIndent(2) + |
| 332 | "pred_format(#v1, #v2, v1, v2), " |
| 333 | "THROW_AUTOFUZZ_EXCEPTION)\n\n" |
| 334 | "extern \"C\" {\n" |
| 335 | "#endif // __cplusplus\n" |
| 336 | "void " + |
| 337 | UTEntryFuncName + |
| 338 | "();\n" |
| 339 | "#ifdef __cplusplus\n" |
| 340 | "}\n" |
nothing calls this directly
no test coverage detected