1351280Sdim//===--- FileIndexRecord.h - Index data per file ----------------*- C++ -*-===// 2351280Sdim// 3351280Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4351280Sdim// See https://llvm.org/LICENSE.txt for license information. 5351280Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6351280Sdim// 7351280Sdim//===----------------------------------------------------------------------===// 8351280Sdim 9351280Sdim#ifndef LLVM_CLANG_LIB_INDEX_FILEINDEXRECORD_H 10351280Sdim#define LLVM_CLANG_LIB_INDEX_FILEINDEXRECORD_H 11351280Sdim 12351280Sdim#include "clang/Basic/SourceLocation.h" 13351280Sdim#include "clang/Index/DeclOccurrence.h" 14351280Sdim#include "clang/Index/IndexSymbol.h" 15351280Sdim#include "llvm/ADT/ArrayRef.h" 16351280Sdim#include "llvm/ADT/SmallVector.h" 17351280Sdim#include <vector> 18351280Sdim 19351280Sdimnamespace clang { 20351280Sdimclass IdentifierInfo; 21351280Sdim 22351280Sdimnamespace index { 23351280Sdim 24351280Sdim/// Stores the declaration occurrences seen in a particular source or header 25351280Sdim/// file of a translation unit 26351280Sdimclass FileIndexRecord { 27351280Sdimprivate: 28351280Sdim FileID FID; 29351280Sdim bool IsSystem; 30351280Sdim std::vector<DeclOccurrence> Decls; 31351280Sdim 32351280Sdimpublic: 33351280Sdim FileIndexRecord(FileID FID, bool IsSystem) : FID(FID), IsSystem(IsSystem) {} 34351280Sdim 35351280Sdim ArrayRef<DeclOccurrence> getDeclOccurrencesSortedByOffset() const { 36351280Sdim return Decls; 37351280Sdim } 38351280Sdim 39351280Sdim FileID getFileID() const { return FID; } 40351280Sdim bool isSystem() const { return IsSystem; } 41351280Sdim 42351280Sdim /// Adds an occurrence of the canonical declaration \c D at the supplied 43351280Sdim /// \c Offset 44351280Sdim /// 45351280Sdim /// \param Roles the roles the occurrence fulfills in this position. 46351280Sdim /// \param Offset the offset in the file of this occurrence. 47351280Sdim /// \param D the canonical declaration this is an occurrence of. 48351280Sdim /// \param Relations the set of symbols related to this occurrence. 49351280Sdim void addDeclOccurence(SymbolRoleSet Roles, unsigned Offset, const Decl *D, 50351280Sdim ArrayRef<SymbolRelation> Relations); 51351280Sdim void print(llvm::raw_ostream &OS) const; 52351280Sdim}; 53351280Sdim 54351280Sdim} // end namespace index 55351280Sdim} // end namespace clang 56351280Sdim 57351280Sdim#endif // LLVM_CLANG_LIB_INDEX_FILEINDEXRECORD_H 58