Skip to content

Commit 3e19f48

Browse files
committed
Add debug logging for name resolution failures
1 parent e9cc529 commit 3e19f48

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- Support for MSBuild item and item metadata expressions in project files.
13+
- Debug logging for name resolution failures (enabled with `sonar-scanner -X`).
1314
- `ExhaustiveEnumCase` analysis rule, which flags `case` statements that do not handle all values in an enumeration.
1415
- `IterationPastHighBound` analysis rule, which flags `for` loops that iterate past the end of the collection.
1516
- `ExplicitBitwiseNot` analysis rule, which flags potentially incorrect bitwise `not` operations.

delphi-frontend/src/main/java/au/com/integradev/delphi/symbol/resolve/NameResolver.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,15 @@ private void readNameReference(NameReferenceNode node, boolean inAttribute) {
593593
if (couldBeUnitNameReference) {
594594
readPossibleUnitNameReference(node, inAttribute);
595595
}
596+
if (LOG.isDebugEnabled() && nameResolutionFailed()) {
597+
IdentifierNode identifier = reference.getIdentifier();
598+
LOG.debug(
599+
"Name resolution failed on symbol '{}' ({} line {}:{})",
600+
identifier.getImage(),
601+
identifier.getUnitName(),
602+
identifier.getBeginLine(),
603+
identifier.getBeginColumn());
604+
}
596605
return;
597606
}
598607

0 commit comments

Comments
 (0)