Files
revng-revng/include/revng/Support/ProgramRunner.h
Giacomo Vercesi 042108bc44 ProgramRunner: cleanup
Clean up the `ProgramRunner` class:
* use llvm-provided wrappers and system-agnostic variables to compute
  the `Paths` variable
* pre-compute the list of path variables so it's not re-computed on
  every invocation of `run` or `isProgramAvailable`
* Wrap the logging code so that it's not triggered if the logger is
  disabled
2025-03-13 16:23:21 +01:00

30 lines
668 B
C++

#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include <string>
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
class ProgramRunner {
private:
llvm::SmallVector<std::string, 64> Paths;
llvm::SmallVector<llvm::StringRef, 64> PathsRef;
public:
ProgramRunner();
/// Returns true if the program could be found.
bool isProgramAvailable(llvm::StringRef ProgramName);
/// returns the exit code of the program.
[[nodiscard]] int run(llvm::StringRef ProgramName,
llvm::ArrayRef<std::string> Args);
};
extern ProgramRunner Runner;