Lines Matching defs:FileID
211 void LineTableInfo::AddLineNote(FileID FID, unsigned Offset, unsigned LineNo,
248 const LineEntry *LineTableInfo::FindNearestLineEntry(FileID FID,
267 void LineTableInfo::AddEntry(FileID FID,
277 /// AddLineNote - Add a line note to the line table for the FileID and offset
284 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
344 MainFileID = FileID();
349 LastLineNoFileIDQuery = FileID();
351 LastFileIDLookup = FileID();
356 // Use up FileID #0 as an invalid expansion.
479 LoadedSLocEntryAllocBegin.push_back(FileID::get(BaseID));
503 /// Returns the previous in-order FileID or an invalid FileID if there
505 FileID SourceManager::getPreviousFileID(FileID FID) const {
507 return FileID();
511 return FileID();
515 return FileID();
517 return FileID();
520 return FileID::get(ID-1);
523 /// Returns the next in-order FileID or an invalid FileID if there is
525 FileID SourceManager::getNextFileID(FileID FID) const {
527 return FileID();
532 return FileID();
534 return FileID();
537 return FileID::get(ID+1);
541 // Methods to create new FileID's and macro expansions.
544 /// Create a new FileID that represents the specified file
546 FileID SourceManager::createFileID(FileEntryRef SourceFile,
563 /// Create a new FileID that represents the specified memory buffer.
567 FileID SourceManager::createFileID(std::unique_ptr<llvm::MemoryBuffer> Buffer,
577 /// Create a new FileID that represents the specified memory buffer.
581 FileID SourceManager::createFileID(const llvm::MemoryBufferRef &Buffer,
590 /// Get the FileID for \p SourceFile if it exists. Otherwise, create a
591 /// new FileID for the \p SourceFile.
592 FileID
595 FileID ID = translateFile(SourceFile);
600 /// createFileID - Create a new FileID for the specified ContentCache and
603 FileID SourceManager::createFileIDImpl(ContentCache &File, StringRef Filename,
609 assert(LoadedID != -1 && "Loading sentinel FileID");
611 assert(Index < LoadedSLocEntryTable.size() && "FileID out of range");
612 assert(!SLocEntryLoaded[Index] && "FileID already loaded");
616 return FileID::get(LoadedID);
623 return FileID();
635 FileID FID = FileID::get(LocalSLocEntryTable.size()-1);
671 assert(LoadedID != -1 && "Loading sentinel FileID");
673 assert(Index < LoadedSLocEntryTable.size() && "FileID out of range");
674 assert(!SLocEntryLoaded[Index] && "FileID already loaded");
745 SourceManager::getNonBuiltinFilenameForID(FileID FID) const {
752 StringRef SourceManager::getBufferData(FileID FID, bool *Invalid) const {
760 SourceManager::getBufferDataIfLoaded(FileID FID) const {
766 std::optional<StringRef> SourceManager::getBufferDataOrNone(FileID FID) const {
778 /// Return the FileID for a SourceLocation.
783 FileID SourceManager::getFileIDSlow(SourceLocation::UIntTy SLocOffset) const {
785 return FileID::get(0);
794 /// Return the FileID for a SourceLocation with a low offset.
798 FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
802 // behavior: 1) a lot of searched FileID's are "near" the cached file
811 // most newly created FileID.
814 // We know that the offset corresponding to the FileID is less than
827 // Find the FileID that contains this.
833 FileID Res = FileID::get(int(GreaterIndex));
834 // Remember it. We have good locality across FileID lookups.
861 FileID Res = FileID::get(MiddleIndex);
863 // Remember it. We have good locality across FileID lookups.
874 /// Return the FileID for a SourceLocation with a high offset.
878 FileID SourceManager::getFileIDLoaded(SourceLocation::UIntTy SLocOffset) const {
881 return FileID();
884 return FileID::get(ExternalSLocEntries->getSLocEntryID(SLocOffset));
904 std::pair<FileID, unsigned> LocInfo = getDecomposedLoc(Loc);
922 std::pair<FileID, unsigned>
926 FileID FID;
940 std::pair<FileID, unsigned>
944 FileID FID;
964 std::pair<FileID, unsigned> LocInfo = getDecomposedLoc(Loc);
1015 FileID FID = getFileID(Loc);
1027 FileID FID = getFileID(Loc);
1036 std::pair<FileID, unsigned> DecompLoc = getDecomposedLoc(Loc);
1048 // For macro argument expansions, check if the previous FileID is part of
1051 FileID PrevFID = getPreviousFileID(DecompLoc.first);
1071 FileID FID = getFileID(Loc);
1083 // For macro argument expansions, check if the next FileID is part of the
1086 FileID NextFID = getNextFileID(FID);
1113 std::pair<FileID, unsigned> LocInfo = getDecomposedSpellingLoc(SL);
1135 unsigned SourceManager::getColumnNumber(FileID FID, unsigned FilePos,
1192 std::pair<FileID, unsigned> LocInfo = getDecomposedSpellingLoc(Loc);
1199 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
1300 unsigned SourceManager::getLineNumber(FileID FID, unsigned FilePos,
1400 std::pair<FileID, unsigned> LocInfo = getDecomposedSpellingLoc(Loc);
1406 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
1427 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
1476 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
1489 FileID FID = LocInfo.first;
1517 FID = FileID::get(0);
1551 std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
1570 unsigned SourceManager::getFileIDSize(FileID FID) const {
1583 NextOffset = getSLocEntry(FileID::get(ID+1)).getOffset();
1602 FileID FirstFID = translateFile(SourceFile);
1606 /// Get the FileID for the given file.
1608 /// If the source file is included multiple times, the FileID will be the
1610 FileID SourceManager::translateFile(const FileEntry *SourceFile) const {
1619 return FileID();
1633 return FileID::get(I);
1641 return FileID::get(-int(I) - 2);
1644 return FileID();
1649 SourceLocation SourceManager::translateLineCol(FileID FID,
1713 FileID FID) const {
1774 getFileIDSize(FileID::get(ID)));
1780 FileID FID,
1789 // consecutive FileID entries. Go through each entry contained in the
1793 FileID SpellFID; // Current FileID in the spelling range.
1814 return; // we covered all FileID entries in the spelling range.
1816 // Move to the next FileID entry in the spelling range.
1838 // and we found a new macro FileID that lexed from offset 105 with length 3,
1877 FileID FID;
1906 std::pair<FileID, unsigned>
1907 SourceManager::getDecomposedIncludedLoc(FileID FID) const {
1909 return std::make_pair(FileID(), 0);
1913 using DecompTy = std::pair<FileID, unsigned>;
1935 FileID SourceManager::getUniqueLoadedASTFileID(SourceLocation Loc) const {
1944 const FileID *FirstFID =
1945 llvm::lower_bound(LoadedSLocEntryAllocBegin, FID, std::greater<FileID>{});
1948 "The failure to find the first FileID of a "
1954 const std::pair<FileID, unsigned> &LOffs,
1955 const std::pair<FileID, unsigned> &ROffs) const {
1961 auto FindSLocEntryAlloc = [this](FileID FID) {
1962 // Loaded FileIDs are negative, we store the lowest FileID from each
1965 std::greater<FileID>{});
1981 MoveUpTranslationUnitIncludeHierarchy(std::pair<FileID, unsigned> &Loc,
1983 std::pair<FileID, unsigned> UpperLoc = SM.getDecomposedIncludedLoc(Loc.first);
1994 InBeforeInTUCacheEntry &SourceManager::getInBeforeInTUCache(FileID LFID,
1995 FileID RFID) const {
2029 std::pair<FileID, unsigned> LOffs = getDecomposedLoc(LHS);
2030 std::pair<FileID, unsigned> ROffs = getDecomposedLoc(RHS);
2032 // getDecomposedLoc may have failed to return a valid FileID because, e.g. it
2047 std::pair<FileID, unsigned> &LOffs,
2048 std::pair<FileID, unsigned> &ROffs) const {
2073 // A location within a FileID on the path up from LOffs to the main file.
2075 std::pair<FileID, unsigned> DecomposedLoc; // FileID redundant, but clearer.
2076 FileID ChildFID; // Used for breaking ties. Invalid for the initial loc.
2078 llvm::SmallDenseMap<FileID, Entry, 16> LChain;
2080 FileID LChild;
2090 FileID RChild;
2185 llvm::errs() << "FileID scans: " << NumLinearScans << " linear, "
2194 out << "SLocEntry <FileID " << ID << "> " << (Entry.isFile() ? "file" : "expansion")
2203 out << " covers <FileID " << ID << ":" << int(ID + FI.NumCreatedFIDs)
2262 auto AddUsageForFileID = [&](FileID ID) {
2270 FileID FileLocID = getFileID(FileStart);
2286 AddUsageForFileID(FileID::get(-2 - Index));
2290 AddUsageForFileID(FileID::get(Index));
2389 FileID ID =