revive_llvm_builder/
llvm_project.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub enum LLVMProject {
6 CLANG,
8 LLD,
10 LLDB,
12 MLIR,
14}
15
16impl std::str::FromStr for LLVMProject {
17 type Err = String;
18
19 fn from_str(value: &str) -> Result<Self, Self::Err> {
20 match value.to_lowercase().as_str() {
21 "clang" => Ok(Self::CLANG),
22 "lld" => Ok(Self::LLD),
23 "lldb" => Ok(Self::LLDB),
24 "mlir" => Ok(Self::MLIR),
25 value => Err(format!("Unsupported LLVM project to enable: `{value}`")),
26 }
27 }
28}
29
30impl std::fmt::Display for LLVMProject {
31 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
32 match self {
33 Self::CLANG => write!(f, "clang"),
34 Self::LLD => write!(f, "lld"),
35 Self::LLDB => write!(f, "lldb"),
36 Self::MLIR => write!(f, "mlir"),
37 }
38 }
39}