mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
- fix NPE in CPPMethod.isInline
- default base clause visibility for classes is private, others are public
This commit is contained in:
parent
6fa2b47130
commit
99aff8d4bd
2 changed files with 15 additions and 2 deletions
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||
|
@ -67,7 +68,17 @@ public class CPPBaseClause implements ICPPBase {
|
|||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBase#getVisibility()
|
||||
*/
|
||||
public int getVisibility() {
|
||||
return base.getVisibility();
|
||||
int vis = base.getVisibility();
|
||||
|
||||
if( vis == 0 ){
|
||||
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) base.getParent();
|
||||
int key = compSpec.getKey();
|
||||
if( key == ICPPClassType.k_class )
|
||||
vis = ICPPBase.v_private;
|
||||
else
|
||||
vis = ICPPBase.v_public;
|
||||
}
|
||||
return vis;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -208,7 +208,9 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl instanceof IASTFunctionDefinition )
|
||||
return true;
|
||||
|
||||
if( decl == null )
|
||||
return false;
|
||||
|
||||
IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration)decl).getDeclSpecifier();
|
||||
return declSpec.isInline();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue