xref: /llvm-project/clang/include/clang/Interpreter/PartialTranslationUnit.h (revision a8744066e9ef252b687c1206ccbd1a6e3ae1c890)
1 //===--- Transaction.h - Incremental Compilation and Execution---*- 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 // This file defines utilities tracking the incrementally processed pieces of
10 // code.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_INTERPRETER_PARTIALTRANSLATIONUNIT_H
15 #define LLVM_CLANG_INTERPRETER_PARTIALTRANSLATIONUNIT_H
16 
17 #include <memory>
18 
19 namespace llvm {
20 class Module;
21 }
22 
23 namespace clang {
24 
25 class TranslationUnitDecl;
26 
27 /// The class keeps track of various objects created as part of processing
28 /// incremental inputs.
29 struct PartialTranslationUnit {
30   TranslationUnitDecl *TUPart = nullptr;
31 
32   /// The llvm IR produced for the input.
33   std::unique_ptr<llvm::Module> TheModule;
34   bool operator==(const PartialTranslationUnit &other) {
35     return other.TUPart == TUPart && other.TheModule == TheModule;
36   }
37 };
38 } // namespace clang
39 
40 #endif // LLVM_CLANG_INTERPRETER_PARTIALTRANSLATIONUNIT_H
41