Lines Matching defs:CDB

74 // Loads and caches the CDB from a single directory.
77 // directory we're searching for a CDB.
88 // CachedFile is used to read a CDB file on disk (e.g. compile_commands.json).
93 // unchanged then the previous CDB is valid.
120 // If we've looked for a CDB here and found none, the time when that happened.
129 // Whether a new CDB has been loaded but not broadcast yet.
131 // Last loaded CDB, meaningful if CachePopulatedAt was ever set.
132 // shared_ptr so we can overwrite this when callers are still using the CDB.
133 std::shared_ptr<tooling::CompilationDatabase> CDB;
134 // File metadata for the CDB files we support tracking directly.
138 // CachedFile member corresponding to CDB.
139 // CDB | ACF | Scenario
140 // null | null | no CDB found, or initial empty cache
141 // set | null | CDB was loaded via generic plugin interface
142 // null | set | found known CDB file, but parsing it failed
143 // set | set | CDB was parsed from a known file
157 // Get the CDB associated with this directory.
160 // newly-discovered CDB. (e.g. to trigger background indexing)
162 // (If a new CDB is discovered and ShouldBroadcast is false, we mark the
163 // CDB as needing broadcast, and broadcast it next time we can).
175 auto RequestBroadcast = llvm::make_scope_exit([&, OldCDB(CDB.get())] {
176 // If we loaded a new CDB, it should be broadcast at some point.
177 if (CDB != nullptr && CDB.get() != OldCDB)
179 else if (CDB == nullptr) // nothing to broadcast anymore!
190 return CDB;
195 NoCDBAt.store((CDB ? stopwatch::time_point::min() : CachePopulatedAt)
200 return CDB;
204 // Updates `CDB` from disk state. Returns false on failure.
227 // agree on its size, we're ultimately going to have spurious CDB reloads.
236 // mtime changed but data is the same: avoid rebuilding the CDB.
247 // Adapt CDB-loading functions to a common interface for DirectoryCache::load().
250 if (auto CDB = tooling::JSONCompilationDatabase::loadFromBuffer(
261 expandResponseFiles(std::move(CDB), std::move(FS)));
298 CDB = nullptr;
310 // We have a new CDB!
311 CDB = Entry.Parser(Entry.File->Path, Loaded.Buffer->getBuffer(), Error);
312 if (CDB)
338 if (auto CDB = Plugin->loadFromDirectory(Path, Error)) {
341 this->CDB = std::move(CDB);
377 auto Candidates = Res->CDB->getCompileCommands(File);
392 elog("Trying to cache CDB for relative {0}");
428 // src/build/../a.cc can detect a CDB in /src/build if not
438 std::shared_ptr<const tooling::CompilationDatabase> CDB = nullptr;
443 if ((CDB = Candidate->get(Opts.TFS, CandidateShouldBroadcast,
451 if (!CDB)
455 Result.CDB = std::move(CDB);
468 // - we need to enumerate all files in the CDB, of which there are many
469 // - we (will) have to evaluate config for every file in the CDB, which is slow
515 // Inspects a new CDB and broadcasts the files it owns.
526 // New CDB takes precedence over any queued one for the same directory.
551 // The DirBasedCDB associates each file with a specific CDB.
552 // When a CDB is discovered, it may claim to describe files that we associate
553 // with a different CDB. We do not want to broadcast discovery of these, and
556 // We must filter the list, and check whether they are associated with this CDB.
562 // - (lazily) checks for a CDB in each such directory at most once
602 // Fast path out if there were no files, or CDB loading is off.
615 // Also look up the cache entry for the CDB we're broadcasting.
649 // If we have a CDB, include the file if it's the target CDB only.
652 // If we have no CDB and no relevant parent, don't include the file.
670 log("Giving up on broadcasting CDB, as we're shutting down");
700 // Get the CDB cache for each dir on the search path, but don't load yet.
717 Filter(T.PI.SourceRoot, Parent).filter(T.CDB->getAllFiles(), ShouldStop);
724 assert(Result.CDB && "Trying to broadcast an invalid CDB!");
757 return scanningProjectModules(Res->CDB, Opts.TFS);
786 // to be expanded before further processing. For CDB for files it happens in
787 // the main CDB when reading it from the JSON file.