Lines Matching defs:FileID
200 void LineTableInfo::AddLineNote(FileID FID, unsigned Offset, unsigned LineNo,
237 const LineEntry *LineTableInfo::FindNearestLineEntry(FileID FID,
256 void LineTableInfo::AddEntry(FileID FID,
266 /// AddLineNote - Add a line note to the line table for the FileID and offset
273 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
333 MainFileID = FileID();
338 LastLineNoFileIDQuery = FileID();
340 LastFileIDLookup = FileID();
346 // Use up FileID #0 as an invalid expansion.
469 LoadedSLocEntryAllocBegin.push_back(FileID::get(BaseID));
493 /// Returns the previous in-order FileID or an invalid FileID if there
495 FileID SourceManager::getPreviousFileID(FileID FID) const {
497 return FileID();
501 return FileID();
505 return FileID();
507 return FileID();
510 return FileID::get(ID-1);
513 /// Returns the next in-order FileID or an invalid FileID if there is
515 FileID SourceManager::getNextFileID(FileID FID) const {
517 return FileID();
522 return FileID();
524 return FileID();
527 return FileID::get(ID+1);
531 // Methods to create new FileID's and macro expansions.
534 /// Create a new FileID that represents the specified file
536 FileID SourceManager::createFileID(FileEntryRef SourceFile,
553 /// Create a new FileID that represents the specified memory buffer.
557 FileID SourceManager::createFileID(std::unique_ptr<llvm::MemoryBuffer> Buffer,
567 /// Create a new FileID that represents the specified memory buffer.
571 FileID SourceManager::createFileID(const llvm::MemoryBufferRef &Buffer,
580 /// Get the FileID for \p SourceFile if it exists. Otherwise, create a
581 /// new FileID for the \p SourceFile.
582 FileID
585 FileID ID = translateFile(SourceFile);
601 /// createFileID - Create a new FileID for the specified ContentCache and
604 FileID SourceManager::createFileIDImpl(ContentCache &File, StringRef Filename,
610 assert(LoadedID != -1 && "Loading sentinel FileID");
612 assert(Index < LoadedSLocEntryTable.size() && "FileID out of range");
613 assert(!SLocEntryLoaded[Index] && "FileID already loaded");
617 return FileID::get(LoadedID);
638 return FileID();
650 FileID FID = FileID::get(LocalSLocEntryTable.size()-1);
686 assert(LoadedID != -1 && "Loading sentinel FileID");
688 assert(Index < LoadedSLocEntryTable.size() && "FileID out of range");
689 assert(!SLocEntryLoaded[Index] && "FileID already loaded");
760 SourceManager::getNonBuiltinFilenameForID(FileID FID) const {
767 StringRef SourceManager::getBufferData(FileID FID, bool *Invalid) const {
775 SourceManager::getBufferDataIfLoaded(FileID FID) const {
781 std::optional<StringRef> SourceManager::getBufferDataOrNone(FileID FID) const {
793 /// Return the FileID for a SourceLocation.
798 FileID SourceManager::getFileIDSlow(SourceLocation::UIntTy SLocOffset) const {
800 return FileID::get(0);
809 /// Return the FileID for a SourceLocation with a low offset.
813 FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
817 // behavior: 1) a lot of searched FileID's are "near" the cached file
826 // most newly created FileID.
829 // We know that the offset corresponding to the FileID is less than
842 // Find the FileID that contains this.
848 FileID Res = FileID::get(int(GreaterIndex));
849 // Remember it. We have good locality across FileID lookups.
876 FileID Res = FileID::get(MiddleIndex);
878 // Remember it. We have good locality across FileID lookups.
889 /// Return the FileID for a SourceLocation with a high offset.
893 FileID SourceManager::getFileIDLoaded(SourceLocation::UIntTy SLocOffset) const {
896 return FileID();
899 return FileID::get(ExternalSLocEntries->getSLocEntryID(SLocOffset));
919 std::pair<FileID, unsigned> LocInfo = getDecomposedLoc(Loc);
937 std::pair<FileID, unsigned>
941 FileID FID;
955 std::pair<FileID, unsigned>
959 FileID FID;
979 std::pair<FileID, unsigned> LocInfo = getDecomposedLoc(Loc);
1030 FileID FID = getFileID(Loc);
1042 FileID FID = getFileID(Loc);
1051 std::pair<FileID, unsigned> DecompLoc = getDecomposedLoc(Loc);
1063 // For macro argument expansions, check if the previous FileID is part of
1066 FileID PrevFID = getPreviousFileID(DecompLoc.first);
1086 FileID FID = getFileID(Loc);
1098 // For macro argument expansions, check if the next FileID is part of the
1101 FileID NextFID = getNextFileID(FID);
1128 std::pair<FileID, unsigned> LocInfo = getDecomposedSpellingLoc(SL);
1150 unsigned SourceManager::getColumnNumber(FileID FID, unsigned FilePos,
1207 std::pair<FileID, unsigned> LocInfo = getDecomposedSpellingLoc(Loc);
1214 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
1315 unsigned SourceManager::getLineNumber(FileID FID, unsigned FilePos,
1415 std::pair<FileID, unsigned> LocInfo = getDecomposedSpellingLoc(Loc);
1421 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
1442 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
1491 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
1504 FileID FID = LocInfo.first;
1532 FID = FileID::get(0);
1566 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
1585 unsigned SourceManager::getFileIDSize(FileID FID) const {
1598 NextOffset = getSLocEntry(FileID::get(ID+1)).getOffset();
1617 FileID FirstFID = translateFile(SourceFile);
1621 /// Get the FileID for the given file.
1623 /// If the source file is included multiple times, the FileID will be the
1625 FileID SourceManager::translateFile(const FileEntry *SourceFile) const {
1634 return FileID();
1648 return FileID::get(I);
1656 return FileID::get(-int(I) - 2);
1659 return FileID();
1664 SourceLocation SourceManager::translateLineCol(FileID FID,
1728 FileID FID) const {
1789 getFileIDSize(FileID::get(ID)));
1795 FileID FID,
1804 // consecutive FileID entries. Go through each entry contained in the
1808 FileID SpellFID; // Current FileID in the spelling range.
1829 return; // we covered all FileID entries in the spelling range.
1831 // Move to the next FileID entry in the spelling range.
1853 // and we found a new macro FileID that lexed from offset 105 with length 3,
1892 FileID FID;
1921 std::pair<FileID, unsigned>
1922 SourceManager::getDecomposedIncludedLoc(FileID FID) const {
1924 return std::make_pair(FileID(), 0);
1928 using DecompTy = std::pair<FileID, unsigned>;
1950 FileID SourceManager::getUniqueLoadedASTFileID(SourceLocation Loc) const {
1959 const FileID *FirstFID =
1960 llvm::lower_bound(LoadedSLocEntryAllocBegin, FID, std::greater<FileID>{});
1963 "The failure to find the first FileID of a "
1969 const std::pair<FileID, unsigned> &LOffs,
1970 const std::pair<FileID, unsigned> &ROffs) const {
1976 auto FindSLocEntryAlloc = [this](FileID FID) {
1977 // Loaded FileIDs are negative, we store the lowest FileID from each
1980 std::greater<FileID>{});
1996 MoveUpTranslationUnitIncludeHierarchy(std::pair<FileID, unsigned> &Loc,
1998 std::pair<FileID, unsigned> UpperLoc = SM.getDecomposedIncludedLoc(Loc.first);
2009 InBeforeInTUCacheEntry &SourceManager::getInBeforeInTUCache(FileID LFID,
2010 FileID RFID) const {
2044 std::pair<FileID, unsigned> LOffs = getDecomposedLoc(LHS);
2045 std::pair<FileID, unsigned> ROffs = getDecomposedLoc(RHS);
2047 // getDecomposedLoc may have failed to return a valid FileID because, e.g. it
2061 std::pair<FileID, unsigned> &LOffs,
2062 std::pair<FileID, unsigned> &ROffs) const {
2087 // A location within a FileID on the path up from LOffs to the main file.
2089 std::pair<FileID, unsigned> DecomposedLoc; // FileID redundant, but clearer.
2090 FileID ChildFID; // Used for breaking ties. Invalid for the initial loc.
2092 llvm::SmallDenseMap<FileID, Entry, 16> LChain;
2094 FileID LChild;
2104 FileID RChild;
2199 llvm::errs() << "FileID scans: " << NumLinearScans << " linear, "
2208 out << "SLocEntry <FileID " << ID << "> " << (Entry.isFile() ? "file" : "expansion")
2217 out << " covers <FileID " << ID << ":" << int(ID + FI.NumCreatedFIDs)
2276 auto AddUsageForFileID = [&](FileID ID) {
2284 FileID FileLocID = getFileID(FileStart);
2300 AddUsageForFileID(FileID::get(-2 - Index));
2304 AddUsageForFileID(FileID::get(Index));
2404 FileID ID =