Skip to content

Commit f6976d8

Browse files
committed
Have TBDGenDescriptor take ownership of TBDGenOptions
This is necessary for caching TBD requests.
1 parent fcb0b2b commit f6976d8

File tree

7 files changed

+9
-6
lines changed

7 files changed

+9
-6
lines changed

include/swift/AST/TBDGenRequests.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "swift/AST/ASTTypeIDs.h"
2121
#include "swift/AST/SimpleRequest.h"
22+
#include "swift/TBDGen/TBDGen.h"
2223

2324
namespace llvm {
2425

@@ -37,12 +38,11 @@ namespace swift {
3738

3839
class FileUnit;
3940
class ModuleDecl;
40-
struct TBDGenOptions;
4141

4242
class TBDGenDescriptor final {
4343
using FileOrModule = llvm::PointerUnion<FileUnit *, ModuleDecl *>;
4444
FileOrModule Input;
45-
const TBDGenOptions &Opts;
45+
TBDGenOptions Opts;
4646

4747
TBDGenDescriptor(FileOrModule input, const TBDGenOptions &opts)
4848
: Input(input), Opts(opts) {
@@ -62,6 +62,7 @@ class TBDGenDescriptor final {
6262

6363
/// Returns the TBDGen options.
6464
const TBDGenOptions &getOptions() const { return Opts; }
65+
TBDGenOptions &getOptions() { return Opts; }
6566

6667
const llvm::DataLayout &getDataLayout() const;
6768
const llvm::Triple &getTarget() const;

include/swift/TBDGen/TBDGen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "llvm/ADT/Hashing.h"
1616
#include "llvm/ADT/StringSet.h"
17-
#include "swift/AST/TBDGenRequests.h"
1817
#include "swift/Basic/Version.h"
1918
#include <vector>
2019

@@ -25,6 +24,7 @@ class raw_ostream;
2524
namespace swift {
2625
class FileUnit;
2726
class ModuleDecl;
27+
class TBDGenDescriptor;
2828

2929
/// Options for controlling the exact set of symbols included in the TBD
3030
/// output.

lib/FrontendTool/FrontendTool.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "swift/AST/IRGenRequests.h"
3636
#include "swift/AST/NameLookup.h"
3737
#include "swift/AST/ASTMangler.h"
38+
#include "swift/AST/TBDGenRequests.h"
3839
#include "swift/AST/TypeRefinementContext.h"
3940
#include "swift/Basic/Dwarf.h"
4041
#include "swift/Basic/Edit.h"

lib/FrontendTool/TBD.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "swift/AST/DiagnosticsFrontend.h"
1818
#include "swift/AST/FileUnit.h"
1919
#include "swift/AST/Module.h"
20+
#include "swift/AST/TBDGenRequests.h"
2021
#include "swift/Basic/LLVM.h"
2122
#include "swift/Demangling/Demangle.h"
2223
#include "swift/Frontend/FrontendOptions.h"

lib/IRGen/IRGenRequests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include "swift/AST/Module.h"
1717
#include "swift/AST/SourceFile.h"
1818
#include "swift/SIL/SILModule.h"
19+
#include "swift/AST/TBDGenRequests.h"
1920
#include "swift/Subsystems.h"
20-
#include "swift/TBDGen/TBDGen.h"
2121
#include "llvm/IR/Module.h"
2222
#include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
2323

lib/TBDGen/TBDGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static bool isGlobalOrStaticVar(VarDecl *VD) {
6161
return VD->isStatic() || VD->getDeclContext()->isModuleScopeContext();
6262
}
6363

64-
TBDGenVisitor::TBDGenVisitor(TBDGenDescriptor desc,
64+
TBDGenVisitor::TBDGenVisitor(const TBDGenDescriptor &desc,
6565
SymbolCallbackFn symbolCallback)
6666
: TBDGenVisitor(desc.getTarget(), desc.getDataLayout(),
6767
desc.getParentModule(), desc.getOptions(),

lib/TBDGen/TBDGenVisitor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class TBDGenVisitor : public ASTVisitor<TBDGenVisitor> {
150150

151151
/// Create a new visitor using the target and layout information from a
152152
/// TBDGenDescriptor.
153-
TBDGenVisitor(TBDGenDescriptor desc, SymbolCallbackFn symbolCallback);
153+
TBDGenVisitor(const TBDGenDescriptor &desc, SymbolCallbackFn symbolCallback);
154154

155155
~TBDGenVisitor() { assert(DeclStack.empty()); }
156156
void addMainIfNecessary(FileUnit *file) {

0 commit comments

Comments
 (0)