clang-tools 8.0.0

Compiler.h
Go to the documentation of this file.
1 //===--- Compiler.h ----------------------------------------------*- C++-*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Shared utilities for invoking the clang compiler.
11 // ClangdUnit takes care of much of this, but some features like CodeComplete
12 // run their own compile actions that share logic.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_COMPILER_H
17 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_COMPILER_H
18
19 #include "clang/Frontend/CompilerInstance.h"
20 #include "clang/Frontend/CompilerInvocation.h"
21 #include "clang/Frontend/PrecompiledPreamble.h"
22
23 namespace clang {
24 namespace clangd {
25
26 class IgnoreDiagnostics : public DiagnosticConsumer {
27 public:
28 static void log(DiagnosticsEngine::Level DiagLevel,
29 const clang::Diagnostic &Info);
30
31 void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
32 const clang::Diagnostic &Info) override;
33 };
34
35 /// Creates a compiler instance, configured so that:
36 /// - Contents of the parsed file are remapped to \p MainFile.
37 /// - Preamble is overriden to use PCH passed to this function. It means the
38 /// changes to the preamble headers or files included in the preamble are
39 /// not visible to this compiler instance.
40 /// - llvm::vfs::FileSystem is used for all underlying file accesses. The
41 /// actual vfs used by the compiler may be an overlay over the passed vfs.
42 /// Returns null on errors. When non-null value is returned, it is expected to
43 /// be consumed by FrontendAction::BeginSourceFile to properly destroy \p
44 /// MainFile.
45 std::unique_ptr<CompilerInstance> prepareCompilerInstance(
46 std::unique_ptr<clang::CompilerInvocation>, const PrecompiledPreamble *,
47 std::unique_ptr<llvm::MemoryBuffer> MainFile,
48 std::shared_ptr<PCHContainerOperations>,
49 IntrusiveRefCntPtr<llvm::vfs::FileSystem>, DiagnosticConsumer &);
50
51 } // namespace clangd
52 } // namespace clang
53
54 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_COMPILER_H
DiagnosticConsumer
clang::clangd::IgnoreDiagnostics::log
static void log(DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &Info)
Definition: Compiler.cpp:20
clang::clangd::IgnoreDiagnostics
Definition: Compiler.h:26
Info
FunctionInfo Info
Definition: FunctionSizeCheck.cpp:121
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ChangeNamespace.cpp:18
clang::clangd::IgnoreDiagnostics::HandleDiagnostic
void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &Info) override
Definition: Compiler.cpp:38
clang::clangd::prepareCompilerInstance
std::unique_ptr< CompilerInstance > prepareCompilerInstance(std::unique_ptr< clang::CompilerInvocation > CI, const PrecompiledPreamble *Preamble, std::unique_ptr< llvm::MemoryBuffer > Buffer, std::shared_ptr< PCHContainerOperations > PCHs, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, DiagnosticConsumer &DiagsClient)
Definition: Compiler.cpp:44