[FrontendTool] Only validate TBD for Swift input.

This commit is contained in:
Huon Wilson
2017-05-22 13:04:57 -07:00
parent 40ba18615b
commit 0eb849715f
3 changed files with 21 additions and 0 deletions

View File

@@ -925,6 +925,9 @@ static bool performCompile(CompilerInstance &Instance,
allSymbols = true;
LLVM_FALLTHROUGH;
case FrontendOptions::TBDValidationMode::MissingFromTBD: {
if (!inputFileKindCanHaveTBDValidated(Invocation.getInputKind()))
break;
auto hasMultipleIRGenThreads = Invocation.getSILOptions().NumThreads > 1;
bool error;
if (PrimarySourceFile)

View File

@@ -60,6 +60,21 @@ bool swift::writeTBD(ModuleDecl *M, bool hasMultipleIRGenThreads,
return false;
}
bool swift::inputFileKindCanHaveTBDValidated(InputFileKind kind) {
// Only things that involve an AST can have a TBD file computed, at the
// moment.
switch (kind) {
case InputFileKind::IFK_Swift:
case InputFileKind::IFK_Swift_Library:
return true;
case InputFileKind::IFK_None:
case InputFileKind::IFK_Swift_REPL:
case InputFileKind::IFK_SIL:
case InputFileKind::IFK_LLVM_IR:
return false;
}
}
static bool validateSymbolSet(DiagnosticEngine &diags,
llvm::StringSet<> symbols, llvm::Module &IRModule,
bool diagnoseExtraSymbolsInTBD) {

View File

@@ -13,6 +13,8 @@
#ifndef SWIFT_FRONTENDTOOL_TBD_H
#define SWIFT_FRONTENDTOOL_TBD_H
#include "swift/Frontend/FrontendOptions.h"
namespace llvm {
class StringRef;
class Module;
@@ -24,6 +26,7 @@ class FrontendOptions;
bool writeTBD(ModuleDecl *M, bool hasMultipleIRGenThreads,
llvm::StringRef OutputFilename);
bool inputFileKindCanHaveTBDValidated(InputFileKind kind);
bool validateTBD(ModuleDecl *M, llvm::Module &IRModule,
bool hasMultipleIRGenThreads, bool diagnoseExtraSymbolsInTBD);
bool validateTBD(FileUnit *M, llvm::Module &IRModule,