#!/usr/bin/env python3 """ Clang compiler implementation. While Clang is compatible with GCC, this provides a dedicated implementation for cases where Clang-specific features or flags are needed. """ from pathlib import Path from typing import List, Optional from .gcc import GCCCompiler class ClangCompiler(GCCCompiler): """Clang compiler implementation (inherits from GCC).""" def __init__(self, executable: str = "clang"): """ Initialize Clang compiler. Args: executable: Compiler executable name ("clang") """ # Call parent constructor but override the name super().__init__(executable) self.name = "Clang" def get_version(self) -> Optional[str]: """ Get the Clang version string. Returns: Version string if available, None otherwise """ from build_system.utils import run_quiet try: result = run_quiet([self.executable, "--version"], check=False) if result.returncode == 0 and result.stdout: # Parse first line of version output first_line = result.stdout.strip().split('\n')[0] return first_line except Exception: pass return None