CXFile.odin (3346B)
1 /*===-- clang-c/CXFile.h - C Index File ---------------------------*- C -*-===*\ 2 |* *| 3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| 4 |* Exceptions. *| 5 |* See https://llvm.org/LICENSE.txt for license information. *| 6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| 7 |* *| 8 |*===----------------------------------------------------------------------===*| 9 |* *| 10 |* This header provides the interface to C Index files. *| 11 |* *| 12 \*===----------------------------------------------------------------------===*/ 13 package libclang 14 15 import "core:c" 16 import "core:c/libc" 17 18 _ :: c 19 _ :: libc 20 21 when ODIN_OS == .Windows { 22 when !#exists("libclang.lib") { 23 #panic("Download libclang 20.1.8 from here: https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/clang+llvm-20.1.8-x86_64-pc-windows-msvc.tar.xz -- Copy the following from that archive:\n- `lib/libclang.lib` into the generator's 'libclang' folder\n- `bin/libclang.dll` into the root of the generator (next to where the bindgen executable will end up).") 24 } 25 26 @(extra_linker_flags="/NODEFAULTLIB:libcmt") 27 foreign import lib { 28 "system:ntdll.lib", 29 "system:ucrt.lib", 30 "system:msvcrt.lib", 31 "system:legacy_stdio_definitions.lib", 32 "system:kernel32.lib", 33 "system:user32.lib", 34 "system:advapi32.lib", 35 "system:shell32.lib", 36 "system:ole32.lib", 37 "system:oleaut32.lib", 38 "system:uuid.lib", 39 "system:ws2_32.lib", 40 "system:version.lib", 41 "system:oldnames.lib", 42 "libclang.lib", 43 } 44 } else { 45 foreign import lib "system:clang" 46 } 47 48 // LLVM_CLANG_C_CXFILE_H :: 49 50 /** 51 * A particular source file that is part of a translation unit. 52 */ 53 File :: rawptr 54 55 /** 56 * Uniquely identifies a CXFile, that refers to the same underlying file, 57 * across an indexing session. 58 */ 59 File_Unique_Id :: struct { 60 data: [3]c.ulonglong, 61 } 62 63 @(default_calling_convention="c", link_prefix="clang_") 64 foreign lib { 65 /** 66 * Retrieve the complete file and path name of the given file. 67 */ 68 getFileName :: proc(SFile: File) -> String --- 69 70 /** 71 * Retrieve the last modification time of the given file. 72 */ 73 getFileTime :: proc(SFile: File) -> libc.time_t --- 74 75 /** 76 * Retrieve the unique ID for the given \c file. 77 * 78 * \param file the file to get the ID for. 79 * \param outID stores the returned CXFileUniqueID. 80 * \returns If there was a failure getting the unique ID, returns non-zero, 81 * otherwise returns 0. 82 */ 83 getFileUniqueID :: proc(file: File, outID: ^File_Unique_Id) -> c.int --- 84 85 /** 86 * Returns non-zero if the \c file1 and \c file2 point to the same file, 87 * or they are both NULL. 88 */ 89 File_isEqual :: proc(file1: File, file2: File) -> c.int --- 90 91 /** 92 * Returns the real path name of \c file. 93 * 94 * An empty string may be returned. Use \c clang_getFileName() in that case. 95 */ 96 File_tryGetRealPathName :: proc(file: File) -> String --- 97 }