Community
Participate
Working Groups
When running C/C++ Code Analysis (RMB > Run C/C++ Code Analysis) on a project containing an assembly file, then a Null Pointer Exception is thrown.
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 ***