Rewrite.odin (2434B)
1 /*===-- clang-c/Rewrite.h - C CXRewriter --------------------------*- 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 package libclang 10 11 import "core:c" 12 13 _ :: c 14 15 when ODIN_OS == .Windows { 16 @(extra_linker_flags="/NODEFAULTLIB:libcmt") 17 foreign import lib { 18 "system:ntdll.lib", 19 "system:ucrt.lib", 20 "system:msvcrt.lib", 21 "system:legacy_stdio_definitions.lib", 22 "system:kernel32.lib", 23 "system:user32.lib", 24 "system:advapi32.lib", 25 "system:shell32.lib", 26 "system:ole32.lib", 27 "system:oleaut32.lib", 28 "system:uuid.lib", 29 "system:ws2_32.lib", 30 "system:version.lib", 31 "system:oldnames.lib", 32 "libclang.lib", 33 } 34 } else { 35 foreign import lib "system:clang" 36 } 37 38 // LLVM_CLANG_C_REWRITE_H :: 39 40 Rewriter :: rawptr 41 42 @(default_calling_convention="c", link_prefix="clang_") 43 foreign lib { 44 /** 45 * Create CXRewriter. 46 */ 47 CXRewriter_create :: proc(TU: Translation_Unit) -> Rewriter --- 48 49 /** 50 * Insert the specified string at the specified location in the original buffer. 51 */ 52 CXRewriter_insertTextBefore :: proc(Rew: Rewriter, Loc: Source_Location, Insert: cstring) --- 53 54 /** 55 * Replace the specified range of characters in the input with the specified 56 * replacement. 57 */ 58 CXRewriter_replaceText :: proc(Rew: Rewriter, ToBeReplaced: Source_Range, Replacement: cstring) --- 59 60 /** 61 * Remove the specified range. 62 */ 63 CXRewriter_removeText :: proc(Rew: Rewriter, ToBeRemoved: Source_Range) --- 64 65 /** 66 * Save all changed files to disk. 67 * Returns 1 if any files were not saved successfully, returns 0 otherwise. 68 */ 69 CXRewriter_overwriteChangedFiles :: proc(Rew: Rewriter) -> c.int --- 70 71 /** 72 * Write out rewritten version of the main file to stdout. 73 */ 74 CXRewriter_writeMainFileToStdOut :: proc(Rew: Rewriter) --- 75 76 /** 77 * Free the given CXRewriter. 78 */ 79 CXRewriter_dispose :: proc(Rew: Rewriter) --- 80 }