mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add pretty stack trace entry for all index operations
In case we hit a crash during indexing, this will make it easier to identify the crash as coming from indexing vs from compilation.
This commit is contained in:
@@ -830,6 +830,7 @@ static void emitIndexDataForSourceFile(SourceFile *PrimarySourceFile,
|
||||
|
||||
/// Emits index data for all primary inputs, or the main module.
|
||||
static void emitIndexData(const CompilerInstance &Instance) {
|
||||
llvm::PrettyStackTraceFormat trace("While emitting index data");
|
||||
if (Instance.getPrimarySourceFiles().empty()) {
|
||||
emitIndexDataForSourceFile(nullptr, Instance);
|
||||
} else {
|
||||
|
||||
@@ -2330,6 +2330,7 @@ void IndexSwiftASTWalker::collectRecursiveModuleImports(
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void index::indexDeclContext(DeclContext *DC, IndexDataConsumer &consumer) {
|
||||
PrettyStackTraceDeclContext trace("indexing decl context", DC);
|
||||
assert(DC);
|
||||
SourceFile *SF = DC->getParentSourceFile();
|
||||
IndexSwiftASTWalker walker(consumer, DC->getASTContext(), SF);
|
||||
@@ -2338,6 +2339,7 @@ void index::indexDeclContext(DeclContext *DC, IndexDataConsumer &consumer) {
|
||||
}
|
||||
|
||||
void index::indexSourceFile(SourceFile *SF, IndexDataConsumer &consumer) {
|
||||
PrettyStackTraceDeclContext trace("indexing source file", SF);
|
||||
assert(SF);
|
||||
IndexSwiftASTWalker walker(consumer, SF->getASTContext(), SF);
|
||||
walker.visitModule(*SF->getParentModule());
|
||||
|
||||
Reference in New Issue
Block a user