Skip to content

Commit a386c58

Browse files
committed
Swift: add preliminary logging to dispatcher
1 parent 3fc4881 commit a386c58

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

swift/extractor/infra/SwiftDispatcher.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "swift/extractor/infra/SwiftLocationExtractor.h"
1414
#include "swift/extractor/infra/SwiftBodyEmissionStrategy.h"
1515
#include "swift/extractor/config/SwiftExtractorState.h"
16+
#include "swift/extractor/infra/log/SwiftLogging.h"
1617

1718
namespace codeql {
1819

@@ -151,7 +152,13 @@ class SwiftDispatcher {
151152
return *l;
152153
}
153154
waitingForNewLabel = e;
155+
// TODO: more generic and informational visiting one-line log
156+
if constexpr (std::is_convertible_v<E, const swift::ValueDecl*>) {
157+
const swift::ValueDecl* x = e;
158+
LOG_TRACE("{}", x->getName().getBaseIdentifier().str());
159+
}
154160
visit(e, std::forward<Args>(args)...);
161+
Log::flush();
155162
// TODO when everything is moved to structured C++ classes, this should be moved to createEntry
156163
if (auto l = store.get(e)) {
157164
if constexpr (IsLocatable<E>) {
@@ -329,6 +336,7 @@ class SwiftDispatcher {
329336
SwiftBodyEmissionStrategy& bodyEmissionStrategy;
330337
Store::Handle waitingForNewLabel{std::monostate{}};
331338
std::unordered_set<swift::ModuleDecl*> encounteredModules;
339+
Logger logger{"dispatcher"};
332340
};
333341

334342
} // namespace codeql

0 commit comments

Comments
 (0)