================
@@ -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:

Ah, OK. Some more comments might be helpful - like "if the failure is 
unexpected, return true, allowing the test to run and fail so developers can 
see the failure" or something like that?

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