mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 472325 - Bindings defined in anonymous namespaces should always be
considered file-local Change-Id: I7ec420269256a0790627eac2f0c9890b21e4c14c
This commit is contained in:
parent
6ed25565a6
commit
037f64f533
3 changed files with 32 additions and 4 deletions
|
@ -797,7 +797,7 @@ public class ASTTypeUtil {
|
|||
CCorePlugin.log(e);
|
||||
}
|
||||
} else {
|
||||
IASTNode node = ASTInternal.getDeclaredInSourceFileOnly(binding);
|
||||
IASTNode node = ASTInternal.getDefinitionOfBinding(binding);
|
||||
if (node != null) {
|
||||
IPath filePath = new Path(node.getTranslationUnit().getFilePath());
|
||||
URI uri = UNCPathConverter.getInstance().toURI(filePath);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2014 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2015 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -37,10 +37,38 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* Access to methods on scopes and bindings internal to the parser.
|
||||
*/
|
||||
public class ASTInternal {
|
||||
/**
|
||||
* Returns the definition for an AST binding. Calling this method for an index binding
|
||||
* is considered an error.
|
||||
*
|
||||
* @param binding the binding to get the definition for
|
||||
* @return the definition node for the binding or {@code null}
|
||||
*/
|
||||
public static IASTNode getDefinitionOfBinding(IBinding binding) {
|
||||
if (binding instanceof ICPPInternalBinding) {
|
||||
return ((ICPPInternalBinding) binding).getDefinition();
|
||||
}
|
||||
if (binding instanceof ICInternalBinding) {
|
||||
return ((ICInternalBinding) binding).getDefinition();
|
||||
}
|
||||
assert false;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the declarations for an AST binding. Calling this method for an index binding
|
||||
* is considered an error.
|
||||
*
|
||||
* @param binding the binding to get the declarations for
|
||||
* @return the declaration nodes for the binding, possibly none
|
||||
*/
|
||||
public static IASTNode[] getDeclarationsOfBinding(IBinding binding) {
|
||||
if (binding instanceof ICPPInternalBinding) {
|
||||
return ((ICPPInternalBinding) binding).getDeclarations();
|
||||
}
|
||||
if (binding instanceof ICInternalBinding) {
|
||||
return ((ICInternalBinding) binding).getDeclarations();
|
||||
}
|
||||
assert false;
|
||||
return IASTNode.EMPTY_NODE_ARRAY;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2014 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2015 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -1224,7 +1224,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
if (file == null && !(binding instanceof IIndexBinding)) {
|
||||
IBinding owner= binding.getOwner();
|
||||
if (owner instanceof ICPPNamespace && owner.getNameCharArray().length == 0) {
|
||||
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(getPDOM(), binding, false, glob);
|
||||
IASTNode node= ASTInternal.getDefinitionOfBinding(binding);
|
||||
if (node != null) {
|
||||
file= wpdom.getFileForASTNode(getLinkageID(), node);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue