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