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

1 //===-- HeadersTests.cpp - Include headers unit tests -----------*- 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 //===----------------------------------------------------------------------===//
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/Support/Error.h"
22 #include "llvm/Support/FormatVariadic.h"
23 #include "llvm/Support/Path.h"
24 #include "llvm/Testing/Support/Error.h"
60 CI->getDiagnosticOpts().IgnoreWarnings = true;
61 auto VFS = PI.TFS->view(Cmd->Directory);
64 llvm::MemoryBuffer::getMemBuffer(FS.Files[MainFile], MainFile),
67 EXPECT_FALSE(Clang->getFrontendOpts().Inputs.empty());
74 auto &SM = Clang->getSourceManager();
76 EXPECT_THAT_EXPECTED(Entry, llvm::Succeeded());
84 Action.BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]));
99 Action.BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]));
103 auto ToHeaderFile = [](llvm::StringRef Header) {
105 /*Verbatim=*/!llvm::sys::path::is_absolute(Header)};
109 CDB.getCompileCommand(MainFile)->Directory,
110 &Clang->getPreprocessor().getHeaderSearchInfo(),
122 std::optional<TextEdit> insert(llvm::StringRef VerbatimHeader,
127 Action.BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]));
130 CDB.getCompileCommand(MainFile)->Directory,
131 &Clang->getPreprocessor().getHeaderSearchInfo(),
142 std::string SearchDirArg = (llvm::Twine("-I") + Subdir).str();
144 std::vector<std::function<bool(llvm::StringRef)>> QuotedHeaders;
145 std::vector<std::function<bool(llvm::StringRef)>> AngledHeaders;
196 // includeDepth() also works for non-main files.
274 llvm::DenseMap<IncludeStructure::HeaderID,
290 // ms-compatibility changes meaning of #import, make sure it is turned off.
291 CDB.ExtraClangFlags.push_back("-fno-ms-compatibility");
301 CDB.ExtraClangFlags.push_back("-Ifoo/bar");
302 CDB.ExtraClangFlags.push_back("-Ifoo/bar/..");
330 SearchDirArg = (llvm::Twine("-I") + Subdir + "/..").str();
341 SearchDirArg = (llvm::Twine("-I") + Subdir + "/..").str();
349 llvm::sys::path::convert_to_slash(testPath("sub-2/bar.h"));
350 EXPECT_EQ(calculate(BarHeader, ""), "\"sub-2/bar.h\"");
375 Inc.Written = "fake-bar.h";
385 EXPECT_EQ(Edit->newText, "#include <y>\n");
389 EXPECT_EQ(Edit->newText, "#import \"header.h\"\n");
395 /*BuildDir=*/"", /*HeaderSearchInfo=*/nullptr,
419 llvm::formatv("#line 0 \"{0}\"", llvm::sys::path::filename(MainFile));
425 // Including through non-builtin file has no effects.
430 // Now include through built-in file.
431 CDB.ExtraClangFlags = {"-include", testPath(HeaderFile)};