|
| 1 | +/*===----------------------- SwiftCompilerSupport.h -------------------------=== |
| 2 | +
|
| 3 | + This source file is part of the Swift.org open source project |
| 4 | +
|
| 5 | + Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors |
| 6 | + Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | +
|
| 8 | + See https://swift.org/LICENSE.txt for license information |
| 9 | + See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 10 | +
|
| 11 | + ===----------------------------------------------------------------------===*/ |
| 12 | +#ifndef SWIFT_COMPILER_SUPPORT_H |
| 13 | +#define SWIFT_COMPILER_SUPPORT_H |
| 14 | + |
| 15 | +#include <stddef.h> |
| 16 | + |
| 17 | +#ifdef __cplusplus |
| 18 | +extern "C" { |
| 19 | +#endif |
| 20 | + |
| 21 | +/// Flags used to describe consistency checks that can be performed by |
| 22 | +/// the |
| 23 | +enum SwiftConsistencyCheckFlags { |
| 24 | + /// Ensure that the syntax tree produced by the parser fully reproduces the |
| 25 | + /// input source. |
| 26 | + SCC_RoundTrip = 0x01, |
| 27 | + |
| 28 | + /// Check for the presence of parsing diagnostics. |
| 29 | + SCC_ParseDiagnostics = 0x02, |
| 30 | + |
| 31 | + /// Perform sequence folding on the syntax tree. |
| 32 | + SCC_FoldSequences = 0x04, |
| 33 | +}; |
| 34 | + |
| 35 | +/// Entry point for the Swift compiler to use for consistency checking. |
| 36 | +/// |
| 37 | +/// - Parameters: |
| 38 | +/// - bufferPtr: Pointer to the input buffer. |
| 39 | +/// - bufferLength: Length of the input buffer. |
| 40 | +/// - filename: The name of the source file, which is used only for diagnostics |
| 41 | +/// - flags: Flags that indicate what checks should be performed. |
| 42 | +/// 0x01: Perform round-trip checking. |
| 43 | +/// - Returns: 0 if all requested consistency checks passed, nonzero otherwise. |
| 44 | +int swift_parser_consistencyCheck( |
| 45 | + const char *buffer, ptrdiff_t bufferLength, const char *filename, |
| 46 | + unsigned int flags); |
| 47 | + |
| 48 | +#ifdef __cplusplus |
| 49 | +} |
| 50 | +#endif |
| 51 | + |
| 52 | +#endif /* SWIFT_COMPILER_SUPPORT_H */ |
0 commit comments