Swift: add preliminary logging to dispatcher

This commit is contained in:
Paolo Tranquilli
2023-04-03 11:42:40 +02:00
parent 3fc488167f
commit a386c58371

View File

@@ -13,6 +13,7 @@
#include "swift/extractor/infra/SwiftLocationExtractor.h"
#include "swift/extractor/infra/SwiftBodyEmissionStrategy.h"
#include "swift/extractor/config/SwiftExtractorState.h"
#include "swift/extractor/infra/log/SwiftLogging.h"
namespace codeql {
@@ -151,7 +152,13 @@ class SwiftDispatcher {
return *l;
}
waitingForNewLabel = e;
// TODO: more generic and informational visiting one-line log
if constexpr (std::is_convertible_v<E, const swift::ValueDecl*>) {
const swift::ValueDecl* x = e;
LOG_TRACE("{}", x->getName().getBaseIdentifier().str());
}
visit(e, std::forward<Args>(args)...);
Log::flush();
// TODO when everything is moved to structured C++ classes, this should be moved to createEntry
if (auto l = store.get(e)) {
if constexpr (IsLocatable<E>) {
@@ -329,6 +336,7 @@ class SwiftDispatcher {
SwiftBodyEmissionStrategy& bodyEmissionStrategy;
Store::Handle waitingForNewLabel{std::monostate{}};
std::unordered_set<swift::ModuleDecl*> encounteredModules;
Logger logger{"dispatcher"};
};
} // namespace codeql