Lines Matching +full:llvm +full:- +full:builddir

1 //===--- Headers.cpp - Include headers ---------------------------*- C++-*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
21 #include "llvm/ADT/SmallVector.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/Support/Path.h"
36 // Record existing #includes - both written and resolved paths. Only #includes
39 llvm::StringRef FileName, bool IsAngled,
42 llvm::StringRef /*SearchPath*/,
43 llvm::StringRef /*RelativePath*/,
52 // Record main-file inclusions (including those mapped from the preamble
55 Out->MainFileIncludes.emplace_back();
56 auto &Inc = Out->MainFileIncludes.back();
64 SM.getLineNumber(SM.getFileID(HashLoc), Inc.HashOffset) - 1;
66 Inc.Directive = IncludeTok.getIdentifierInfo()->getPPKeywordID();
68 IncludeStructure::HeaderID HID = Out->getOrCreateID(*File);
72 auto &IDs = Out->StdlibHeaders[*StdlibHeader];
74 if (!llvm::is_contained(IDs, HID))
78 Out->MainFileIncludesBySpelling[Inc.Written].push_back(
79 Out->MainFileIncludes.size() - 1);
82 // Record include graph (not just for main-file includes)
87 "Expected #include location to be a file or <built-in>");
91 auto IncludingID = Out->getOrCreateID(*IncludingFileEntry),
92 IncludedID = Out->getOrCreateID(*File);
93 Out->IncludeChildren[IncludingID].push_back(IncludedID);
109 --Level;
126 // Set after entering the <built-in> file.
128 // Indicates whether <built-in> file is part of include stack.
134 bool isLiteralInclude(llvm::StringRef Include) {
140 (!Verbatim && llvm::sys::path::is_absolute(File));
143 llvm::Expected<HeaderFile> toHeaderFile(llvm::StringRef Header,
144 llvm::StringRef HintPath) {
154 if (!IncludePath->empty())
163 llvm::SmallVector<SymbolInclude, 1> getRankedIncludes(const Symbol &Sym) {
166 llvm::sort(Includes, [](const Symbol::IncludeHeaderWithReferences &LHS,
172 llvm::SmallVector<SymbolInclude, 1> Headers;
202 auto It = UIDToIndex.find(Entry->getUniqueID());
205 return It->second;
212 RealPathNames.front() = MainFileEntry->tryGetRealPathName().str();
220 IncludeStructure::HeaderID Result = R.first->getSecond();
227 llvm::DenseMap<IncludeStructure::HeaderID, unsigned>
230 llvm::DenseMap<HeaderID, unsigned> Result;
235 llvm::DenseSet<IncludeStructure::HeaderID> Seen;
255 llvm::SmallVector<const Inclusion *>
256 IncludeStructure::mainFileIncludesWithSpelling(llvm::StringRef Spelling) const {
257 llvm::SmallVector<const Inclusion *> Includes;
278 auto Included = [&](llvm::StringRef Header) {
286 llvm::StringRef IncludingFile) const {
293 Suggested = HeaderSearchInfo->suggestPathToFileForDiagnostics(
294 InsertedHeader.File, BuildDir, IncludingFile, &IsAngledByDefault);
297 StringRef IncludingDir = llvm::sys::path::parent_path(IncludingFile);
300 llvm::sys::path::replace_path_prefix(RelFile, IncludingDir, "./");
301 Suggested = llvm::sys::path::convert_to_slash(
302 llvm::sys::path::remove_leading_dotslash(RelFile));
305 if (llvm::sys::path::is_absolute(Suggested))
339 IncludeInserter::insert(llvm::StringRef VerbatimHeader,
349 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Inclusion &Inc) {