@@ -81,61 +81,6 @@ def __init__(self, compilation_database_path: Optional[Path] = None):
8181 if compilation_database_path :
8282 self .compilation_database = CompilationDatabase .fromDirectory (str (compilation_database_path ))
8383
84- @staticmethod
85- def __find_libclang (self ) -> str :
86- """
87- Find libclang library on the system. This function detects the operating system
88- and searches in platform-specific locations.
89-
90- Returns:
91- str: Path to the libclang library
92-
93- Raises:
94- RuntimeError: If libclang cannot be found in any of the expected locations
95- """
96- system = platform .system ()
97-
98- if system == "Darwin" : # macOS
99- possible_paths = [
100- # Apple Silicon Mac paths
101- "/opt/homebrew/opt/llvm/lib/libclang.dylib" ,
102- # Intel Mac paths
103- "/usr/local/opt/llvm/lib/libclang.dylib" ,
104- # Xcode path
105- "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib" ,
106- ]
107- install_instructions = (
108- "Could not find libclang. Please install LLVM using Homebrew:\n "
109- " 1. Run: brew install llvm\n "
110- " 2. Make sure the installation succeeded\n "
111- " 3. You might need to restart your terminal"
112- )
113- elif system == "Linux" :
114- possible_paths = [
115- # Common Linux paths for different LLVM versions
116- "/usr/lib/llvm-14/lib/libclang.so" ,
117- "/usr/lib/llvm-13/lib/libclang.so" ,
118- "/usr/lib/llvm-12/lib/libclang.so" ,
119- "/usr/lib/x86_64-linux-gnu/libclang-14.so.1" ,
120- "/usr/lib/libclang.so" ,
121- ]
122- install_instructions = (
123- "Could not find libclang. Please install LLVM development libraries:\n "
124- " Ubuntu/Debian: sudo apt-get install libclang-dev\n "
125- " Fedora: sudo dnf install clang-devel\n "
126- " Arch Linux: sudo pacman -S clang"
127- )
128- else :
129- raise RuntimeError (f"Unsupported operating system: { system } " )
130-
131- # Try to find the library in the possible locations
132- for path in possible_paths :
133- if os .path .exists (path ):
134- logger .info (f"Found libclang at: { path } " )
135- return path
136-
137- raise RuntimeError (install_instructions )
138-
13984 def analyze_file (self , file_path : Path ) -> CTranslationUnit :
14085 """Analyzes a single C source file using Clang."""
14186
0 commit comments