File tree Expand file tree Collapse file tree 3 files changed +18
-17
lines changed Expand file tree Collapse file tree 3 files changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -38,25 +38,12 @@ let libclang: ReturnType<
3838> ;
3939
4040if ( Deno . build . os === "windows" ) {
41- /**
42- * Windows DLL does not have error handler related symbols.
43- * Windows DLL from `choco install --version 14.0.6 llvm`
44- * md5 59beb52cef40898b0f24cdffc6cf2984
45- * `dumpbin /exports libclang.dll`
46- */
47- const IMPORTS_WIN = Object . fromEntries (
48- Object . entries ( IMPORTS ) . filter ( ( [ symbol ] : [ string , unknown ] ) =>
49- symbol !== "clang_install_aborting_llvm_fatal_error_handler" &&
50- symbol !== "clang_uninstall_llvm_fatal_error_handler"
51- ) ,
52- ) as ClangSymbols ;
53-
5441 if ( libclangPath . includes ( ".dll" ) ) {
55- libclang = Deno . dlopen ( libclangPath , IMPORTS_WIN ) ;
42+ libclang = Deno . dlopen ( libclangPath , IMPORTS ) ;
5643 } else {
5744 libclang = Deno . dlopen (
5845 join ( libclangPath , "libclang.dll" ) ,
59- IMPORTS_WIN ,
46+ IMPORTS ,
6047 ) ;
6148 }
6249} else if ( Deno . build . os === "darwin" ) {
Original file line number Diff line number Diff line change 55export const clang_install_aborting_llvm_fatal_error_handler = {
66 parameters : [ ] ,
77 result : "void" ,
8+ optional : true ,
89} as const ;
910
1011/**
@@ -15,4 +16,5 @@ export const clang_install_aborting_llvm_fatal_error_handler = {
1516export const clang_uninstall_llvm_fatal_error_handler = {
1617 parameters : [ ] ,
1718 result : "void" ,
19+ optional : true ,
1820} as const ;
Original file line number Diff line number Diff line change @@ -219,9 +219,21 @@ export const setAbortOnFatalError = (
219219 throw new Error ( "'setAbortOnFatalError' API is not supported on Windows" ) ;
220220 }
221221 if ( value ) {
222- libclang . symbols . clang_install_aborting_llvm_fatal_error_handler ( ) ;
222+ const fn = libclang . symbols . clang_install_aborting_llvm_fatal_error_handler ;
223+ if ( typeof fn !== "function" ) {
224+ throw new Error (
225+ `${ getClangVersion ( ) } does not contain symbol 'clang_install_aborting_llvm_fatal_error_handler'` ,
226+ ) ;
227+ }
228+ fn ( ) ;
223229 } else {
224- libclang . symbols . clang_uninstall_llvm_fatal_error_handler ( ) ;
230+ const fn = libclang . symbols . clang_uninstall_llvm_fatal_error_handler ;
231+ if ( typeof fn !== "function" ) {
232+ throw new Error (
233+ `${ getClangVersion ( ) } does not contain symbol 'clang_uninstall_llvm_fatal_error_handler'` ,
234+ ) ;
235+ }
236+ fn ( ) ;
225237 }
226238} ;
227239
You can’t perform that action at this time.
0 commit comments