1 | //===- ASTSourceDescriptor.h -----------------------------*- C++ -*-===// |
2 | // |
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 |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | /// \file |
10 | /// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules |
11 | /// and precompiled header files |
12 | // |
13 | //===----------------------------------------------------------------------===// |
14 | |
15 | #ifndef LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H |
16 | #define LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H |
17 | |
18 | #include "clang/Basic/Module.h" |
19 | #include "llvm/ADT/StringRef.h" |
20 | #include <string> |
21 | #include <utility> |
22 | |
23 | namespace clang { |
24 | |
25 | /// Abstracts clang modules and precompiled header files and holds |
26 | /// everything needed to generate debug info for an imported module |
27 | /// or PCH. |
28 | class ASTSourceDescriptor { |
29 | StringRef PCHModuleName; |
30 | StringRef Path; |
31 | StringRef ASTFile; |
32 | ASTFileSignature Signature; |
33 | Module *ClangModule = nullptr; |
34 | |
35 | public: |
36 | ASTSourceDescriptor() = default; |
37 | ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, |
38 | ASTFileSignature Signature) |
39 | : PCHModuleName(std::move(Name)), Path(std::move(Path)), |
40 | ASTFile(std::move(ASTFile)), Signature(Signature) {} |
41 | ASTSourceDescriptor(Module &M); |
42 | |
43 | std::string getModuleName() const; |
44 | StringRef getPath() const { return Path; } |
45 | StringRef getASTFile() const { return ASTFile; } |
46 | ASTFileSignature getSignature() const { return Signature; } |
47 | Module *getModuleOrNull() const { return ClangModule; } |
48 | }; |
49 | |
50 | } // namespace clang |
51 | |
52 | #endif // LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H |
53 | |