Path: blob/main/contrib/llvm-project/clang/lib/Index/FileIndexRecord.h
35233 views
//===--- FileIndexRecord.h - Index data per file ----------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_CLANG_LIB_INDEX_FILEINDEXRECORD_H9#define LLVM_CLANG_LIB_INDEX_FILEINDEXRECORD_H1011#include "clang/Basic/SourceLocation.h"12#include "clang/Index/DeclOccurrence.h"13#include "clang/Index/IndexSymbol.h"14#include "llvm/ADT/ArrayRef.h"15#include "llvm/ADT/SmallVector.h"16#include <vector>1718namespace clang {19class IdentifierInfo;2021namespace index {2223/// Stores the declaration occurrences seen in a particular source or header24/// file of a translation unit25class FileIndexRecord {26private:27FileID FID;28bool IsSystem;29mutable bool IsSorted = false;30mutable std::vector<DeclOccurrence> Decls;3132public:33FileIndexRecord(FileID FID, bool IsSystem) : FID(FID), IsSystem(IsSystem) {}3435ArrayRef<DeclOccurrence> getDeclOccurrencesSortedByOffset() const;3637FileID getFileID() const { return FID; }38bool isSystem() const { return IsSystem; }3940/// Adds an occurrence of the canonical declaration \c D at the supplied41/// \c Offset42///43/// \param Roles the roles the occurrence fulfills in this position.44/// \param Offset the offset in the file of this occurrence.45/// \param D the canonical declaration this is an occurrence of.46/// \param Relations the set of symbols related to this occurrence.47void addDeclOccurence(SymbolRoleSet Roles, unsigned Offset, const Decl *D,48ArrayRef<SymbolRelation> Relations);4950/// Adds an occurrence of the given macro at the supplied \c Offset.51///52/// \param Roles the roles the occurrence fulfills in this position.53/// \param Offset the offset in the file of this occurrence.54/// \param Name the name of the macro.55/// \param MI the canonical declaration this is an occurrence of.56void addMacroOccurence(SymbolRoleSet Roles, unsigned Offset,57const IdentifierInfo *Name, const MacroInfo *MI);5859/// Remove any macro occurrences for header guards. When preprocessing, this60/// will only be accurate after HandleEndOfFile.61void removeHeaderGuardMacros();6263void print(llvm::raw_ostream &OS, SourceManager &SM) const;64};6566} // end namespace index67} // end namespace clang6869#endif // LLVM_CLANG_LIB_INDEX_FILEINDEXRECORD_H707172