Rewrite.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. /*===-- clang-c/Rewrite.h - C CXRewriter --------------------------*- C -*-===*\
  7. |* *|
  8. |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
  9. |* Exceptions. *|
  10. |* See https://llvm.org/LICENSE.txt for license information. *|
  11. |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
  12. |* *|
  13. |*===----------------------------------------------------------------------===*/
  14. #ifndef LLVM_CLANG_C_REWRITE_H
  15. #define LLVM_CLANG_C_REWRITE_H
  16. #include "clang-c/CXString.h"
  17. #include "clang-c/ExternC.h"
  18. #include "clang-c/Index.h"
  19. #include "clang-c/Platform.h"
  20. LLVM_CLANG_C_EXTERN_C_BEGIN
  21. typedef void *CXRewriter;
  22. /**
  23. * Create CXRewriter.
  24. */
  25. CINDEX_LINKAGE CXRewriter clang_CXRewriter_create(CXTranslationUnit TU);
  26. /**
  27. * Insert the specified string at the specified location in the original buffer.
  28. */
  29. CINDEX_LINKAGE void clang_CXRewriter_insertTextBefore(CXRewriter Rew, CXSourceLocation Loc,
  30. const char *Insert);
  31. /**
  32. * Replace the specified range of characters in the input with the specified
  33. * replacement.
  34. */
  35. CINDEX_LINKAGE void clang_CXRewriter_replaceText(CXRewriter Rew, CXSourceRange ToBeReplaced,
  36. const char *Replacement);
  37. /**
  38. * Remove the specified range.
  39. */
  40. CINDEX_LINKAGE void clang_CXRewriter_removeText(CXRewriter Rew, CXSourceRange ToBeRemoved);
  41. /**
  42. * Save all changed files to disk.
  43. * Returns 1 if any files were not saved successfully, returns 0 otherwise.
  44. */
  45. CINDEX_LINKAGE int clang_CXRewriter_overwriteChangedFiles(CXRewriter Rew);
  46. /**
  47. * Write out rewritten version of the main file to stdout.
  48. */
  49. CINDEX_LINKAGE void clang_CXRewriter_writeMainFileToStdOut(CXRewriter Rew);
  50. /**
  51. * Free the given CXRewriter.
  52. */
  53. CINDEX_LINKAGE void clang_CXRewriter_dispose(CXRewriter Rew);
  54. LLVM_CLANG_C_EXTERN_C_END
  55. #endif
  56. #ifdef __GNUC__
  57. #pragma GCC diagnostic pop
  58. #endif