| Summary: | Running C/C++ Code Analysis on a project containing an assembly file results in a NPE | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Richard Horbach <richard.horbach> |
| Component: | cdt-codan | Assignee: | CDT Codan Inbox <cdt-codan-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | Elena Laskavaia <elaskavaia.cdt> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, jensseidel, malaperle, richard.horbach, yevshif, zeratul976 |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
|
Description
Richard Horbach
Stack trace: java.lang.NullPointerException at org.eclipse.cdt.internal.core.model.TranslationUnit.getAST(TranslationUnit.java:811) at org.eclipse.cdt.internal.core.model.TranslationUnit.getAST(TranslationUnit.java:768) at org.eclipse.cdt.codan.core.cxx.model.CxxModelsCache.getAST(CxxModelsCache.java:73) at org.eclipse.cdt.codan.core.cxx.model.CxxModelsCache.getAST(CxxModelsCache.java:63) at org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker.processFile(AbstractIndexAstChecker.java:73) at org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker.processResource(AbstractIndexAstChecker.java:54) at org.eclipse.cdt.codan.core.model.AbstractChecker.processResource(AbstractChecker.java:248) at org.eclipse.cdt.codan.internal.core.CodanBuilder.processResource(CodanBuilder.java:151) at org.eclipse.cdt.codan.internal.core.CodanBuilder.processResource(CodanBuilder.java:97) at org.eclipse.cdt.codan.internal.core.CodanBuilder.processResource(CodanBuilder.java:182) at org.eclipse.cdt.codan.internal.core.CodanBuilder.processResource(CodanBuilder.java:109) at org.eclipse.cdt.codan.internal.ui.actions.RunCodeAnalysis$1.run(RunCodeAnalysis.java:56) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) n CoreModel.isValidTranslationUnit it is tested if a file is a translation unit. The test result depends on the contentType. Types cheader, csource, cxxheader, cxxsource and asmsource (org.eclipse.cdt.core.asmSource) are valid translation units according to this test. In org.eclipse.cdt.internal.core.model.TranslationUnit, method getAST an ASTTranslationUnit is created from the file contents. For an assembly file this fails and returns null, resulting in the NPE. The bug is that C/C++ Code Analysis tries to process assembly files. (In reply to comment #2) > n CoreModel.isValidTranslationUnit it is tested if a file is a translation > unit. The test result depends on the contentType. Types cheader, csource, > cxxheader, cxxsource and asmsource (org.eclipse.cdt.core.asmSource) are > valid translation units according to this test. Photran (the Fortran frontend) uses also CDT and I got this bug also. > The bug is that C/C++ Code Analysis tries to process assembly files. And as it looks like Fortran files ... Looks like this issue was recently fixed in bug 431026. *** This bug has been marked as a duplicate of bug 431026 *** |