mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Merge remote-tracking branch 'cdt/master' into sd90
This commit is contained in:
commit
0760f3ce02
18 changed files with 159 additions and 67 deletions
|
@ -345,7 +345,7 @@ public class CProjectDescriptionDeltaTests extends BaseTestCase{
|
|||
ICConfigurationDescription cfgDescription = prjDescription.getConfigurations()[0];
|
||||
assertNotNull(cfgDescription);
|
||||
|
||||
// Modification SOURCE_ENTENSIONS
|
||||
// Modification SOURCE_EXTENSIONS
|
||||
ICLanguageSetting langSetting = cfgDescription.getLanguageSettingForFile(file.getProjectRelativePath(), false);
|
||||
final String testContentType = CCorePlugin.CONTENT_TYPE_ASMSOURCE;
|
||||
langSetting.setSourceContentTypeIds(new String[] {testContentType});
|
||||
|
@ -362,11 +362,11 @@ public class CProjectDescriptionDeltaTests extends BaseTestCase{
|
|||
// Analyze delta
|
||||
ICDescriptionDelta rootDelta = listener.getDelta();
|
||||
assertNotNull(rootDelta);
|
||||
List<ICDescriptionDelta> deltas = findDeltas(rootDelta, ICDescriptionDelta.SOURCE_ENTENSIONS);
|
||||
List<ICDescriptionDelta> deltas = findDeltas(rootDelta, ICDescriptionDelta.SOURCE_EXTENSIONS);
|
||||
assertEquals(1, deltas.size());
|
||||
ICDescriptionDelta delta = deltas.get(0);
|
||||
assertNotNull(delta);
|
||||
// assertEquals(ICDescriptionDelta.SOURCE_ENTENSIONS, delta.getChangeFlags());
|
||||
// assertEquals(ICDescriptionDelta.SOURCE_EXTENSIONS, delta.getChangeFlags());
|
||||
|
||||
// Check old setting
|
||||
assertTrue(delta.getOldSetting() instanceof ICLanguageSetting);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Symbian Software Systems and others.
|
||||
* Copyright (c) 2008, 2012 Symbian 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
|
||||
|
@ -86,7 +86,8 @@ public class SemanticsTests extends AST2BaseTest {
|
|||
// operator A(); // conversion
|
||||
// operator B(); // conversion
|
||||
// };
|
||||
public void testGetDeclaredConversionOperators() throws Exception {
|
||||
public void testConversionOperators() throws Exception {
|
||||
// Test getDeclaredConversionOperators()
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
|
||||
ICPPClassType c= ba.assertNonProblem("X {", 1, ICPPClassType.class);
|
||||
ICPPMethod[] cops= SemanticUtil.getDeclaredConversionOperators(c);
|
||||
|
@ -96,11 +97,8 @@ public class SemanticsTests extends AST2BaseTest {
|
|||
Set expected= new HashSet();
|
||||
expected.add("operator A"); expected.add("operator B");
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
public void testIsConversionOperator() throws Exception {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
|
||||
ICPPClassType c= ba.assertNonProblem("X {", 1, ICPPClassType.class);
|
||||
// Test isConversionOperator()
|
||||
ICPPMethod[] dms= c.getDeclaredMethods();
|
||||
assertEquals(48, dms.length);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2012 Symbian 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
|
||||
|
@ -283,9 +283,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertInstance(b0, ICPPMethod.class);
|
||||
assertEquals(1, getIndex().findNames(b0, IIndex.FIND_REFERENCES).length);
|
||||
IParameter[] parameters = ((ICPPMethod) b0).getParameters();
|
||||
System.out.println(String.valueOf(parameters));
|
||||
IFunctionType type = ((ICPPMethod) b0).getType();
|
||||
System.out.println(String.valueOf(type));
|
||||
}
|
||||
|
||||
// template<typename T>
|
||||
|
|
|
@ -70,7 +70,19 @@ public class TestSourceReader {
|
|||
*/
|
||||
public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz,
|
||||
final String testName, int sections) throws IOException {
|
||||
// Walk up the class inheritance chain until we find the test method.
|
||||
try {
|
||||
while (clazz.getMethod(testName).getDeclaringClass() != clazz) {
|
||||
clazz = clazz.getSuperclass();
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
Assert.fail(e.getMessage());
|
||||
} catch (NoSuchMethodException e) {
|
||||
Assert.fail(e.getMessage());
|
||||
}
|
||||
|
||||
while (true) {
|
||||
// Find and open the .java file for the class clazz.
|
||||
String fqn = clazz.getName().replace('.', '/');
|
||||
fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$"));
|
||||
String classFile = fqn + ".java";
|
||||
|
@ -94,6 +106,7 @@ public class TestSourceReader {
|
|||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
try {
|
||||
// Read the java file collecting comments until we encounter the test method.
|
||||
List<StringBuilder> contents = new ArrayList<StringBuilder>();
|
||||
StringBuilder content = new StringBuilder();
|
||||
for (String line = br.readLine(); line != null; line = br.readLine()) {
|
||||
|
|
|
@ -168,7 +168,7 @@ public class CProjectDescriptionDelta implements ICDescriptionDelta {
|
|||
if ((flags&DESCRIPTION)!=0) str.append("DESCRIPTION|");
|
||||
if ((flags&LANGUAGE_ID)!=0) str.append("LANGUAGE_ID|");
|
||||
if ((flags&SOURCE_CONTENT_TYPE)!=0) str.append("SOURCE_CONTENT_TYPE|");
|
||||
if ((flags&SOURCE_ENTENSIONS)!=0) str.append("SOURCE_ENTENSIONS|");
|
||||
if ((flags&SOURCE_EXTENSIONS)!=0) str.append("SOURCE_EXTENSIONS|");
|
||||
if ((flags&SETTING_ENTRIES)!=0) str.append("SETTING_ENTRIES|");
|
||||
if ((flags&BINARY_PARSER_IDS)!=0) str.append("BINARY_PARSER_IDS|");
|
||||
if ((flags&ERROR_PARSER_IDS)!=0) str.append("ERROR_PARSER_IDS|");
|
||||
|
|
|
@ -1855,7 +1855,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
String[] newExts = newLs.getSourceExtensions();
|
||||
String[] oldExts = oldLs.getSourceExtensions();
|
||||
if(!Arrays.equals(newExts, oldExts))
|
||||
delta.addChangeFlags(ICDescriptionDelta.SOURCE_ENTENSIONS);
|
||||
delta.addChangeFlags(ICDescriptionDelta.SOURCE_EXTENSIONS);
|
||||
|
||||
|
||||
// newCt = newLs.getHeaderContentType();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2010 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2008, 2012 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
|
||||
|
@ -12,6 +12,7 @@
|
|||
package org.eclipse.cdt.core.index;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
||||
import org.eclipse.cdt.internal.core.index.IndexFileSet;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
@ -60,4 +61,11 @@ public interface IIndexFileSet {
|
|||
* @noreference This method is not intended to be referenced by clients.
|
||||
*/
|
||||
void remove(IIndexFile indexFile);
|
||||
|
||||
/**
|
||||
* Checks whether the given binding has a non-local declaration in
|
||||
* another index fragment.
|
||||
* @noreference This method is not intended to be referenced by clients.
|
||||
*/
|
||||
boolean containsNonLocalDeclaration(IBinding binding, IIndexFragment ignore);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2012 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
|
||||
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.dom.parser;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
|
@ -22,6 +23,7 @@ import org.eclipse.cdt.internal.core.dom.parser.c.ICInternalBinding;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.c.ICInternalFunction;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalFunction;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
@ -72,7 +74,7 @@ public class ASTInternal {
|
|||
}
|
||||
}
|
||||
|
||||
public static IASTNode getDeclaredInSourceFileOnly(IBinding binding, boolean requireDefinition, PDOMBinding nonLocal) {
|
||||
public static IASTNode getDeclaredInSourceFileOnly(IIndexFragment forFragment, IBinding binding, boolean requireDefinition, PDOMBinding nonLocal) {
|
||||
IASTNode[] decls;
|
||||
IASTNode def;
|
||||
if (binding instanceof ICPPInternalBinding) {
|
||||
|
@ -105,6 +107,9 @@ public class ASTInternal {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (result == null)
|
||||
return null;
|
||||
|
||||
if (requireDefinition && nonLocal != null) {
|
||||
try {
|
||||
if (nonLocal.hasDeclaration())
|
||||
|
@ -112,6 +117,12 @@ public class ASTInternal {
|
|||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
|
||||
IASTTranslationUnit tu= result.getTranslationUnit();
|
||||
if (tu != null) {
|
||||
if (tu.getIndexFileSet().containsNonLocalDeclaration(binding, forFragment))
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2012 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
|
||||
|
@ -58,6 +58,7 @@ public interface IIndexFragment {
|
|||
*/
|
||||
final int FIND_ALL_OCCURRENCES = IIndex.FIND_ALL_OCCURRENCES;
|
||||
|
||||
final int FIND_NON_LOCAL_ONLY= 0x10000;
|
||||
/**
|
||||
* Property key for the fragment ID. The fragment ID should uniquely identify the fragments
|
||||
* usage within a logical index.
|
||||
|
@ -223,8 +224,8 @@ public interface IIndexFragment {
|
|||
* Searches for all names that resolve to the given binding. You can limit the result to
|
||||
* references, declarations or definitions, or a combination of those.
|
||||
* @param binding a binding for which names are searched for
|
||||
* @param flags a combination of {@link #FIND_DECLARATIONS}, {@link #FIND_DEFINITIONS} and
|
||||
* {@link #FIND_REFERENCES}
|
||||
* @param flags a combination of {@link #FIND_DECLARATIONS}, {@link #FIND_DEFINITIONS},
|
||||
* {@link #FIND_REFERENCES} and {@link #FIND_NON_LOCAL_ONLY}
|
||||
* @return an array of names
|
||||
* @throws CoreException
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2010 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2008, 2012 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
|
||||
|
@ -29,6 +29,7 @@ public class IndexFileSet implements IIndexFileSet {
|
|||
public IndexFileSet() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(IIndexFile indexFile) {
|
||||
final IIndexFragmentFile fragFile = (IIndexFragmentFile) indexFile;
|
||||
final IIndexFragment frag= fragFile.getIndexFragment();
|
||||
|
@ -40,6 +41,7 @@ public class IndexFileSet implements IIndexFileSet {
|
|||
subSet.add(fragFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(IIndexFile indexFile) {
|
||||
final IIndexFragmentFile fragFile = (IIndexFragmentFile) indexFile;
|
||||
final IIndexFragment frag= fragFile.getIndexFragment();
|
||||
|
@ -49,21 +51,16 @@ public class IndexFileSet implements IIndexFileSet {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsDeclaration(IIndexBinding binding) {
|
||||
return containsDeclaration(binding, false);
|
||||
}
|
||||
|
||||
boolean containsDeclaration(IIndexBinding binding, boolean inverse) {
|
||||
for (Map.Entry<IIndexFragment, IIndexFragmentFileSet> entry : fSubSets.entrySet()) {
|
||||
try {
|
||||
IIndexFragmentName[] names =
|
||||
entry.getKey().findNames(binding, IIndexFragment.FIND_DECLARATIONS_DEFINITIONS);
|
||||
for (IIndexFragmentName name : names) {
|
||||
try {
|
||||
final boolean foundDecl = entry.getValue().contains((IIndexFragmentFile) name.getFile());
|
||||
if (foundDecl != inverse) {
|
||||
if (entry.getValue().contains((IIndexFragmentFile) name.getFile()))
|
||||
return true;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
|
@ -75,6 +72,33 @@ public class IndexFileSet implements IIndexFileSet {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsNonLocalDeclaration(IBinding binding, IIndexFragment ignore) {
|
||||
for (Map.Entry<IIndexFragment, IIndexFragmentFileSet> entry : fSubSets.entrySet()) {
|
||||
try {
|
||||
final IIndexFragment fragment = entry.getKey();
|
||||
final IIndexFragmentFileSet subset = entry.getValue();
|
||||
if (fragment != ignore) {
|
||||
IIndexFragmentName[] names =
|
||||
fragment.findNames(binding, IIndexFragment.FIND_DECLARATIONS_DEFINITIONS | IIndexFragment.FIND_NON_LOCAL_ONLY);
|
||||
for (IIndexFragmentName name : names) {
|
||||
try {
|
||||
if (subset.contains((IIndexFragmentFile) name.getFile())) {
|
||||
return true;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding[] filterFileLocalBindings(IBinding[] bindings) {
|
||||
return filterFileLocalBindings(bindings, false);
|
||||
}
|
||||
|
@ -131,6 +155,7 @@ public class IndexFileSet implements IIndexFileSet {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(IIndexFile file) throws CoreException {
|
||||
return contains(file, false);
|
||||
}
|
||||
|
@ -150,29 +175,40 @@ public class IndexFileSet implements IIndexFileSet {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.index.IIndexFileSet#invert()
|
||||
*/
|
||||
@Override
|
||||
public IIndexFileSet invert() {
|
||||
if (fInverse == null) {
|
||||
fInverse= new IIndexFileSet() {
|
||||
@Override
|
||||
public IIndexFileSet invert() {
|
||||
return IndexFileSet.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding[] filterFileLocalBindings(IBinding[] bindings) {
|
||||
return IndexFileSet.this.filterFileLocalBindings(bindings, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsDeclaration(IIndexBinding binding) {
|
||||
return IndexFileSet.this.containsDeclaration(binding, true);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override
|
||||
public boolean containsNonLocalDeclaration(IBinding binding, IIndexFragment ignore) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(IIndexFile file) throws CoreException {
|
||||
return IndexFileSet.this.contains(file, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(IIndexFile indexFile) {
|
||||
Assert.isLegal(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(IIndexFile indexFile) {
|
||||
Assert.isLegal(false);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2011 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 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
|
||||
|
@ -532,7 +532,7 @@ public class PDOM extends PlatformObject implements IPDOM {
|
|||
if (binding != null) {
|
||||
PDOMLinkage linkage= adaptLinkage(name.getLinkage());
|
||||
if (linkage != null) {
|
||||
return findBindingInLinkage(linkage, binding);
|
||||
return findBindingInLinkage(linkage, binding, true);
|
||||
}
|
||||
} else if (name.getPropertyInParent() == IASTPreprocessorStatement.MACRO_NAME) {
|
||||
PDOMLinkage linkage= adaptLinkage(name.getLinkage());
|
||||
|
@ -993,6 +993,10 @@ public class PDOM extends PlatformObject implements IPDOM {
|
|||
|
||||
@Override
|
||||
public IIndexFragmentBinding adaptBinding(IBinding binding) throws CoreException {
|
||||
return adaptBinding(binding, true);
|
||||
}
|
||||
|
||||
private IIndexFragmentBinding adaptBinding(IBinding binding, boolean includeLocal) throws CoreException {
|
||||
if (binding == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1003,16 +1007,16 @@ public class PDOM extends PlatformObject implements IPDOM {
|
|||
|
||||
PDOMLinkage linkage= adaptLinkage(binding.getLinkage());
|
||||
if (linkage != null) {
|
||||
return findBindingInLinkage(linkage, binding);
|
||||
return findBindingInLinkage(linkage, binding, includeLocal);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private IIndexFragmentBinding findBindingInLinkage(PDOMLinkage linkage, IBinding binding) throws CoreException {
|
||||
private IIndexFragmentBinding findBindingInLinkage(PDOMLinkage linkage, IBinding binding, boolean includeLocal) throws CoreException {
|
||||
if (binding instanceof IMacroBinding || binding instanceof IIndexMacroContainer) {
|
||||
return linkage.findMacroContainer(binding.getNameCharArray());
|
||||
}
|
||||
return linkage.adaptBinding(binding);
|
||||
return linkage.adaptBinding(binding, includeLocal);
|
||||
}
|
||||
|
||||
public IIndexFragmentBinding findBinding(IIndexFragmentName indexName) throws CoreException {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2011 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 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
|
||||
|
@ -146,9 +146,11 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
|
|||
getIndex().accept((IBTreeVisitor) visitor);
|
||||
} else {
|
||||
getIndex().accept(new IBTreeVisitor() {
|
||||
@Override
|
||||
public int compare(long record) throws CoreException {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean visit(long record) throws CoreException {
|
||||
PDOMNode node= getNode(record);
|
||||
if (node != null) {
|
||||
|
@ -217,7 +219,11 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
|
|||
return (PDOMBinding) fPDOM.getCachedResult(binding);
|
||||
}
|
||||
|
||||
public abstract PDOMBinding adaptBinding(IBinding binding) throws CoreException;
|
||||
public final PDOMBinding adaptBinding(IBinding binding) throws CoreException {
|
||||
return adaptBinding(binding, true);
|
||||
}
|
||||
|
||||
public abstract PDOMBinding adaptBinding(IBinding binding, boolean includeLocal) throws CoreException;
|
||||
|
||||
public abstract PDOMBinding addBinding(IASTName name) throws CoreException;
|
||||
|
||||
|
@ -256,7 +262,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
|
|||
}
|
||||
|
||||
if (checkIfInSourceOnly) {
|
||||
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(binding, requireDefinition, glob);
|
||||
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(getPDOM(), binding, requireDefinition, glob);
|
||||
if (node != null) {
|
||||
return wpdom.getFileForASTNode(getLinkageID(), node);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2010 QNX Software Systems and others.
|
||||
* Copyright (c) 2006, 2012 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
|
||||
|
@ -62,10 +62,12 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants {
|
|||
return LINKAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLinkageName() {
|
||||
return C_LINKAGE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLinkageID() {
|
||||
return C_LINKAGE_ID;
|
||||
}
|
||||
|
@ -226,8 +228,8 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final PDOMBinding adaptBinding(final IBinding inputBinding) throws CoreException {
|
||||
return adaptBinding(null, inputBinding, FILE_LOCAL_REC_DUMMY);
|
||||
public final PDOMBinding adaptBinding(final IBinding inputBinding, boolean includeLocal) throws CoreException {
|
||||
return adaptBinding(null, inputBinding, includeLocal ? FILE_LOCAL_REC_DUMMY : null);
|
||||
}
|
||||
|
||||
private final PDOMBinding adaptBinding(final PDOMNode parent, IBinding inputBinding, long[] localToFileHolder) throws CoreException {
|
||||
|
@ -264,6 +266,9 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants {
|
|||
final int[] bindingTypes = new int[] {getBindingType(binding)};
|
||||
final char[] nameChars = binding.getNameCharArray();
|
||||
PDOMBinding nonLocal= FindBinding.findBinding(getIndex(), this, nameChars, bindingTypes, 0);
|
||||
if (localToFileHolder == null)
|
||||
return nonLocal;
|
||||
|
||||
long localToFileRec= getLocalToFileRec(parent, binding, nonLocal);
|
||||
if (localToFileRec == 0)
|
||||
return nonLocal;
|
||||
|
@ -274,6 +279,9 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants {
|
|||
final int[] bindingTypes = new int[] {getBindingType(binding)};
|
||||
final char[] nameChars = binding.getNameCharArray();
|
||||
PDOMBinding nonLocal= FindBinding.findBinding(parent, this, nameChars, bindingTypes, 0);
|
||||
if (localToFileHolder == null)
|
||||
return nonLocal;
|
||||
|
||||
long localToFileRec= getLocalToFileRec(parent, binding, nonLocal);
|
||||
if (localToFileRec == 0)
|
||||
return nonLocal;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2011 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 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
|
||||
|
@ -609,8 +609,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final PDOMBinding adaptBinding(final IBinding inputBinding) throws CoreException {
|
||||
return adaptBinding(null, inputBinding, FILE_LOCAL_REC_DUMMY);
|
||||
public final PDOMBinding adaptBinding(final IBinding inputBinding, boolean includeLocal) throws CoreException {
|
||||
return adaptBinding(null, inputBinding, includeLocal ? FILE_LOCAL_REC_DUMMY : null);
|
||||
}
|
||||
|
||||
private final PDOMBinding adaptBinding(final PDOMNode parent, IBinding inputBinding, long[] fileLocalRecHolder) throws CoreException {
|
||||
|
@ -661,6 +661,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
}
|
||||
if (parent == this) {
|
||||
PDOMBinding glob= CPPFindBinding.findBinding(getIndex(), this, binding, 0);
|
||||
if (fileLocalRecHolder == null)
|
||||
return glob;
|
||||
final long loc= getLocalToFileRec(parent, binding, glob);
|
||||
if (loc == 0)
|
||||
return glob;
|
||||
|
@ -670,6 +672,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
if (parent instanceof PDOMCPPNamespace) {
|
||||
final BTree btree = ((PDOMCPPNamespace) parent).getIndex();
|
||||
PDOMBinding glob= CPPFindBinding.findBinding(btree, this, binding, 0);
|
||||
if (fileLocalRecHolder == null)
|
||||
return glob;
|
||||
final long loc= getLocalToFileRec(parent, binding, glob);
|
||||
if (loc == 0)
|
||||
return glob;
|
||||
|
@ -993,7 +997,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
file= wpdom.getFileForASTNode(getLinkageID(), node);
|
||||
}
|
||||
} else if (binding instanceof ICPPNamespaceAlias) {
|
||||
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(binding, false, glob);
|
||||
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(getPDOM(), binding, false, glob);
|
||||
if (node != null) {
|
||||
file= wpdom.getFileForASTNode(getLinkageID(), node);
|
||||
}
|
||||
|
@ -1002,7 +1006,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
IBinding owner= binding.getOwner();
|
||||
if (owner instanceof ICPPNamespace) {
|
||||
if (owner.getNameCharArray().length == 0) {
|
||||
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(owner, false, glob);
|
||||
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(getPDOM(), owner, false, glob);
|
||||
if (node != null) {
|
||||
file= wpdom.getFileForASTNode(getLinkageID(), node);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||
* Sergey Prigogin, Google
|
||||
* Sergey Prigogin (Google)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Andrew Gvozdev
|
||||
*******************************************************************************/
|
||||
|
@ -42,8 +42,7 @@ public class AbstractAutoEditTest extends BaseTestCase {
|
|||
* Split out from CAutoIndentTest.
|
||||
*/
|
||||
protected static class AutoEditTester {
|
||||
|
||||
private IAutoEditStrategy tabsToSpacesConverter=null;
|
||||
private IAutoEditStrategy tabsToSpacesConverter;
|
||||
private Map<String, IAutoEditStrategy> fStrategyMap = new HashMap<String, IAutoEditStrategy>();
|
||||
IDocument fDoc;
|
||||
private String fPartitioning;
|
||||
|
@ -236,8 +235,8 @@ public class AbstractAutoEditTest extends BaseTestCase {
|
|||
protected CharSequence[] getTestContents() {
|
||||
try {
|
||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 2);
|
||||
} catch(IOException ioe) {
|
||||
fail(ioe.getMessage());
|
||||
} catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -245,8 +244,8 @@ public class AbstractAutoEditTest extends BaseTestCase {
|
|||
protected CharSequence[] getTestContents1() {
|
||||
try {
|
||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 1);
|
||||
} catch(IOException ioe) {
|
||||
fail(ioe.getMessage());
|
||||
} catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
|
||||
* Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
|
||||
* Rapperswil, University of applied sciences and others
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
|
@ -7,8 +7,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Marc-Andre Laperle
|
||||
* Institute for Software - initial API and implementation
|
||||
* Marc-Andre Laperle
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.refactoring.implementmethod;
|
||||
|
||||
|
@ -91,14 +91,20 @@ public class ImplementMethodRefactoring extends CRefactoring2 {
|
|||
super.checkInitialConditions(sm.newChild(6));
|
||||
|
||||
if (!initStatus.hasFatalError()) {
|
||||
data.setMethodDeclarations(findUnimplementedMethodDeclarations(pm));
|
||||
List<IASTSimpleDeclaration> unimplementedMethodDeclarations = findUnimplementedMethodDeclarations(pm);
|
||||
if (unimplementedMethodDeclarations.isEmpty()) {
|
||||
initStatus.addFatalError(Messages.ImplementMethodRefactoring_NoMethodToImplement);
|
||||
}
|
||||
else {
|
||||
data.setMethodDeclarations(unimplementedMethodDeclarations);
|
||||
|
||||
if (selectedRegion.getLength() > 0) {
|
||||
IASTSimpleDeclaration methodDeclaration = SelectionHelper.findFirstSelectedDeclaration(selectedRegion, astCache.getAST(tu, pm));
|
||||
if (NodeHelper.isMethodDeclaration(methodDeclaration)) {
|
||||
for (MethodToImplementConfig config : data.getMethodDeclarations()) {
|
||||
if (config.getDeclaration() == methodDeclaration) {
|
||||
config.setChecked(true);
|
||||
if (selectedRegion.getLength() > 0) {
|
||||
IASTSimpleDeclaration methodDeclaration = SelectionHelper.findFirstSelectedDeclaration(selectedRegion, astCache.getAST(tu, pm));
|
||||
if (NodeHelper.isMethodDeclaration(methodDeclaration)) {
|
||||
for (MethodToImplementConfig config : data.getMethodDeclarations()) {
|
||||
if (config.getDeclaration() == methodDeclaration) {
|
||||
config.setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2012 IBM Corporation 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
|
||||
|
@ -21,7 +21,7 @@ public final class Messages extends NLS {
|
|||
public static String ImplementMethodRefactoringPage_GeneratingPreview;
|
||||
public static String ImplementMethodRefactoringPage_PreviewCanceled;
|
||||
public static String ImplementMethodRefactoringPage_PreviewGenerationNotPossible;
|
||||
public static String ImplementMethodRefactoring_NoMethodSelected;
|
||||
public static String ImplementMethodRefactoring_NoMethodToImplement;
|
||||
public static String ImplementMethodRefactoring_MethodHasImpl;
|
||||
public static String ImplementMethodRefactoring_NoImplFile;
|
||||
public static String ImplementMethodRefactoringWizard_CancelingPreviewGeneration;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
|
||||
# Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
|
||||
# Rapperswil, University of applied sciences and others
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
|
@ -20,7 +20,7 @@ ImplementMethodInputPage_DeselectAll=Deselect All
|
|||
ImplementMethodRefactoringPage_PreviewGenerationNotPossible=Preview generation not possible
|
||||
ImplementMethodRefactoringPage_GeneratingPreview=Generating preview...
|
||||
ImplementMethodRefactoringPage_PreviewCanceled=Preview canceled
|
||||
ImplementMethodRefactoring_NoMethodSelected=No method declaration selected
|
||||
ImplementMethodRefactoring_NoMethodToImplement=No methods to implement found.
|
||||
ImplementMethodRefactoring_MethodHasImpl=This method already has an implementation.
|
||||
ImplementMethodRefactoring_NoImplFile=No implementation file found for one or more method. Inserting definition(s) into the header file.
|
||||
ImplementMethodRefactoringWizard_CancelingPreviewGeneration=Canceling preview generation
|
Loading…
Add table
Reference in a new issue