Skip to content

Commit c3304bd

Browse files
committed
CxxPreprocessor: fix handling of SquidAstVisitorContext (2)
* remove wrong is-null checks (although I hope, that #1638 will be merged and we could remove the code completely)
1 parent 89cb8a9 commit c3304bd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

cxx-squid/src/main/java/org/sonar/cxx/preprocessor/CxxPreprocessor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ PreprocessorAction handleIncludeLine(AstNode ast, Token token, String filename,
10781078
File includedFile = findIncludedFile(ast, token, filename);
10791079

10801080
File currentFile = this.getFileUnderAnalysis();
1081-
if (currentFile != null && includedFile != null) {
1081+
if (includedFile != null) {
10821082
includedFiles.put(currentFile.getPath(), new Include(token.getLine(), includedFile.getAbsolutePath()));
10831083
}
10841084

@@ -1087,9 +1087,7 @@ PreprocessorAction handleIncludeLine(AstNode ast, Token token, String filename,
10871087
if (LOG.isDebugEnabled()) {
10881088
LOG.debug("[" + filename + ":" + token.getLine() + "]: cannot find include file '" + token.getValue() + "'");
10891089
}
1090-
if (currentFile != null) {
1091-
missingIncludeFiles.put(currentFile.getPath(), new Include(token.getLine(), token.getValue()));
1092-
}
1090+
missingIncludeFiles.put(currentFile.getPath(), new Include(token.getLine(), token.getValue()));
10931091
} else if (analysedFiles.add(includedFile.getAbsoluteFile())) {
10941092
if (LOG.isTraceEnabled()) {
10951093
LOG.trace("[{}:{}]: processing {}, resolved to file '{}'",

0 commit comments

Comments
 (0)