mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
NPE for illegal friend declarations on global scope, bug 292174.
This commit is contained in:
parent
241e84b54e
commit
0cfed67288
1 changed files with 20 additions and 14 deletions
|
@ -892,11 +892,13 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
if (elaboratedSpecifier.isFriend()) {
|
||||
pdomName.setIsFriendSpecifier(true);
|
||||
PDOMName enclClassName = (PDOMName) pdomName.getEnclosingDefinition();
|
||||
if (enclClassName != null) {
|
||||
PDOMBinding enclClassBinding = enclClassName.getBinding();
|
||||
if (enclClassBinding instanceof PDOMCPPClassType) {
|
||||
((PDOMCPPClassType) enclClassBinding).addFriend(new PDOMCPPFriend(this, pdomName));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (parentNode instanceof ICPPASTFunctionDeclarator) {
|
||||
if (parentNode.getParent() instanceof IASTSimpleDeclaration) {
|
||||
IASTSimpleDeclaration grandparentNode = (IASTSimpleDeclaration) parentNode.getParent();
|
||||
|
@ -904,6 +906,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
if (((ICPPASTDeclSpecifier) grandparentNode.getDeclSpecifier()).isFriend()) {
|
||||
pdomName.setIsFriendSpecifier(true);
|
||||
PDOMName enclClassName = (PDOMName) pdomName.getEnclosingDefinition();
|
||||
if (enclClassName != null) {
|
||||
PDOMBinding enclClassBinding = enclClassName.getBinding();
|
||||
if (enclClassBinding instanceof PDOMCPPClassType) {
|
||||
((PDOMCPPClassType) enclClassBinding).addFriend(new PDOMCPPFriend(this, pdomName));
|
||||
|
@ -913,6 +916,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage#getUsingDirectives()
|
||||
|
@ -952,6 +956,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
}
|
||||
if (pdomName.isFriendSpecifier()) {
|
||||
PDOMName enclClassName = (PDOMName) pdomName.getEnclosingDefinition();
|
||||
if (enclClassName != null) {
|
||||
PDOMBinding enclClassBinding = enclClassName.getBinding();
|
||||
if (enclClassBinding instanceof PDOMCPPClassType) {
|
||||
PDOMCPPClassType ownerClass = (PDOMCPPClassType) enclClassBinding;
|
||||
|
@ -959,6 +964,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PDOMFile getLocalToFile(IBinding binding, PDOMBinding glob) throws CoreException {
|
||||
|
|
Loading…
Add table
Reference in a new issue