diff --git a/tools/detect-parsers/ParserSourceDetector.cpp b/tools/detect-parsers/ParserSourceDetector.cpp index de1d6479e8..5d59aed6e3 100644 --- a/tools/detect-parsers/ParserSourceDetector.cpp +++ b/tools/detect-parsers/ParserSourceDetector.cpp @@ -1,9 +1,10 @@ // Copyright (c) 2021-present, Trail of Bits, Inc. -#include "SarifPasses.hpp" +#ifdef VAST_ENABLE_SARIF + #include "SarifPasses.hpp" -#include "vast/Dialect/Parser/Ops.hpp" -#include "vast/Frontend/Sarif.hpp" + #include "vast/Dialect/Parser/Ops.hpp" + #include "vast/Frontend/Sarif.hpp" namespace vast { void ParserSourceDetector::runOnOperation() { @@ -27,3 +28,4 @@ namespace vast { }); } } // namespace vast +#endif diff --git a/tools/detect-parsers/SarifPasses.hpp b/tools/detect-parsers/SarifPasses.hpp index adaabd46e9..00efb04d1d 100644 --- a/tools/detect-parsers/SarifPasses.hpp +++ b/tools/detect-parsers/SarifPasses.hpp @@ -2,15 +2,16 @@ #pragma once -#include "vast/Util/Warnings.hpp" +#ifdef VAST_ENABLE_SARIF + #include "vast/Util/Warnings.hpp" VAST_RELAX_WARNINGS -#include -#include -#include + #include + #include + #include VAST_UNRELAX_WARNINGS -#include + #include namespace vast { struct ParserSourceDetector @@ -23,3 +24,4 @@ namespace vast { void runOnOperation() override; }; } // namespace vast +#endif diff --git a/tools/detect-parsers/main.cpp b/tools/detect-parsers/main.cpp index 1cca8a80ca..053a16f27e 100644 --- a/tools/detect-parsers/main.cpp +++ b/tools/detect-parsers/main.cpp @@ -23,9 +23,9 @@ VAST_UNRELAX_WARNINGS #include "SarifPasses.hpp" namespace vast { - struct SarifWriter - : mlir::PassWrapper< - SarifWriter, mlir::OperationPass< mlir::ModuleOp > > + +#ifdef VAST_ENABLE_SARIF + struct SarifWriter : mlir::PassWrapper< SarifWriter, mlir::OperationPass< mlir::ModuleOp > > { std::vector< gap::sarif::result > results; std::string path; @@ -76,6 +76,10 @@ namespace vast { } ); } +#else + + void registerSarifPasses() {} +#endif } // namespace vast int main(int argc, char **argv) {