1*29e0435aSJan Svoboda /*===-- clang-c/CXFile.h - C Index File ---------------------------*- C -*-===*\ 2*29e0435aSJan Svoboda |* *| 3*29e0435aSJan Svoboda |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| 4*29e0435aSJan Svoboda |* Exceptions. *| 5*29e0435aSJan Svoboda |* See https://llvm.org/LICENSE.txt for license information. *| 6*29e0435aSJan Svoboda |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| 7*29e0435aSJan Svoboda |* *| 8*29e0435aSJan Svoboda |*===----------------------------------------------------------------------===*| 9*29e0435aSJan Svoboda |* *| 10*29e0435aSJan Svoboda |* This header provides the interface to C Index files. *| 11*29e0435aSJan Svoboda |* *| 12*29e0435aSJan Svoboda \*===----------------------------------------------------------------------===*/ 13*29e0435aSJan Svoboda 14*29e0435aSJan Svoboda #ifndef LLVM_CLANG_C_CXFILE_H 15*29e0435aSJan Svoboda #define LLVM_CLANG_C_CXFILE_H 16*29e0435aSJan Svoboda 17*29e0435aSJan Svoboda #include <time.h> 18*29e0435aSJan Svoboda 19*29e0435aSJan Svoboda #include "clang-c/CXString.h" 20*29e0435aSJan Svoboda #include "clang-c/ExternC.h" 21*29e0435aSJan Svoboda #include "clang-c/Platform.h" 22*29e0435aSJan Svoboda 23*29e0435aSJan Svoboda LLVM_CLANG_C_EXTERN_C_BEGIN 24*29e0435aSJan Svoboda 25*29e0435aSJan Svoboda /** 26*29e0435aSJan Svoboda * \defgroup CINDEX_FILES File manipulation routines 27*29e0435aSJan Svoboda * 28*29e0435aSJan Svoboda * @{ 29*29e0435aSJan Svoboda */ 30*29e0435aSJan Svoboda 31*29e0435aSJan Svoboda /** 32*29e0435aSJan Svoboda * A particular source file that is part of a translation unit. 33*29e0435aSJan Svoboda */ 34*29e0435aSJan Svoboda typedef void *CXFile; 35*29e0435aSJan Svoboda 36*29e0435aSJan Svoboda /** 37*29e0435aSJan Svoboda * Retrieve the complete file and path name of the given file. 38*29e0435aSJan Svoboda */ 39*29e0435aSJan Svoboda CINDEX_LINKAGE CXString clang_getFileName(CXFile SFile); 40*29e0435aSJan Svoboda 41*29e0435aSJan Svoboda /** 42*29e0435aSJan Svoboda * Retrieve the last modification time of the given file. 43*29e0435aSJan Svoboda */ 44*29e0435aSJan Svoboda CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile); 45*29e0435aSJan Svoboda 46*29e0435aSJan Svoboda /** 47*29e0435aSJan Svoboda * Uniquely identifies a CXFile, that refers to the same underlying file, 48*29e0435aSJan Svoboda * across an indexing session. 49*29e0435aSJan Svoboda */ 50*29e0435aSJan Svoboda typedef struct { 51*29e0435aSJan Svoboda unsigned long long data[3]; 52*29e0435aSJan Svoboda } CXFileUniqueID; 53*29e0435aSJan Svoboda 54*29e0435aSJan Svoboda /** 55*29e0435aSJan Svoboda * Retrieve the unique ID for the given \c file. 56*29e0435aSJan Svoboda * 57*29e0435aSJan Svoboda * \param file the file to get the ID for. 58*29e0435aSJan Svoboda * \param outID stores the returned CXFileUniqueID. 59*29e0435aSJan Svoboda * \returns If there was a failure getting the unique ID, returns non-zero, 60*29e0435aSJan Svoboda * otherwise returns 0. 61*29e0435aSJan Svoboda */ 62*29e0435aSJan Svoboda CINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID); 63*29e0435aSJan Svoboda 64*29e0435aSJan Svoboda /** 65*29e0435aSJan Svoboda * Returns non-zero if the \c file1 and \c file2 point to the same file, 66*29e0435aSJan Svoboda * or they are both NULL. 67*29e0435aSJan Svoboda */ 68*29e0435aSJan Svoboda CINDEX_LINKAGE int clang_File_isEqual(CXFile file1, CXFile file2); 69*29e0435aSJan Svoboda 70*29e0435aSJan Svoboda /** 71*29e0435aSJan Svoboda * Returns the real path name of \c file. 72*29e0435aSJan Svoboda * 73*29e0435aSJan Svoboda * An empty string may be returned. Use \c clang_getFileName() in that case. 74*29e0435aSJan Svoboda */ 75*29e0435aSJan Svoboda CINDEX_LINKAGE CXString clang_File_tryGetRealPathName(CXFile file); 76*29e0435aSJan Svoboda 77*29e0435aSJan Svoboda /** 78*29e0435aSJan Svoboda * @} 79*29e0435aSJan Svoboda */ 80*29e0435aSJan Svoboda 81*29e0435aSJan Svoboda LLVM_CLANG_C_EXTERN_C_END 82*29e0435aSJan Svoboda 83*29e0435aSJan Svoboda #endif 84