================
@@ -0,0 +1,22 @@
+def is_libclang_loadable():
+    try:
+        sys.path.append(os.path.join(config.clang_src_dir, "bindings/python"))
+        from clang.cindex import Config
+        conf = Config()
+        Config.set_library_path(config.clang_lib_dir)
+        conf.lib
+        return True
+    except Exception as e:
+        # Benign error modes.
+        if "wrong ELF class: ELFCLASS32" in str(e):
+            return False
+        elif "No such file or directory" in str(e):
+            return False
+        # Unknown error modes.
+        else:
+            return True
----------------
dwblaikie wrote:

This seems backwards - (either the implementation or the comment) if the error 
modes are benign, wouldn't that mean it's OK/libclang /is/ loadable?

(& also in general, I'd have thought we'd look for specific error modes we can 
recover from, and anything else means "no recovery" rather than assuming 
anything other than these bad ones are good?)

https://github.com/llvm/llvm-project/pull/142948
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to