mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Merge branch 'cdt/master' into sd90
This commit is contained in:
commit
8501c97f9b
179 changed files with 982 additions and 477 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
* Copyright (c) 2004, 2011 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -87,9 +87,13 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file!=null) {
|
if (file!=null) {
|
||||||
String filePath = new Path(fileName).toString();
|
IPath filePath = new Path(fileName);
|
||||||
String foundLocation = file.getLocation().toString();
|
if(filePath.segment(0).compareTo("..") == 0) { //$NON-NLS-1$
|
||||||
if (!foundLocation.endsWith(filePath)) {
|
filePath = filePath.removeFirstSegments(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
String foundLocation = file.getLocationURI().toString();
|
||||||
|
if (!foundLocation.endsWith(filePath.toString())) {
|
||||||
file = null;
|
file = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
0
build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalc2/test1DepCalc2.zip
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalc2/test1DepCalc2.zip
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalc3/test1DepCalc3.zip
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalc3/test1DepCalc3.zip
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalcPreBuild/test1DepCalcPreBuild.zip
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalcPreBuild/test1DepCalcPreBuild.zip
Executable file → Normal file
|
@ -7,16 +7,16 @@ Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Export-Package: org.eclipse.cdt.build.core.scannerconfig,
|
Export-Package: org.eclipse.cdt.build.core.scannerconfig,
|
||||||
org.eclipse.cdt.build.internal.core.scannerconfig;x-internal:=true,
|
org.eclipse.cdt.build.internal.core.scannerconfig;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
||||||
org.eclipse.cdt.build.internal.core.scannerconfig2;x-internal:=true,
|
org.eclipse.cdt.build.internal.core.scannerconfig2;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
||||||
org.eclipse.cdt.managedbuilder.buildmodel,
|
org.eclipse.cdt.managedbuilder.buildmodel,
|
||||||
org.eclipse.cdt.managedbuilder.buildproperties,
|
org.eclipse.cdt.managedbuilder.buildproperties,
|
||||||
org.eclipse.cdt.managedbuilder.core,
|
org.eclipse.cdt.managedbuilder.core,
|
||||||
org.eclipse.cdt.managedbuilder.envvar,
|
org.eclipse.cdt.managedbuilder.envvar,
|
||||||
org.eclipse.cdt.managedbuilder.internal.buildmodel;x-internal:=true,
|
org.eclipse.cdt.managedbuilder.internal.buildmodel;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
||||||
org.eclipse.cdt.managedbuilder.internal.core;x-internal:=true,
|
org.eclipse.cdt.managedbuilder.internal.core;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
||||||
org.eclipse.cdt.managedbuilder.internal.envvar;x-internal:=true,
|
org.eclipse.cdt.managedbuilder.internal.envvar;x-internal:=true,
|
||||||
org.eclipse.cdt.managedbuilder.internal.macros;x-internal:=true,
|
org.eclipse.cdt.managedbuilder.internal.macros;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
||||||
org.eclipse.cdt.managedbuilder.internal.scannerconfig;x-internal:=true,
|
org.eclipse.cdt.managedbuilder.internal.scannerconfig;x-internal:=true,
|
||||||
org.eclipse.cdt.managedbuilder.macros,
|
org.eclipse.cdt.managedbuilder.macros,
|
||||||
org.eclipse.cdt.managedbuilder.makegen,
|
org.eclipse.cdt.managedbuilder.makegen,
|
||||||
|
@ -25,7 +25,7 @@ Export-Package: org.eclipse.cdt.build.core.scannerconfig,
|
||||||
org.eclipse.cdt.managedbuilder.pdomdepgen,
|
org.eclipse.cdt.managedbuilder.pdomdepgen,
|
||||||
org.eclipse.cdt.managedbuilder.projectconverter,
|
org.eclipse.cdt.managedbuilder.projectconverter,
|
||||||
org.eclipse.cdt.managedbuilder.scannerconfig,
|
org.eclipse.cdt.managedbuilder.scannerconfig,
|
||||||
org.eclipse.cdt.managedbuilder.tcmodification;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.core.tests",
|
org.eclipse.cdt.managedbuilder.tcmodification;x-friends:="org.eclipse.cdt.managedbuilder.ui,org.eclipse.cdt.managedbuilder.core.tests",
|
||||||
org.eclipse.cdt.managedbuilder.templateengine,
|
org.eclipse.cdt.managedbuilder.templateengine,
|
||||||
org.eclipse.cdt.managedbuilder.templateengine.processes,
|
org.eclipse.cdt.managedbuilder.templateengine.processes,
|
||||||
org.eclipse.cdt.newmake.core
|
org.eclipse.cdt.newmake.core
|
||||||
|
|
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyCalculator.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyCalculator.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyCommands.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyCommands.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyGeneratorType.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyGeneratorType.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyInfo.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyInfo.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyPreBuild.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyPreBuild.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuDependencyGroupInfo.java
Executable file → Normal file
0
build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuDependencyGroupInfo.java
Executable file → Normal file
|
@ -10,14 +10,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.core.internal.checkers;
|
package org.eclipse.cdt.codan.core.internal.checkers;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.core.param.IProblemPreference;
|
import org.eclipse.cdt.codan.core.param.IProblemPreference;
|
||||||
import org.eclipse.cdt.codan.core.test.CheckerTestCase;
|
import org.eclipse.cdt.codan.core.test.CheckerTestCase;
|
||||||
import org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectChecker;
|
import org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectChecker;
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for {@see StatementHasNoEffectChecker} class
|
* Test for {@see StatementHasNoEffectChecker} class
|
||||||
*
|
*
|
||||||
|
@ -107,7 +107,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
|
||||||
// }
|
// }
|
||||||
/* this test is using two files */
|
/* this test is using two files */
|
||||||
public void test2FilesUnaryExpression() throws IOException {
|
public void test2FilesUnaryExpression() throws IOException {
|
||||||
StringBuffer[] code = getContents(2);
|
CharSequence[] code = getContents(2);
|
||||||
File f1 = loadcode(code[0].toString());
|
File f1 = loadcode(code[0].toString());
|
||||||
File f2 = loadcode(code[1].toString());
|
File f2 = loadcode(code[1].toString());
|
||||||
runOnProject();
|
runOnProject();
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.core.test;
|
package org.eclipse.cdt.codan.core.test;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.core.CodanRuntime;
|
import org.eclipse.cdt.codan.core.CodanRuntime;
|
||||||
|
@ -45,6 +42,9 @@ import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: add description
|
* TODO: add description
|
||||||
*/
|
*/
|
||||||
|
@ -56,7 +56,7 @@ public abstract class CodanFastCxxAstTestCase extends TestCase {
|
||||||
return getContents(1)[0].toString();
|
return getContents(1)[0].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuffer[] getContents(int sections) {
|
protected StringBuilder[] getContents(int sections) {
|
||||||
try {
|
try {
|
||||||
CodanCoreTestActivator plugin = CodanCoreTestActivator.getDefault();
|
CodanCoreTestActivator plugin = CodanCoreTestActivator.getDefault();
|
||||||
return TestSourceReader.getContentsForTest(plugin == null ? null : plugin.getBundle(), "src", getClass(), getName(), sections);
|
return TestSourceReader.getContentsForTest(plugin == null ? null : plugin.getBundle(), "src", getClass(), getName(), sections);
|
||||||
|
@ -69,6 +69,7 @@ public abstract class CodanFastCxxAstTestCase extends TestCase {
|
||||||
public boolean isCpp() {
|
public boolean isCpp() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final NullLogService NULL_LOG = new NullLogService();
|
private static final NullLogService NULL_LOG = new NullLogService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,12 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.core.test;
|
package org.eclipse.cdt.codan.core.test;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
|
@ -36,6 +30,12 @@ import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Plugin;
|
import org.eclipse.core.runtime.Plugin;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: add description
|
* TODO: add description
|
||||||
*/
|
*/
|
||||||
|
@ -170,9 +170,10 @@ public class CodanTestCase extends BaseTestCase {
|
||||||
return getContents(1)[0].toString();
|
return getContents(1)[0].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuffer[] getContents(int sections) {
|
protected StringBuilder[] getContents(int sections) {
|
||||||
try {
|
try {
|
||||||
return TestSourceReader.getContentsForTest(getPlugin().getBundle(), getSourcePrefix(), getClass(), getName(), sections);
|
return TestSourceReader.getContentsForTest(getPlugin().getBundle(), getSourcePrefix(),
|
||||||
|
getClass(), getName(), sections);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
fail(e.getMessage());
|
fail(e.getMessage());
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -10,16 +10,16 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
|
package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.core.test.TestUtils;
|
import org.eclipse.cdt.codan.core.test.TestUtils;
|
||||||
import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
|
import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
|
||||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for quick fix for suggested parenthesis
|
* Test for quick fix for suggested parenthesis
|
||||||
*/
|
*/
|
||||||
|
@ -53,7 +53,7 @@ public class SuggestedParenthesisQuickFixTest extends QuickFixTestCase {
|
||||||
* quick fix is not called
|
* quick fix is not called
|
||||||
*/
|
*/
|
||||||
public void test2FilesExample() throws FileNotFoundException, IOException {
|
public void test2FilesExample() throws FileNotFoundException, IOException {
|
||||||
StringBuffer[] code = getContents(2);
|
CharSequence[] code = getContents(2);
|
||||||
File f1 = loadcode(code[0].toString());
|
File f1 = loadcode(code[0].toString());
|
||||||
File f2 = loadcode(code[1].toString());
|
File f2 = loadcode(code[1].toString());
|
||||||
// lets pretend marker is found in main.c but fixes go in both files,
|
// lets pretend marker is found in main.c but fixes go in both files,
|
||||||
|
|
0
core/org.eclipse.cdt.core.macosx/os/macosx/x86/libpty.jnilib
Executable file → Normal file
0
core/org.eclipse.cdt.core.macosx/os/macosx/x86/libpty.jnilib
Executable file → Normal file
0
core/org.eclipse.cdt.core.macosx/os/macosx/x86/libspawner.jnilib
Executable file → Normal file
0
core/org.eclipse.cdt.core.macosx/os/macosx/x86/libspawner.jnilib
Executable file → Normal file
|
@ -473,7 +473,7 @@ public class AST2BaseTest extends BaseTestCase {
|
||||||
return getContents(1)[0].toString();
|
return getContents(1)[0].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
protected CharSequence[] getContents(int sections) throws IOException {
|
||||||
CTestPlugin plugin = CTestPlugin.getDefault();
|
CTestPlugin plugin = CTestPlugin.getDefault();
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
throw new AssertionFailedError("This test must be run as a JUnit plugin test");
|
throw new AssertionFailedError("This test must be run as a JUnit plugin test");
|
||||||
|
|
|
@ -8060,7 +8060,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
// }
|
// }
|
||||||
public void testInitOfClassObjectsByRValues_294730() throws Exception {
|
public void testInitOfClassObjectsByRValues_294730() throws Exception {
|
||||||
final StringBuffer[] contents = getContents(3);
|
final CharSequence[] contents = getContents(3);
|
||||||
final String code= contents[0].toString();
|
final String code= contents[0].toString();
|
||||||
final String end= contents[2].toString();
|
final String end= contents[2].toString();
|
||||||
parseAndCheckBindings(code + end, ParserLanguage.CPP);
|
parseAndCheckBindings(code + end, ParserLanguage.CPP);
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class AST2FileBasePluginTest extends TestCase {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||||
return TestSourceReader.getContentsForTest(
|
return TestSourceReader.getContentsForTest(
|
||||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4039,7 +4039,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
// ASSERT(false);// fine
|
// ASSERT(false);// fine
|
||||||
// }
|
// }
|
||||||
public void testBug188855_gccExtensionForVariadicMacros() throws Exception {
|
public void testBug188855_gccExtensionForVariadicMacros() throws Exception {
|
||||||
StringBuffer[] buffer = getContents(2);
|
CharSequence[] buffer = getContents(2);
|
||||||
final String content1 = buffer[0].toString();
|
final String content1 = buffer[0].toString();
|
||||||
final String content2 = buffer[1].toString();
|
final String content2 = buffer[1].toString();
|
||||||
parse(content1, ParserLanguage.CPP);
|
parse(content1, ParserLanguage.CPP);
|
||||||
|
@ -4843,7 +4843,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
public void testBug228422_noKnrParam() throws Exception {
|
public void testBug228422_noKnrParam() throws Exception {
|
||||||
StringBuffer buffer = getContents(1)[0];
|
CharSequence buffer = getContents(1)[0];
|
||||||
parse(buffer.toString(), ParserLanguage.C, false);
|
parse(buffer.toString(), ParserLanguage.C, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5262,7 +5262,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
// (typeof a)(t)-a // typeof a,t,a,unary-,cast,cast
|
// (typeof a)(t)-a // typeof a,t,a,unary-,cast,cast
|
||||||
// (typeof a)(a)-a // typeof a,a,cast,a,-
|
// (typeof a)(a)-a // typeof a,a,cast,a,-
|
||||||
public void testBinaryVsCastAmbiguities_Bug237057() throws Exception {
|
public void testBinaryVsCastAmbiguities_Bug237057() throws Exception {
|
||||||
StringBuffer[] input= getContents(2);
|
CharSequence[] input= getContents(2);
|
||||||
String code= input[0].toString();
|
String code= input[0].toString();
|
||||||
String[] samples= input[1].toString().split("\n");
|
String[] samples= input[1].toString().split("\n");
|
||||||
for (ParserLanguage lang : ParserLanguage.values()) {
|
for (ParserLanguage lang : ParserLanguage.values()) {
|
||||||
|
@ -5302,7 +5302,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
// (f)(a)+1 // f,a,(),1,+
|
// (f)(a)+1 // f,a,(),1,+
|
||||||
// (t)(t)+1 // t,t,1,unary+,cast,cast
|
// (t)(t)+1 // t,t,1,unary+,cast,cast
|
||||||
public void testCastVsFunctionCallAmbiguities_Bug237057() throws Exception {
|
public void testCastVsFunctionCallAmbiguities_Bug237057() throws Exception {
|
||||||
StringBuffer[] input= getContents(2);
|
CharSequence[] input= getContents(2);
|
||||||
String code= input[0].toString();
|
String code= input[0].toString();
|
||||||
String[] samples= input[1].toString().split("\n");
|
String[] samples= input[1].toString().split("\n");
|
||||||
for (ParserLanguage lang : ParserLanguage.values()) {
|
for (ParserLanguage lang : ParserLanguage.values()) {
|
||||||
|
@ -5327,7 +5327,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
// 0, a= 1 ? 2,3 : b= 4, 5 // 0,a,1,2,3,,,b,4,=,?,=,5,,
|
// 0, a= 1 ? 2,3 : b= 4, 5 // 0,a,1,2,3,,,b,4,=,?,=,5,,
|
||||||
// 1 ? 2 ? 3 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,?
|
// 1 ? 2 ? 3 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,?
|
||||||
public void testBinaryExpressionBinding() throws Exception {
|
public void testBinaryExpressionBinding() throws Exception {
|
||||||
StringBuffer[] input= getContents(2);
|
CharSequence[] input= getContents(2);
|
||||||
String code= input[0].toString();
|
String code= input[0].toString();
|
||||||
String[] samples= input[1].toString().split("\n");
|
String[] samples= input[1].toString().split("\n");
|
||||||
for (ParserLanguage lang : ParserLanguage.values()) {
|
for (ParserLanguage lang : ParserLanguage.values()) {
|
||||||
|
@ -5352,7 +5352,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
// 1 ? 2,3 : b= 4 // 1,2,3,,,b,4,=,?
|
// 1 ? 2,3 : b= 4 // 1,2,3,,,b,4,=,?
|
||||||
// 1 ? 2 ? 3 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,?
|
// 1 ? 2 ? 3 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,?
|
||||||
public void testConstantExpressionBinding() throws Exception {
|
public void testConstantExpressionBinding() throws Exception {
|
||||||
StringBuffer[] input= getContents(2);
|
CharSequence[] input= getContents(2);
|
||||||
String code= input[0].toString();
|
String code= input[0].toString();
|
||||||
String[] samples= input[1].toString().split("\n");
|
String[] samples= input[1].toString().split("\n");
|
||||||
for (ParserLanguage lang : ParserLanguage.values()) {
|
for (ParserLanguage lang : ParserLanguage.values()) {
|
||||||
|
@ -5859,7 +5859,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
public void testScalabilityOfLargeTrivialInitializer_Bug253690() throws Exception {
|
public void testScalabilityOfLargeTrivialInitializer_Bug253690() throws Exception {
|
||||||
sValidateCopy= false;
|
sValidateCopy= false;
|
||||||
final int AMOUNT= 250000;
|
final int AMOUNT= 250000;
|
||||||
final StringBuffer[] input = getContents(3);
|
final CharSequence[] input = getContents(3);
|
||||||
StringBuilder buf= new StringBuilder();
|
StringBuilder buf= new StringBuilder();
|
||||||
buf.append(input[0].toString());
|
buf.append(input[0].toString());
|
||||||
final String line= input[1].toString();
|
final String line= input[1].toString();
|
||||||
|
@ -5892,7 +5892,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
public void testLargeTrivialAggregateInitializer_Bug253690() throws Exception {
|
public void testLargeTrivialAggregateInitializer_Bug253690() throws Exception {
|
||||||
sValidateCopy= false;
|
sValidateCopy= false;
|
||||||
final int AMOUNT= 250000;
|
final int AMOUNT= 250000;
|
||||||
final StringBuffer[] input = getContents(3);
|
final CharSequence[] input = getContents(3);
|
||||||
StringBuilder buf= new StringBuilder();
|
StringBuilder buf= new StringBuilder();
|
||||||
buf.append(input[0].toString());
|
buf.append(input[0].toString());
|
||||||
final String line= input[1].toString();
|
final String line= input[1].toString();
|
||||||
|
|
|
@ -201,7 +201,7 @@ public class CommentTests extends AST2BaseTest {
|
||||||
// // comment2
|
// // comment2
|
||||||
// #endif
|
// #endif
|
||||||
public void testCommentsInInactiveCode_bug183930() throws Exception {
|
public void testCommentsInInactiveCode_bug183930() throws Exception {
|
||||||
StringBuffer code= getContents(1)[0];
|
CharSequence code= getContents(1)[0];
|
||||||
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, true);
|
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, true);
|
||||||
IASTComment[] comments = tu.getComments();
|
IASTComment[] comments = tu.getComments();
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ public class CommentTests extends AST2BaseTest {
|
||||||
|
|
||||||
// //comment
|
// //comment
|
||||||
public void testCommentLocation_bug186337() throws Exception{
|
public void testCommentLocation_bug186337() throws Exception{
|
||||||
StringBuffer code= getContents(1)[0];
|
CharSequence code= getContents(1)[0];
|
||||||
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, true);
|
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, true);
|
||||||
IASTComment[] comments = tu.getComments();
|
IASTComment[] comments = tu.getComments();
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ public class CommentTests extends AST2BaseTest {
|
||||||
// // TODO: shows up in task list
|
// // TODO: shows up in task list
|
||||||
|
|
||||||
public void testCommentInDirectives_bug192546() throws Exception {
|
public void testCommentInDirectives_bug192546() throws Exception {
|
||||||
StringBuffer code= getContents(1)[0];
|
CharSequence code= getContents(1)[0];
|
||||||
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, false);
|
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, false);
|
||||||
IASTComment[] comments = tu.getComments();
|
IASTComment[] comments = tu.getComments();
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ public class CommentTests extends AST2BaseTest {
|
||||||
for (IASTComment comment : comments) {
|
for (IASTComment comment : comments) {
|
||||||
IASTFileLocation loc= comment.getFileLocation();
|
IASTFileLocation loc= comment.getFileLocation();
|
||||||
int idx= loc.getNodeOffset() + comment.getRawSignature().indexOf("TODO");
|
int idx= loc.getNodeOffset() + comment.getRawSignature().indexOf("TODO");
|
||||||
assertEquals("TODO", code.substring(idx, idx+4));
|
assertEquals("TODO", code.subSequence(idx, idx + 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class DOMPreprocessorInformationTest extends AST2BaseTest {
|
||||||
// #elif
|
// #elif
|
||||||
// #endif
|
// #endif
|
||||||
public void testElifWithoutCondition_bug185324() throws Exception {
|
public void testElifWithoutCondition_bug185324() throws Exception {
|
||||||
StringBuffer code= getContents(1)[0];
|
CharSequence code= getContents(1)[0];
|
||||||
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, false);
|
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, false);
|
||||||
IASTPreprocessorStatement[] st = tu.getAllPreprocessorStatements();
|
IASTPreprocessorStatement[] st = tu.getAllPreprocessorStatements();
|
||||||
assertEquals(3, st.length);
|
assertEquals(3, st.length);
|
||||||
|
|
|
@ -371,4 +371,11 @@ public class BasicCompletionTest extends CompletionTestBase {
|
||||||
checkCompletion(code, true, expected);
|
checkCompletion(code, true, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// struct foo { int axx;};
|
||||||
|
// struct foo bar = {.a
|
||||||
|
public void testCompletionInDesignatedInitializor_353281() throws Exception {
|
||||||
|
String code = getAboveComment();
|
||||||
|
String[] expected= {"axx"};
|
||||||
|
checkCompletion(code, false, expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class CompletionTestBase extends BaseTestCase {
|
||||||
return getContents(1)[0].toString();
|
return getContents(1)[0].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||||
CTestPlugin plugin = CTestPlugin.getDefault();
|
CTestPlugin plugin = CTestPlugin.getDefault();
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
throw new AssertionFailedError("This test must be run as a JUnit plugin test");
|
throw new AssertionFailedError("This test must be run as a JUnit plugin test");
|
||||||
|
|
|
@ -36,11 +36,11 @@ public class ExpansionExplorerTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performTest(int steps) throws Exception {
|
private void performTest(int steps) throws Exception {
|
||||||
StringBuffer[] bufs= TestSourceReader.getContentsForTest(
|
CharSequence[] bufs= TestSourceReader.getContentsForTest(
|
||||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), steps+2);
|
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), steps+2);
|
||||||
String[] input= new String[steps+2];
|
String[] input= new String[steps+2];
|
||||||
int i= -1;
|
int i= -1;
|
||||||
for (StringBuffer buf : bufs) {
|
for (CharSequence buf : bufs) {
|
||||||
input[++i]= buf.toString().trim();
|
input[++i]= buf.toString().trim();
|
||||||
}
|
}
|
||||||
final MacroExpander expander= createExpander(input[0]);
|
final MacroExpander expander= createExpander(input[0]);
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class LocationMapTests extends BaseTestCase {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||||
return TestSourceReader.getContentsForTest(
|
return TestSourceReader.getContentsForTest(
|
||||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,10 +95,9 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
|
||||||
initializeScanner(getAboveComment());
|
initializeScanner(getAboveComment());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuffer[] getTestContent(int sections) throws IOException {
|
protected StringBuilder[] getTestContent(int sections) throws IOException {
|
||||||
StringBuffer[] input= TestSourceReader.getContentsForTest(
|
return TestSourceReader.getContentsForTest(
|
||||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||||
return input;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getAboveComment() throws IOException {
|
protected String getAboveComment() throws IOException {
|
||||||
|
@ -110,8 +109,7 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
IToken t= fScanner.nextToken();
|
IToken t= fScanner.nextToken();
|
||||||
}
|
}
|
||||||
}
|
} catch ( EndOfFileException e){
|
||||||
catch ( EndOfFileException e){
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
void setUp() throws Exception;
|
void setUp() throws Exception;
|
||||||
void tearDown() throws Exception;
|
void tearDown() throws Exception;
|
||||||
public IASTTranslationUnit getAst();
|
public IASTTranslationUnit getAst();
|
||||||
public StringBuffer[] getTestData();
|
public StringBuilder[] getTestData();
|
||||||
public ICProject getCProject();
|
public ICProject getCProject();
|
||||||
public boolean isCompositeIndex();
|
public boolean isCompositeIndex();
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
class SinglePDOMTestFirstASTStrategy implements ITestStrategy {
|
class SinglePDOMTestFirstASTStrategy implements ITestStrategy {
|
||||||
private IIndex index;
|
private IIndex index;
|
||||||
private ICProject cproject;
|
private ICProject cproject;
|
||||||
private StringBuffer[] testData;
|
private StringBuilder[] testData;
|
||||||
private IASTTranslationUnit ast;
|
private IASTTranslationUnit ast;
|
||||||
private boolean cpp;
|
private boolean cpp;
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
return cproject;
|
return cproject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringBuffer[] getTestData() {
|
public StringBuilder[] getTestData() {
|
||||||
return testData;
|
return testData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
class SinglePDOMTestStrategy implements ITestStrategy {
|
class SinglePDOMTestStrategy implements ITestStrategy {
|
||||||
private IIndex index;
|
private IIndex index;
|
||||||
private ICProject cproject;
|
private ICProject cproject;
|
||||||
private StringBuffer[] testData;
|
private StringBuilder[] testData;
|
||||||
private IASTTranslationUnit ast;
|
private IASTTranslationUnit ast;
|
||||||
private boolean cpp;
|
private boolean cpp;
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
return cproject;
|
return cproject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringBuffer[] getTestData() {
|
public StringBuilder[] getTestData() {
|
||||||
return testData;
|
return testData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
class ReferencedProject implements ITestStrategy {
|
class ReferencedProject implements ITestStrategy {
|
||||||
private IIndex index;
|
private IIndex index;
|
||||||
private ICProject cproject, referenced;
|
private ICProject cproject, referenced;
|
||||||
private StringBuffer[] testData;
|
private StringBuilder[] testData;
|
||||||
private IASTTranslationUnit ast;
|
private IASTTranslationUnit ast;
|
||||||
private boolean cpp;
|
private boolean cpp;
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringBuffer[] getTestData() {
|
public StringBuilder[] getTestData() {
|
||||||
return testData;
|
return testData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,11 +275,11 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] getContentsForTest(int blocks) throws IOException {
|
protected String[] getContentsForTest(int blocks) throws IOException {
|
||||||
StringBuffer[] help= TestSourceReader.getContentsForTest(
|
CharSequence[] help= TestSourceReader.getContentsForTest(
|
||||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
||||||
String[] result= new String[help.length];
|
String[] result= new String[help.length];
|
||||||
int i= 0;
|
int i= 0;
|
||||||
for (StringBuffer buf : help) {
|
for (CharSequence buf : help) {
|
||||||
result[i++]= buf.toString();
|
result[i++]= buf.toString();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
||||||
|
|
||||||
IIndex index;
|
IIndex index;
|
||||||
|
|
||||||
protected StringBuffer[] getContentsForTest(int blocks) throws IOException {
|
protected StringBuilder[] getContentsForTest(int blocks) throws IOException {
|
||||||
return TestSourceReader.getContentsForTest(
|
return TestSourceReader.getContentsForTest(
|
||||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
||||||
|
|
||||||
// class B {};
|
// class B {};
|
||||||
public void testPairDisjointContent() throws Exception {
|
public void testPairDisjointContent() throws Exception {
|
||||||
StringBuffer[] contents = getContentsForTest(2);
|
CharSequence[] contents = getContentsForTest(2);
|
||||||
List projects = new ArrayList();
|
List projects = new ArrayList();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -117,7 +117,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
||||||
// void foo(X::B2 c) {}
|
// void foo(X::B2 c) {}
|
||||||
// namespace X { class A2 {}; B2 b; C2 c; }
|
// namespace X { class A2 {}; B2 b; C2 c; }
|
||||||
public void testTripleLinear() throws Exception {
|
public void testTripleLinear() throws Exception {
|
||||||
StringBuffer[] contents = getContentsForTest(3);
|
CharSequence[] contents = getContentsForTest(3);
|
||||||
List projects = new ArrayList();
|
List projects = new ArrayList();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -224,7 +224,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
||||||
// namespace X { class A2 {}; }
|
// namespace X { class A2 {}; }
|
||||||
// B1 ab;
|
// B1 ab;
|
||||||
public void testTripleUpwardV() throws Exception {
|
public void testTripleUpwardV() throws Exception {
|
||||||
StringBuffer[] contents = getContentsForTest(3);
|
CharSequence[] contents = getContentsForTest(3);
|
||||||
List projects = new ArrayList();
|
List projects = new ArrayList();
|
||||||
|
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
||||||
// void foo(A1 a, A1 b) {}
|
// void foo(A1 a, A1 b) {}
|
||||||
// namespace X { class A2 {}; }
|
// namespace X { class A2 {}; }
|
||||||
public void testTripleDownwardV() throws Exception {
|
public void testTripleDownwardV() throws Exception {
|
||||||
StringBuffer[] contents = getContentsForTest(3);
|
CharSequence[] contents = getContentsForTest(3);
|
||||||
List projects = new ArrayList();
|
List projects = new ArrayList();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -450,7 +450,7 @@ class ProjectBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectBuilder addFile(String relativePath, StringBuffer content) {
|
ProjectBuilder addFile(String relativePath, CharSequence content) {
|
||||||
path2content.put(relativePath, content.toString());
|
path2content.put(relativePath, content.toString());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
// #include "header1.h"
|
// #include "header1.h"
|
||||||
// #include "header2.h"
|
// #include "header2.h"
|
||||||
public void testParsingInContext_bug220358() throws Exception {
|
public void testParsingInContext_bug220358() throws Exception {
|
||||||
StringBuffer[] sources= getContentsForTest(4);
|
CharSequence[] sources= getContentsForTest(4);
|
||||||
IFile h1= TestSourceReader.createFile(fProject.getProject(), "header1.h", sources[0].toString());
|
IFile h1= TestSourceReader.createFile(fProject.getProject(), "header1.h", sources[0].toString());
|
||||||
IFile h2= TestSourceReader.createFile(fProject.getProject(), "header2.h", sources[1].toString());
|
IFile h2= TestSourceReader.createFile(fProject.getProject(), "header2.h", sources[1].toString());
|
||||||
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s1.cpp", sources[3].toString());
|
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s1.cpp", sources[3].toString());
|
||||||
|
@ -405,7 +405,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
public void testUpdateIncludes() throws Exception {
|
public void testUpdateIncludes() throws Exception {
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
|
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
|
||||||
StringBuffer[] source= getContentsForTest(4);
|
CharSequence[] source= getContentsForTest(4);
|
||||||
IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070427.h", "");
|
IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070427.h", "");
|
||||||
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s20070427.cpp",
|
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s20070427.cpp",
|
||||||
source[0].toString() + "\nint a20070427;");
|
source[0].toString() + "\nint a20070427;");
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class IndexLocationTest extends BaseTestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Bundle b = CTestPlugin.getDefault().getBundle();
|
Bundle b = CTestPlugin.getDefault().getBundle();
|
||||||
StringBuffer[] testData = TestSourceReader.getContentsForTest(b, "parser", getClass(), getName(), 3);
|
CharSequence[] testData = TestSourceReader.getContentsForTest(b, "parser", getClass(), getName(), 3);
|
||||||
|
|
||||||
IFile file1 = TestSourceReader.createFile(cproject.getProject(), "header.h", testData[0].toString());
|
IFile file1 = TestSourceReader.createFile(cproject.getProject(), "header.h", testData[0].toString());
|
||||||
createExternalFile(externalHeader, testData[1].toString());
|
createExternalFile(externalHeader, testData[1].toString());
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class IndexTestBase extends BaseTestCase {
|
||||||
return TestSourceReader.readTaggedComment(CTestPlugin.getDefault().getBundle(), "parser", getClass(), tag);
|
return TestSourceReader.readTaggedComment(CTestPlugin.getDefault().getBundle(), "parser", getClass(), tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuffer[] getContentsForTest(int blocks) throws IOException {
|
protected StringBuilder[] getContentsForTest(int blocks) throws IOException {
|
||||||
return TestSourceReader.getContentsForTest(
|
return TestSourceReader.getContentsForTest(
|
||||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
||||||
private ICProject fCppProject= null;
|
private ICProject fCppProject= null;
|
||||||
private ICProject fCProject= null;
|
private ICProject fCProject= null;
|
||||||
private IIndex fIndex= null;
|
private IIndex fIndex= null;
|
||||||
private StringBuffer[] fContents;
|
private CharSequence[] fContents;
|
||||||
private IFile fFile;
|
private IFile fFile;
|
||||||
private IFile fHeader;
|
private IFile fHeader;
|
||||||
private int fContentUsed;
|
private int fContentUsed;
|
||||||
|
|
|
@ -59,9 +59,9 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUpSections(int sections) throws Exception {
|
protected void setUpSections(int sections) throws Exception {
|
||||||
StringBuffer[] contents= TestSourceReader.getContentsForTest(
|
CharSequence[] contents= TestSourceReader.getContentsForTest(
|
||||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||||
for (StringBuffer content : contents) {
|
for (CharSequence content : contents) {
|
||||||
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), content.toString());
|
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), content.toString());
|
||||||
}
|
}
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||||
|
@ -76,7 +76,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
if(pdom!=null) {
|
if(pdom != null) {
|
||||||
pdom.releaseReadLock();
|
pdom.releaseReadLock();
|
||||||
}
|
}
|
||||||
pdom= null;
|
pdom= null;
|
||||||
|
|
|
@ -43,9 +43,9 @@ public class CPPFunctionTemplateTests extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUpSections(int sections) throws Exception {
|
protected void setUpSections(int sections) throws Exception {
|
||||||
StringBuffer[] contents= TestSourceReader.getContentsForTest(
|
StringBuilder[] contents= TestSourceReader.getContentsForTest(
|
||||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||||
for (StringBuffer content : contents) {
|
for (StringBuilder content : contents) {
|
||||||
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), content.toString());
|
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), content.toString());
|
||||||
}
|
}
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||||
|
|
|
@ -53,7 +53,8 @@ public class PDOMCBugsTest extends BaseTestCase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
cproject= CProjectHelper.createCProject("PDOMCBugsTest"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
cproject= CProjectHelper.createCProject("PDOMCBugsTest"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||||
Bundle b = CTestPlugin.getDefault().getBundle();
|
Bundle b = CTestPlugin.getDefault().getBundle();
|
||||||
StringBuffer[] testData = TestSourceReader.getContentsForTest(b, "parser", PDOMCBugsTest.this.getClass(), getName(), 1);
|
CharSequence[] testData = TestSourceReader.getContentsForTest(b, "parser",
|
||||||
|
PDOMCBugsTest.this.getClass(), getName(), 1);
|
||||||
|
|
||||||
IFile file = TestSourceReader.createFile(cproject.getProject(), new Path("header.h"), testData[0].toString());
|
IFile file = TestSourceReader.createFile(cproject.getProject(), new Path("header.h"), testData[0].toString());
|
||||||
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class PDOMLocationTests extends BaseTestCase {
|
||||||
cproject= CProjectHelper.createCCProject("PDOMLocationTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
cproject= CProjectHelper.createCCProject("PDOMLocationTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||||
|
|
||||||
Bundle b = CTestPlugin.getDefault().getBundle();
|
Bundle b = CTestPlugin.getDefault().getBundle();
|
||||||
StringBuffer[] testData = TestSourceReader.getContentsForTest(b, "parser", getClass(), getName(), 3);
|
CharSequence[] testData = TestSourceReader.getContentsForTest(b, "parser", getClass(), getName(), 3);
|
||||||
|
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Symbian - Initial implementation
|
* Symbian - Initial implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.pdom.tests;
|
package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* a lo-fidelity debugging tool)
|
* a lo-fidelity debugging tool)
|
||||||
*/
|
*/
|
||||||
public class PDOMPrettyPrinter implements IPDOMVisitor {
|
public class PDOMPrettyPrinter implements IPDOMVisitor {
|
||||||
StringBuffer indent = new StringBuffer();
|
StringBuilder indent = new StringBuilder();
|
||||||
final String step = " "; //$NON-NLS-1$
|
final String step = " "; //$NON-NLS-1$
|
||||||
|
|
||||||
public void leave(IPDOMNode node) throws CoreException {
|
public void leave(IPDOMNode node) throws CoreException {
|
||||||
|
|
|
@ -57,18 +57,19 @@ import org.osgi.framework.Bundle;
|
||||||
public class TestSourceReader {
|
public class TestSourceReader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of StringBuffer objects for each comment section found preceding the named
|
* Returns an array of StringBuilder objects for each comment section found preceding the named
|
||||||
* test in the source code.
|
* test in the source code.
|
||||||
* @param bundle the bundle containing the source, if null can try to load using classpath (source folder has to be in the classpath for this to work)
|
* @param bundle the bundle containing the source, if null can try to load using classpath
|
||||||
|
* (source folder has to be in the classpath for this to work)
|
||||||
* @param srcRoot the directory inside the bundle containing the packages
|
* @param srcRoot the directory inside the bundle containing the packages
|
||||||
* @param clazz the name of the class containing the test
|
* @param clazz the name of the class containing the test
|
||||||
* @param testName the name of the test
|
* @param testName the name of the test
|
||||||
* @param sections the number of comment sections preceding the named test to return
|
* @param sections the number of comment sections preceding the named test to return
|
||||||
* @return an array of StringBuffer objects for each comment section found preceding the named
|
* @return an array of StringBuilder objects for each comment section found preceding the named
|
||||||
* test in the source code.
|
* test in the source code.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static StringBuffer[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz, final String testName, int sections) throws IOException {
|
public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz, final String testName, int sections) throws IOException {
|
||||||
String fqn = clazz.getName().replace('.', '/');
|
String fqn = clazz.getName().replace('.', '/');
|
||||||
fqn = fqn.indexOf("$")==-1 ? fqn : fqn.substring(0,fqn.indexOf("$"));
|
fqn = fqn.indexOf("$")==-1 ? fqn : fqn.substring(0,fqn.indexOf("$"));
|
||||||
String classFile = fqn + ".java";
|
String classFile = fqn + ".java";
|
||||||
|
@ -91,7 +92,7 @@ public class TestSourceReader {
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||||
|
|
||||||
List contents = new ArrayList();
|
List contents = new ArrayList();
|
||||||
StringBuffer content = new StringBuffer();
|
StringBuilder content = new StringBuilder();
|
||||||
for(String line = br.readLine(); line!=null; line = br.readLine()) {
|
for(String line = br.readLine(); line!=null; line = br.readLine()) {
|
||||||
line = line.replaceFirst("^\\s*", ""); // replace leading whitespace, preserve trailing
|
line = line.replaceFirst("^\\s*", ""); // replace leading whitespace, preserve trailing
|
||||||
if(line.startsWith("//")) {
|
if(line.startsWith("//")) {
|
||||||
|
@ -101,11 +102,11 @@ public class TestSourceReader {
|
||||||
contents.add(content);
|
contents.add(content);
|
||||||
if(contents.size()==sections+1)
|
if(contents.size()==sections+1)
|
||||||
contents.remove(0);
|
contents.remove(0);
|
||||||
content = new StringBuffer();
|
content = new StringBuilder();
|
||||||
}
|
}
|
||||||
int idx= line.indexOf(testName);
|
int idx= line.indexOf(testName);
|
||||||
if( idx != -1 && !Character.isJavaIdentifierPart(line.charAt(idx+testName.length()))) {
|
if( idx != -1 && !Character.isJavaIdentifierPart(line.charAt(idx+testName.length()))) {
|
||||||
return (StringBuffer[]) contents.toArray(new StringBuffer[contents.size()]);
|
return (StringBuilder[]) contents.toArray(new StringBuilder[contents.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +133,7 @@ public class TestSourceReader {
|
||||||
try {
|
try {
|
||||||
int c= 0;
|
int c= 0;
|
||||||
int offset= 0;
|
int offset= 0;
|
||||||
StringBuffer buf= new StringBuffer();
|
StringBuilder buf= new StringBuilder();
|
||||||
while ((c = reader.read()) >= 0) {
|
while ((c = reader.read()) >= 0) {
|
||||||
buf.append((char) c);
|
buf.append((char) c);
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
|
@ -182,7 +183,7 @@ public class TestSourceReader {
|
||||||
InputStream in= FileLocator.openStream(bundle, filePath, false);
|
InputStream in= FileLocator.openStream(bundle, filePath, false);
|
||||||
LineNumberReader reader= new LineNumberReader(new InputStreamReader(in));
|
LineNumberReader reader= new LineNumberReader(new InputStreamReader(in));
|
||||||
boolean found= false;
|
boolean found= false;
|
||||||
final StringBuffer content= new StringBuffer();
|
final StringBuilder content= new StringBuilder();
|
||||||
try {
|
try {
|
||||||
String line= reader.readLine();
|
String line= reader.readLine();
|
||||||
while (line != null) {
|
while (line != null) {
|
||||||
|
@ -222,7 +223,6 @@ public class TestSourceReader {
|
||||||
* @param contents the content for the file
|
* @param contents the content for the file
|
||||||
* @return a file object.
|
* @return a file object.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
* @throws Exception
|
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public static IFile createFile(final IContainer container, final IPath filePath, final String contents) throws CoreException {
|
public static IFile createFile(final IContainer container, final IPath filePath, final String contents) throws CoreException {
|
||||||
|
@ -264,10 +264,7 @@ public class TestSourceReader {
|
||||||
* @param container a container to create the file in
|
* @param container a container to create the file in
|
||||||
* @param filePath the path relative to the container to create the file at
|
* @param filePath the path relative to the container to create the file at
|
||||||
* @param contents the content for the file
|
* @param contents the content for the file
|
||||||
* @return
|
|
||||||
* @return a file object.
|
* @return a file object.
|
||||||
* @throws Exception
|
|
||||||
* @throws Exception
|
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public static IFile createFile(IContainer container, String filePath, String contents) throws CoreException {
|
public static IFile createFile(IContainer container, String filePath, String contents) throws CoreException {
|
||||||
|
|
|
@ -19,8 +19,8 @@ import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ILinkage;
|
import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
|
@ -573,7 +573,14 @@ public class LanguageManager {
|
||||||
IProject project = file.getProject();
|
IProject project = file.getProject();
|
||||||
|
|
||||||
if (contentTypeId == null) {
|
if (contentTypeId == null) {
|
||||||
IContentType contentType= CContentTypes.getContentType(project, file.getLocation().toString());
|
IPath location = file.getLocation();
|
||||||
|
String filename;
|
||||||
|
if (location != null) {
|
||||||
|
filename = location.toString();
|
||||||
|
} else {
|
||||||
|
filename = file.getName();
|
||||||
|
}
|
||||||
|
IContentType contentType= CContentTypes.getContentType(project, filename);
|
||||||
if (contentType == null) {
|
if (contentType == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,17 +77,15 @@ import org.eclipse.cdt.core.parser.Keywords;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a utility class to help convert AST elements to Strings.
|
* This is a utility class to help convert AST elements to Strings.
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.core.dom.ast.ASTTypeUtil
|
* @see org.eclipse.cdt.core.dom.ast.ASTTypeUtil
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ASTStringUtil {
|
public class ASTStringUtil {
|
||||||
private static final String SPACE= " "; //$NON-NLS-1$
|
private static final String SPACE= " "; //$NON-NLS-1$
|
||||||
private static final String COMMA_SPACE= ", "; //$NON-NLS-1$
|
private static final String COMMA_SPACE= ", "; //$NON-NLS-1$
|
||||||
private static final String[] EMPTY_STRING_ARRAY= new String[0];
|
private static final String[] EMPTY_STRING_ARRAY= {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the qualified name if the given <code>IASTName</code>
|
* Return the qualified name if the given <code>IASTName</code>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Intel Corporation and others.
|
* Copyright (c) 2007, 2011 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.settings.model;
|
package org.eclipse.cdt.internal.core.settings.model;
|
||||||
|
|
||||||
|
@ -35,6 +36,7 @@ import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsLogger;
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsLogger;
|
||||||
|
import org.eclipse.cdt.utils.EFSExtensionManager;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
@ -243,10 +245,11 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
IResource rc = root.findMember(path);
|
IResource rc = root.findMember(path);
|
||||||
if(rc != null){
|
if(rc != null){
|
||||||
path = rc.getLocation();
|
path = new Path(EFSExtensionManager.getDefault().getPathFromURI(rc.getLocationURI()));
|
||||||
}
|
}
|
||||||
} else if (!path.isAbsolute()) {
|
} else if (!path.isAbsolute()) {
|
||||||
IPath projLocation = fProject != null ? fProject.getLocation() : null;
|
IPath projLocation = fProject != null ? new Path(EFSExtensionManager.getDefault()
|
||||||
|
.getPathFromURI(fProject.getLocationURI())) : null;
|
||||||
if(projLocation != null)
|
if(projLocation != null)
|
||||||
path = projLocation.append(path);
|
path = projLocation.append(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Doug Schaefer (IBM) - Initial API and implementation
|
* Doug Schaefer (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
@ -17,9 +17,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTPreprocessorMacroDefinition extends
|
public interface IASTPreprocessorMacroDefinition extends IASTPreprocessorStatement, IASTNameOwner {
|
||||||
IASTPreprocessorStatement, IASTNameOwner {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>MACRO_NAME</code> describes the relationship between a macro
|
* <code>MACRO_NAME</code> describes the relationship between a macro
|
||||||
* definition and it's name.
|
* definition and it's name.
|
||||||
|
@ -44,7 +42,6 @@ public interface IASTPreprocessorMacroDefinition extends
|
||||||
*/
|
*/
|
||||||
public IASTFileLocation getExpansionLocation();
|
public IASTFileLocation getExpansionLocation();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this macro definition occurs in active code.
|
* Returns whether this macro definition occurs in active code.
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.rewrite;
|
package org.eclipse.cdt.core.dom.rewrite;
|
||||||
|
|
||||||
|
@ -29,31 +29,30 @@ import org.eclipse.text.edits.TextEditGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Infrastructure for modifying code by describing changes to AST nodes. The AST rewriter collects
|
* Infrastructure for modifying code by describing changes to AST nodes. The AST rewriter collects
|
||||||
* descriptions of modifications to nodes and translates these descriptions into text edits that can then be
|
* descriptions of modifications to nodes and translates these descriptions into text edits that can
|
||||||
* applied to the original source. This is all done without actually modifying the original AST. The rewrite
|
* then be applied to the original source. This is all done without actually modifying the original
|
||||||
* infrastructure tries to generate minimal text changes, preserve existing comments and indentation, and
|
* AST. The rewrite infrastructure tries to generate minimal text changes, preserve existing
|
||||||
* follow code formatter settings. A {@link IASTComment} can be removed from or added to a node.
|
* comments and indentation, and follow code formatter settings. A {@link IASTComment} can be
|
||||||
|
* removed from or added to a node.
|
||||||
* <p>
|
* <p>
|
||||||
* The initial implementation does not support nodes that implement {@link IASTPreprocessorStatement} or
|
* The initial implementation does not support nodes that implement
|
||||||
* {@link IASTProblem}.
|
* {@link IASTPreprocessorStatement} or {@link IASTProblem}.
|
||||||
* <p>
|
* <p>
|
||||||
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part of a work in progress. There
|
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part of a work in
|
||||||
* is no guarantee that this API will work or that it will remain the same. Please do not use this API without
|
* progress. There is no guarantee that this API will work or that it will remain the same.
|
||||||
* consulting with the CDT team.
|
* Please do not use this API without consulting with the CDT team.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
*/
|
*/
|
||||||
public final class ASTRewrite {
|
public final class ASTRewrite {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the positions of the comment.
|
* Defines the positions of the comment.
|
||||||
*
|
*
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
public enum CommentPosition{
|
public enum CommentPosition {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comments before a statement, declaration, or definition
|
* Comments before a statement, declaration, or definition
|
||||||
*/
|
*/
|
||||||
|
@ -63,8 +62,8 @@ public final class ASTRewrite {
|
||||||
*/
|
*/
|
||||||
trailing,
|
trailing,
|
||||||
/**
|
/**
|
||||||
* Comments before a closing brace such as they occur in namespace-, class- and method-definitions or
|
* Comments before a closing brace such as they occur in namespace-, class- and
|
||||||
* at the end of a file
|
* method-definitions or at the end of a file
|
||||||
*/
|
*/
|
||||||
freestanding
|
freestanding
|
||||||
}
|
}
|
||||||
|
@ -82,13 +81,14 @@ public final class ASTRewrite {
|
||||||
private final ASTModification fParentMod;
|
private final ASTModification fParentMod;
|
||||||
private final NodeCommentMap fCommentMap;
|
private final NodeCommentMap fCommentMap;
|
||||||
|
|
||||||
private enum Operation{
|
private enum Operation {
|
||||||
insertBefore,
|
insertBefore,
|
||||||
replace,
|
replace,
|
||||||
remove
|
remove
|
||||||
}
|
}
|
||||||
|
|
||||||
private ASTRewrite(IASTNode root, ASTModificationStore modStore, ASTModification parentMod, NodeCommentMap commentMap) {
|
private ASTRewrite(IASTNode root, ASTModificationStore modStore, ASTModification parentMod,
|
||||||
|
NodeCommentMap commentMap) {
|
||||||
fRoot= root;
|
fRoot= root;
|
||||||
fModificationStore= modStore;
|
fModificationStore= modStore;
|
||||||
fParentMod= parentMod;
|
fParentMod= parentMod;
|
||||||
|
@ -115,9 +115,9 @@ public final class ASTRewrite {
|
||||||
*
|
*
|
||||||
* @param node the node being removed
|
* @param node the node being removed
|
||||||
* @param editGroup the edit group in which to collect the corresponding
|
* @param editGroup the edit group in which to collect the corresponding
|
||||||
* text edits, or <code>null</code>
|
* text edits, or <code>null</code>
|
||||||
* @throws IllegalArgumentException if the node is null, the node is not
|
* @throws IllegalArgumentException if the node is null, the node is not
|
||||||
* part of this rewriter's AST.
|
* part of this rewriter's AST.
|
||||||
*/
|
*/
|
||||||
public final void remove(IASTNode node, TextEditGroup editGroup) {
|
public final void remove(IASTNode node, TextEditGroup editGroup) {
|
||||||
checkBelongsToAST(node);
|
checkBelongsToAST(node);
|
||||||
|
@ -134,11 +134,11 @@ public final class ASTRewrite {
|
||||||
*
|
*
|
||||||
* @param node the node being replaced
|
* @param node the node being replaced
|
||||||
* @param replacement the node replacing the given one
|
* @param replacement the node replacing the given one
|
||||||
* @param editGroup the edit group in which to collect the corresponding
|
* @param editGroup the edit group in which to collect the corresponding text edits,
|
||||||
* text edits, or <code>null</code>
|
* or <code>null</code>
|
||||||
* @return a rewriter for further rewriting the replacement node.
|
* @return a rewriter for further rewriting the replacement node.
|
||||||
* @throws IllegalArgumentException if the node or the replacement is null, or if the node is not
|
* @throws IllegalArgumentException if the node or the replacement is null, or if the node is
|
||||||
* part of this rewriter's AST
|
* not part of this rewriter's AST
|
||||||
*/
|
*/
|
||||||
public final ASTRewrite replace(IASTNode node, IASTNode replacement, TextEditGroup editGroup) {
|
public final ASTRewrite replace(IASTNode node, IASTNode replacement, TextEditGroup editGroup) {
|
||||||
if (replacement == null) {
|
if (replacement == null) {
|
||||||
|
@ -158,15 +158,17 @@ public final class ASTRewrite {
|
||||||
* The new node can be part of a translation-unit or it is a synthetic
|
* The new node can be part of a translation-unit or it is a synthetic
|
||||||
* (newly created) node.
|
* (newly created) node.
|
||||||
* @param parent the parent the new node is added to.
|
* @param parent the parent the new node is added to.
|
||||||
* @param insertionPoint the node before which the insertion shall be done, or <code>null</code> for inserting after the last child.
|
* @param insertionPoint the node before which the insertion shall be done, or <code>null</code>
|
||||||
|
* for inserting after the last child.
|
||||||
* @param newNode the node being inserted
|
* @param newNode the node being inserted
|
||||||
* @param editGroup the edit group in which to collect the corresponding
|
* @param editGroup the edit group in which to collect the corresponding
|
||||||
* text edits, or <code>null</code>
|
* text edits, or <code>null</code>
|
||||||
* @return a rewriter for further rewriting the inserted node.
|
* @return a rewriter for further rewriting the inserted node.
|
||||||
* @throws IllegalArgumentException if the parent or the newNode is null, or if the parent is not
|
* @throws IllegalArgumentException if the parent or the newNode is null, or if the parent is
|
||||||
* part of this rewriter's AST, or the insertionPoint is not a child of the parent.
|
* not part of this rewriter's AST, or the insertionPoint is not a child of the parent.
|
||||||
*/
|
*/
|
||||||
public final ASTRewrite insertBefore(IASTNode parent, IASTNode insertionPoint, IASTNode newNode, TextEditGroup editGroup) {
|
public final ASTRewrite insertBefore(IASTNode parent, IASTNode insertionPoint, IASTNode newNode,
|
||||||
|
TextEditGroup editGroup) {
|
||||||
if (parent != fRoot) {
|
if (parent != fRoot) {
|
||||||
checkBelongsToAST(parent);
|
checkBelongsToAST(parent);
|
||||||
}
|
}
|
||||||
|
@ -180,8 +182,7 @@ public final class ASTRewrite {
|
||||||
ASTModification mod;
|
ASTModification mod;
|
||||||
if (insertionPoint == null) {
|
if (insertionPoint == null) {
|
||||||
mod= new ASTModification(ModificationKind.APPEND_CHILD, parent, newNode, editGroup);
|
mod= new ASTModification(ModificationKind.APPEND_CHILD, parent, newNode, editGroup);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (insertionPoint.getParent() != parent) {
|
if (insertionPoint.getParent() != parent) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
@ -192,12 +193,13 @@ public final class ASTRewrite {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts all modifications recorded by this rewriter into the change object required by the
|
* Converts all modifications recorded by this rewriter into the change object required by
|
||||||
* refactoring framework.
|
* the refactoring framework.
|
||||||
* <p>
|
* <p>
|
||||||
* Calling this methods does not discard the modifications on record. Subsequence modifications
|
* Calling this methods does not discard the modifications on record. Subsequence modifications
|
||||||
* are added to the ones already on record. If this method is called again later,
|
* are added to the ones already on record. If this method is called again later,
|
||||||
* the resulting text edit object will accurately reflect the net cumulative affect of all those changes.
|
* the resulting text edit object will accurately reflect the net cumulative affect of all those
|
||||||
|
* changes.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return Change object describing the changes to the
|
* @return Change object describing the changes to the
|
||||||
|
@ -223,7 +225,7 @@ public final class ASTRewrite {
|
||||||
|
|
||||||
private void checkSupportedNode(IASTNode node, Operation op) {
|
private void checkSupportedNode(IASTNode node, Operation op) {
|
||||||
if (node instanceof IASTComment) {
|
if (node instanceof IASTComment) {
|
||||||
if(op != Operation.remove) {
|
if (op != Operation.remove) {
|
||||||
throw new IllegalArgumentException("Rewriting comments is not yet supported"); //$NON-NLS-1$
|
throw new IllegalArgumentException("Rewriting comments is not yet supported"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,13 +237,12 @@ public final class ASTRewrite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns the comment to the node.
|
* Assigns the comment to the node.
|
||||||
*
|
*
|
||||||
* @param node
|
* @param node the node.
|
||||||
* @param comment
|
* @param comment the comment to be attached to the node at the given position.
|
||||||
* @param pos
|
* @param pos the position of the comment.
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
public void addComment(IASTNode node, IASTComment comment, CommentPosition pos) {
|
public void addComment(IASTNode node, IASTComment comment, CommentPosition pos) {
|
||||||
|
@ -258,13 +259,10 @@ public final class ASTRewrite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
|
||||||
*
|
*
|
||||||
* @param node
|
* @param node the node
|
||||||
* the node
|
* @param pos the position
|
||||||
* @param pos
|
|
||||||
* the position
|
|
||||||
* @return All comments assigned to the node at this position
|
* @return All comments assigned to the node at this position
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
|
@ -276,7 +274,6 @@ public final class ASTRewrite {
|
||||||
return fCommentMap.getTrailingCommentsForNode(node);
|
return fCommentMap.getTrailingCommentsForNode(node);
|
||||||
case freestanding:
|
case freestanding:
|
||||||
return fCommentMap.getFreestandingCommentsForNode(node);
|
return fCommentMap.getFreestandingCommentsForNode(node);
|
||||||
|
|
||||||
}
|
}
|
||||||
return fCommentMap.getLeadingCommentsForNode(node);
|
return fCommentMap.getLeadingCommentsForNode(node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.index;
|
package org.eclipse.cdt.core.index;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public interface IIndexFile {
|
||||||
IIndexName[] findNames(int offset, int length) throws CoreException;
|
IIndexName[] findNames(int offset, int length) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the include that was used to parse this file, may be null.
|
* Returns the include that was used to parse this file, may be <code>null</code>.
|
||||||
*/
|
*/
|
||||||
IIndexInclude getParsedInContext() throws CoreException;
|
IIndexInclude getParsedInContext() throws CoreException;
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.core.index;
|
package org.eclipse.cdt.core.index;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
|
@ -23,7 +22,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IIndexMacro extends IMacroBinding, IIndexBinding {
|
public interface IIndexMacro extends IMacroBinding, IIndexBinding {
|
||||||
|
|
||||||
IIndexMacro[] EMPTY_INDEX_MACRO_ARRAY = new IIndexMacro[0];
|
IIndexMacro[] EMPTY_INDEX_MACRO_ARRAY = new IIndexMacro[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,18 +6,17 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.index;
|
package org.eclipse.cdt.core.index;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a binding for all macros with the same name. When you try to adapt a macro binding in an index
|
* Represents a binding for all macros with the same name. When you try to adapt a macro binding
|
||||||
* you'll get the container as a result.
|
* in an index you'll get the container as a result.
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*
|
*
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IIndexMacroContainer extends IIndexBinding {
|
public interface IIndexMacroContainer extends IIndexBinding {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,14 +13,16 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of field designators
|
* Implementation of field designators
|
||||||
*/
|
*/
|
||||||
public class CASTFieldDesignator extends ASTNode implements ICASTFieldDesignator {
|
public class CASTFieldDesignator extends ASTNode implements ICASTFieldDesignator, IASTCompletionContext {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
|
@ -74,4 +76,8 @@ public class CASTFieldDesignator extends ASTNode implements ICASTFieldDesignator
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IBinding[] findBindings(IASTName n, boolean isPrefix) {
|
||||||
|
return CVisitor.findBindingsForContentAssist(n, isPrefix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -607,26 +607,31 @@ public class CVisitor extends ASTQueries {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != null && type instanceof ICompositeType) {
|
if (type != null && type instanceof ICompositeType) {
|
||||||
|
final ICompositeType ct = (ICompositeType) type;
|
||||||
if (type instanceof IIndexBinding) {
|
if (type instanceof IIndexBinding) {
|
||||||
type= ((CASTTranslationUnit) fieldReference.getTranslationUnit()).mapToASTType((ICompositeType) type);
|
type= ((CASTTranslationUnit) fieldReference.getTranslationUnit()).mapToASTType(ct);
|
||||||
}
|
}
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
IBinding[] result = null;
|
|
||||||
char[] p = fieldReference.getFieldName().toCharArray();
|
char[] p = fieldReference.getFieldName().toCharArray();
|
||||||
IContentAssistMatcher matcher = ContentAssistMatcherFactory.getInstance().createMatcher(p);
|
return findFieldsByPrefix(ct, p);
|
||||||
IField[] fields = ((ICompositeType) type).getFields();
|
|
||||||
for (IField field : fields) {
|
|
||||||
if (matcher.match(field.getNameCharArray())) {
|
|
||||||
result = (IBinding[]) ArrayUtil.append(IBinding.class, result, field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ArrayUtil.trim(IBinding.class, result);
|
|
||||||
}
|
}
|
||||||
return ((ICompositeType) type).findField(fieldReference.getFieldName().toString());
|
return ct.findField(fieldReference.getFieldName().toString());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IBinding[] findFieldsByPrefix(final ICompositeType ct, char[] p) {
|
||||||
|
IBinding[] result = null;
|
||||||
|
IContentAssistMatcher matcher = ContentAssistMatcherFactory.getInstance().createMatcher(p);
|
||||||
|
IField[] fields = ct.getFields();
|
||||||
|
for (IField field : fields) {
|
||||||
|
if (matcher.match(field.getNameCharArray())) {
|
||||||
|
result = (IBinding[]) ArrayUtil.append(IBinding.class, result, field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (IBinding[]) ArrayUtil.trim(IBinding.class, result);
|
||||||
|
}
|
||||||
|
|
||||||
static IType getPtrDiffType(IASTBinaryExpression expr) {
|
static IType getPtrDiffType(IASTBinaryExpression expr) {
|
||||||
IScope scope = getContainingScope(expr);
|
IScope scope = getContainingScope(expr);
|
||||||
IBinding[] bs = scope.find(PTRDIFF_T);
|
IBinding[] bs = scope.find(PTRDIFF_T);
|
||||||
|
@ -1463,6 +1468,8 @@ public class CVisitor extends ASTQueries {
|
||||||
|
|
||||||
if (prop == IASTFieldReference.FIELD_NAME) {
|
if (prop == IASTFieldReference.FIELD_NAME) {
|
||||||
result = (IBinding[]) findBinding((IASTFieldReference) name.getParent(), isPrefix);
|
result = (IBinding[]) findBinding((IASTFieldReference) name.getParent(), isPrefix);
|
||||||
|
} else if (prop == ICASTFieldDesignator.FIELD_NAME) {
|
||||||
|
result = findBindingForContentAssist((ICASTFieldDesignator) name.getParent(), isPrefix);
|
||||||
} else {
|
} else {
|
||||||
IScope scope= getContainingScope(name);
|
IScope scope= getContainingScope(name);
|
||||||
try {
|
try {
|
||||||
|
@ -1477,7 +1484,35 @@ public class CVisitor extends ASTQueries {
|
||||||
return (IBinding[]) ArrayUtil.trim(IBinding.class, result);
|
return (IBinding[]) ArrayUtil.trim(IBinding.class, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IBinding[] findBindings(IScope scope, String name) {
|
private static IBinding[] findBindingForContentAssist(ICASTFieldDesignator fd, boolean isPrefix) {
|
||||||
|
IASTNode blockItem = getContainingBlockItem(fd);
|
||||||
|
|
||||||
|
IASTNode parent= blockItem;
|
||||||
|
while (parent != null && !(parent instanceof IASTSimpleDeclaration))
|
||||||
|
parent= parent.getParent();
|
||||||
|
|
||||||
|
if (parent instanceof IASTSimpleDeclaration) {
|
||||||
|
IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration) parent;
|
||||||
|
IBinding struct= null;
|
||||||
|
if (simpleDecl.getDeclSpecifier() instanceof IASTNamedTypeSpecifier) {
|
||||||
|
struct = ((IASTNamedTypeSpecifier) simpleDecl.getDeclSpecifier()).getName().resolveBinding();
|
||||||
|
} else if (simpleDecl.getDeclSpecifier() instanceof IASTElaboratedTypeSpecifier) {
|
||||||
|
struct = ((IASTElaboratedTypeSpecifier) simpleDecl.getDeclSpecifier()).getName().resolveBinding();
|
||||||
|
} else if (simpleDecl.getDeclSpecifier() instanceof IASTCompositeTypeSpecifier) {
|
||||||
|
struct = ((IASTCompositeTypeSpecifier) simpleDecl.getDeclSpecifier()).getName().resolveBinding();
|
||||||
|
}
|
||||||
|
if (struct instanceof IType) {
|
||||||
|
IType t= unwrapTypedefs((IType) struct);
|
||||||
|
|
||||||
|
if (t instanceof ICompositeType) {
|
||||||
|
return findFieldsByPrefix((ICompositeType) t, fd.getName().toCharArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IBinding[] findBindings(IScope scope, String name) {
|
||||||
CASTName astName = new CASTName(name.toCharArray());
|
CASTName astName = new CASTName(name.toCharArray());
|
||||||
|
|
||||||
// normal names
|
// normal names
|
||||||
|
|
|
@ -177,18 +177,21 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
// in any way add the initializer such that the actual size can be tracked.
|
// in any way add the initializer such that the actual size can be tracked.
|
||||||
result.addClause(clause);
|
result.addClause(clause);
|
||||||
} else {
|
} else {
|
||||||
// Gnu extension: the assign operator is optional
|
ICASTDesignatedInitializer desigInitializer = nodeFactory.newDesignatedInitializer((IASTInitializerClause) null);
|
||||||
if (LT(1) == IToken.tASSIGN)
|
|
||||||
consume(IToken.tASSIGN);
|
|
||||||
|
|
||||||
IASTInitializerClause clause= initClause(false);
|
|
||||||
ICASTDesignatedInitializer desigInitializer = nodeFactory.newDesignatedInitializer(clause);
|
|
||||||
setRange(desigInitializer, designator.get(0));
|
setRange(desigInitializer, designator.get(0));
|
||||||
adjustLength(desigInitializer, clause);
|
|
||||||
|
|
||||||
for (ICASTDesignator d : designator) {
|
for (ICASTDesignator d : designator) {
|
||||||
desigInitializer.addDesignator(d);
|
desigInitializer.addDesignator(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LT(1) != IToken.tEOC) {
|
||||||
|
// Gnu extension: the assign operator is optional
|
||||||
|
if (LT(1) == IToken.tASSIGN)
|
||||||
|
consume(IToken.tASSIGN);
|
||||||
|
|
||||||
|
IASTInitializerClause clause= initClause(false);
|
||||||
|
desigInitializer.setOperand(clause);
|
||||||
|
adjustLength(desigInitializer, clause);
|
||||||
|
}
|
||||||
result.addClause(desigInitializer);
|
result.addClause(desigInitializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.rewrite;
|
package org.eclipse.cdt.internal.core.dom.rewrite;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
|
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a list of modifications to an ast-node. If there are nested modifications
|
* Represents a list of modifications to an AST node. If there are nested modifications
|
||||||
* to nodes introduced by insertions or replacements, these modifications are collected
|
* to nodes introduced by insertions or replacements, these modifications are collected
|
||||||
* in separate modification maps. I.e. a modification map represents one level of
|
* in separate modification maps. I.e. a modification map represents one level of
|
||||||
* modifications.
|
* modifications.
|
||||||
|
@ -28,51 +28,51 @@ import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKin
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public class ASTModificationMap {
|
public class ASTModificationMap {
|
||||||
|
private HashMap<IASTNode, List<ASTModification>> fModifications= new HashMap<IASTNode, List<ASTModification>>();
|
||||||
private HashMap<IASTNode,List<ASTModification>> fModifications= new HashMap<IASTNode,List<ASTModification>>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a modification to this modification map.
|
* Adds a modification to this modification map.
|
||||||
*/
|
*/
|
||||||
public void addModification(ASTModification mod) {
|
public void addModification(ASTModification mod) {
|
||||||
final IASTNode targetNode = mod.getKind()==ASTModification.ModificationKind.INSERT_BEFORE ? mod.getTargetNode().getParent() :mod.getTargetNode();
|
final IASTNode targetNode = mod.getKind() == ASTModification.ModificationKind.INSERT_BEFORE ?
|
||||||
|
mod.getTargetNode().getParent() : mod.getTargetNode();
|
||||||
List<ASTModification> mods= fModifications.get(targetNode);
|
List<ASTModification> mods= fModifications.get(targetNode);
|
||||||
if (mods == null || mods.isEmpty()) {
|
if (mods == null || mods.isEmpty()) {
|
||||||
mods= new ArrayList<ASTModification>();
|
mods= new ArrayList<ASTModification>();
|
||||||
mods.add(mod);
|
mods.add(mod);
|
||||||
fModifications.put(targetNode, mods);
|
fModifications.put(targetNode, mods);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
switch (mod.getKind()) {
|
switch (mod.getKind()) {
|
||||||
case REPLACE:
|
case REPLACE:
|
||||||
if (mods.get(mods.size()-1).getKind() != ModificationKind.INSERT_BEFORE ) {
|
if (mods.get(mods.size() - 1).getKind() != ModificationKind.INSERT_BEFORE) {
|
||||||
throw new IllegalArgumentException("Attempt to replace a node that has been modified"); //$NON-NLS-1$
|
throw new IllegalArgumentException("Attempt to replace a node that has been modified"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
mods.add(mod);
|
mods.add(mod);
|
||||||
break;
|
break;
|
||||||
case APPEND_CHILD:
|
case APPEND_CHILD:
|
||||||
if (mods.get(mods.size()-1).getKind() == ModificationKind.REPLACE) {
|
if (mods.get(mods.size() - 1).getKind() == ModificationKind.REPLACE) {
|
||||||
throw new IllegalArgumentException("Attempt to modify a node that has been replaced"); //$NON-NLS-1$
|
throw new IllegalArgumentException("Attempt to modify a node that has been replaced"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
mods.add(mod);
|
mods.add(mod);
|
||||||
break;
|
break;
|
||||||
case INSERT_BEFORE:
|
case INSERT_BEFORE:
|
||||||
int i;
|
int i;
|
||||||
for (i=mods.size()-1; i>=0; i--) {
|
for (i= mods.size(); --i >= 0;) {
|
||||||
if (mods.get(i).getKind() == ModificationKind.INSERT_BEFORE) {
|
if (mods.get(i).getKind() == ModificationKind.INSERT_BEFORE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mods.add(i+1, mod);
|
mods.add(i + 1, mod);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of modifications for a given node. The list can contain different modifications.
|
* Returns the list of modifications for a given node. The list can contain different
|
||||||
* It is guaranteed that INSERT_BEFORE modifications appear first. Furthermore, if there is a
|
* modifications. It is guaranteed that INSERT_BEFORE modifications appear first. Furthermore,
|
||||||
* REPLACE modification the list will not contain any other REPLACE or APPEND_CHILD modifications.
|
* if there is a REPLACE modification the list will not contain any other REPLACE or
|
||||||
|
* APPEND_CHILD modifications.
|
||||||
* @return the modification list, which may be empty.
|
* @return the modification list, which may be empty.
|
||||||
*/
|
*/
|
||||||
public List<ASTModification> getModificationsForNode(IASTNode node) {
|
public List<ASTModification> getModificationsForNode(IASTNode node) {
|
||||||
|
|
|
@ -195,8 +195,9 @@ public class ChangeGenerator extends ASTVisitor {
|
||||||
|
|
||||||
createChange(synthNode, synthSource);
|
createChange(synthNode, synthSource);
|
||||||
|
|
||||||
int newOffset = synthNode.getFileLocation().getNodeOffset() + synthNode.getFileLocation().getNodeLength();
|
IASTFileLocation fileLocation = synthNode.getFileLocation();
|
||||||
sourceOffsets.put(synthNode.getFileLocation().getFileName(), Integer.valueOf(newOffset));
|
int newOffset = fileLocation.getNodeOffset() + fileLocation.getNodeLength();
|
||||||
|
sourceOffsets.put(fileLocation.getFileName(), Integer.valueOf(newOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void synthTreatment(IASTTranslationUnit synthTU) {
|
private void synthTreatment(IASTTranslationUnit synthTU) {
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
* IBM Corporation
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index;
|
package org.eclipse.cdt.internal.core.index;
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,6 @@ public class FileEncodingRegistry implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultEncoding() {
|
|
||||||
return defaultEncoding;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void registerFileEncoding(String filename, String encoding) {
|
public void registerFileEncoding(String filename, String encoding) {
|
||||||
if(defaultEncoding.equals(encoding)){
|
if(defaultEncoding.equals(encoding)){
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||||
|
|
||||||
|
@ -63,11 +63,11 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
public static final String PROP_VALUE = "CPreprocessor"; //$NON-NLS-1$
|
public static final String PROP_VALUE = "CPreprocessor"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final int tDEFINED= IToken.FIRST_RESERVED_PREPROCESSOR;
|
public static final int tDEFINED= IToken.FIRST_RESERVED_PREPROCESSOR;
|
||||||
public static final int tEXPANDED_IDENTIFIER= IToken.FIRST_RESERVED_PREPROCESSOR+1;
|
public static final int tEXPANDED_IDENTIFIER= IToken.FIRST_RESERVED_PREPROCESSOR + 1;
|
||||||
public static final int tSCOPE_MARKER= IToken.FIRST_RESERVED_PREPROCESSOR+2;
|
public static final int tSCOPE_MARKER= IToken.FIRST_RESERVED_PREPROCESSOR + 2;
|
||||||
public static final int tSPACE= IToken.FIRST_RESERVED_PREPROCESSOR+3;
|
public static final int tSPACE= IToken.FIRST_RESERVED_PREPROCESSOR + 3;
|
||||||
public static final int tNOSPACE= IToken.FIRST_RESERVED_PREPROCESSOR+4;
|
public static final int tNOSPACE= IToken.FIRST_RESERVED_PREPROCESSOR + 4;
|
||||||
public static final int tMACRO_PARAMETER= IToken.FIRST_RESERVED_PREPROCESSOR+5;
|
public static final int tMACRO_PARAMETER= IToken.FIRST_RESERVED_PREPROCESSOR + 5;
|
||||||
|
|
||||||
private static final int ORIGIN_PREPROCESSOR_DIRECTIVE = OffsetLimitReachedException.ORIGIN_PREPROCESSOR_DIRECTIVE;
|
private static final int ORIGIN_PREPROCESSOR_DIRECTIVE = OffsetLimitReachedException.ORIGIN_PREPROCESSOR_DIRECTIVE;
|
||||||
private static final int ORIGIN_INACTIVE_CODE = OffsetLimitReachedException.ORIGIN_INACTIVE_CODE;
|
private static final int ORIGIN_INACTIVE_CODE = OffsetLimitReachedException.ORIGIN_INACTIVE_CODE;
|
||||||
|
@ -81,7 +81,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
private static final ObjectStyleMacro __cplusplus = new ObjectStyleMacro("__cplusplus".toCharArray(), ONE); //$NON-NLS-1$
|
private static final ObjectStyleMacro __cplusplus = new ObjectStyleMacro("__cplusplus".toCharArray(), ONE); //$NON-NLS-1$
|
||||||
private static final ObjectStyleMacro __STDC__ = new ObjectStyleMacro("__STDC__".toCharArray(), ONE); //$NON-NLS-1$
|
private static final ObjectStyleMacro __STDC__ = new ObjectStyleMacro("__STDC__".toCharArray(), ONE); //$NON-NLS-1$
|
||||||
private static final ObjectStyleMacro __STDC_HOSTED__ = new ObjectStyleMacro("__STDC_HOSTED__".toCharArray(), ONE); //$NON-NLS-1$
|
private static final ObjectStyleMacro __STDC_HOSTED__ = new ObjectStyleMacro("__STDC_HOSTED__".toCharArray(), ONE); //$NON-NLS-1$
|
||||||
private static final ObjectStyleMacro __STDC_VERSION__ = new ObjectStyleMacro("__STDC_VERSION__".toCharArray(), "199901L".toCharArray()); //$NON-NLS-1$ //$NON-NLS-2$
|
private static final ObjectStyleMacro __STDC_VERSION__ =
|
||||||
|
new ObjectStyleMacro("__STDC_VERSION__".toCharArray(), "199901L".toCharArray()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
private static final DynamicMacro __FILE__= new FileMacro("__FILE__".toCharArray()); //$NON-NLS-1$
|
private static final DynamicMacro __FILE__= new FileMacro("__FILE__".toCharArray()); //$NON-NLS-1$
|
||||||
private static final DynamicMacro __DATE__= new DateMacro("__DATE__".toCharArray()); //$NON-NLS-1$
|
private static final DynamicMacro __DATE__= new DateMacro("__DATE__".toCharArray()); //$NON-NLS-1$
|
||||||
|
@ -108,7 +109,11 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static class IncludeResolution {String fLocation; boolean fHeuristic;}
|
private static class IncludeResolution {
|
||||||
|
String fLocation;
|
||||||
|
boolean fHeuristic;
|
||||||
|
}
|
||||||
|
|
||||||
final private IIncludeFileTester<IncludeResolution> createPathTester= new IIncludeFileTester<IncludeResolution>() {
|
final private IIncludeFileTester<IncludeResolution> createPathTester= new IIncludeFileTester<IncludeResolution>() {
|
||||||
public IncludeResolution checkFile(String path, boolean isHeuristicMatch, IncludeSearchPathElement onPath) {
|
public IncludeResolution checkFile(String path, boolean isHeuristicMatch, IncludeSearchPathElement onPath) {
|
||||||
if (fFileContentProvider.getInclusionExists(path)) {
|
if (fFileContentProvider.getInclusionExists(path)) {
|
||||||
|
@ -123,9 +128,11 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
|
|
||||||
private final class TokenSequence implements ITokenSequence {
|
private final class TokenSequence implements ITokenSequence {
|
||||||
private final boolean fStopAtNewline;
|
private final boolean fStopAtNewline;
|
||||||
|
|
||||||
TokenSequence(boolean stopAtNewline) {
|
TokenSequence(boolean stopAtNewline) {
|
||||||
fStopAtNewline= stopAtNewline;
|
fStopAtNewline= stopAtNewline;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Token nextToken() throws OffsetLimitReachedException {
|
public Token nextToken() throws OffsetLimitReachedException {
|
||||||
final Lexer lexer= fCurrentContext.getLexer();
|
final Lexer lexer= fCurrentContext.getLexer();
|
||||||
Token t= lexer.nextToken();
|
Token t= lexer.nextToken();
|
||||||
|
@ -138,9 +145,11 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLastEndOffset() {
|
public int getLastEndOffset() {
|
||||||
return fCurrentContext.getLexer().getLastEndOffset();
|
return fCurrentContext.getLexer().getLastEndOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Token currentToken() {
|
public Token currentToken() {
|
||||||
Token t= fCurrentContext.currentLexerToken();
|
Token t= fCurrentContext.currentLexerToken();
|
||||||
if (fStopAtNewline && t.getType() == Lexer.tNEWLINE)
|
if (fStopAtNewline && t.getType() == Lexer.tNEWLINE)
|
||||||
|
@ -149,6 +158,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TokenSequence fInputToMacroExpansion= new TokenSequence(false);
|
TokenSequence fInputToMacroExpansion= new TokenSequence(false);
|
||||||
TokenSequence fLineInputToMacroExpansion= new TokenSequence(true);
|
TokenSequence fLineInputToMacroExpansion= new TokenSequence(true);
|
||||||
|
|
||||||
|
@ -191,9 +201,9 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
|
|
||||||
private InternalFileContent fRootContent;
|
private InternalFileContent fRootContent;
|
||||||
|
|
||||||
|
public CPreprocessor(FileContent fileContent, IScannerInfo info, ParserLanguage language,
|
||||||
public CPreprocessor(FileContent fileContent, IScannerInfo info, ParserLanguage language, IParserLogService log,
|
IParserLogService log, IScannerExtensionConfiguration configuration,
|
||||||
IScannerExtensionConfiguration configuration, IncludeFileContentProvider readerFactory) {
|
IncludeFileContentProvider readerFactory) {
|
||||||
if (readerFactory instanceof InternalFileContentProvider) {
|
if (readerFactory instanceof InternalFileContentProvider) {
|
||||||
fFileContentProvider= (InternalFileContentProvider) readerFactory;
|
fFileContentProvider= (InternalFileContentProvider) readerFactory;
|
||||||
} else if (readerFactory == null) {
|
} else if (readerFactory == null) {
|
||||||
|
@ -320,7 +330,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
return ScannerUtility.createReconciledPath(directory.getAbsolutePath(), inlcudePath);
|
return ScannerUtility.createReconciledPath(directory.getAbsolutePath(), inlcudePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupMacroDictionary(IScannerExtensionConfiguration config, IScannerInfo info, ParserLanguage lang) {
|
private void setupMacroDictionary(IScannerExtensionConfiguration config, IScannerInfo info,
|
||||||
|
ParserLanguage lang) {
|
||||||
// built in macros
|
// built in macros
|
||||||
fMacroDictionary.put(__CDT_PARSER__.getNameCharArray(), __CDT_PARSER__);
|
fMacroDictionary.put(__CDT_PARSER__.getNameCharArray(), __CDT_PARSER__);
|
||||||
fMacroDictionary.put(__STDC__.getNameCharArray(), __STDC__);
|
fMacroDictionary.put(__STDC__.getNameCharArray(), __STDC__);
|
||||||
|
@ -530,7 +541,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
Token t4= fetchToken();
|
Token t4= fetchToken();
|
||||||
end= t4.getEndOffset();
|
end= t4.getEndOffset();
|
||||||
if (t4.getType() == IToken.tRPAREN) {
|
if (t4.getType() == IToken.tRPAREN) {
|
||||||
fLocationMap.encounterPragmaOperator(t1.getOffset(), t3.getOffset(), t3.getEndOffset(), t4.getEndOffset());
|
fLocationMap.encounterPragmaOperator(t1.getOffset(), t3.getOffset(),
|
||||||
|
t3.getEndOffset(), t4.getEndOffset());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
end= t3.getEndOffset();
|
end= t3.getEndOffset();
|
||||||
|
@ -549,7 +561,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
end= t1.getEndOffset();
|
end= t1.getEndOffset();
|
||||||
pushbackToken(t2);
|
pushbackToken(t2);
|
||||||
}
|
}
|
||||||
fLocationMap.encounterProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE, t1.getCharImage(), t1.getOffset(), end);
|
fLocationMap.encounterProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE, t1.getCharImage(),
|
||||||
|
t1.getOffset(), end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -591,7 +604,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
case IToken.tUTF32STRING:
|
case IToken.tUTF32STRING:
|
||||||
StringType st = StringType.fromToken(tt1);
|
StringType st = StringType.fromToken(tt1);
|
||||||
Token t2;
|
Token t2;
|
||||||
StringBuffer buf= null;
|
StringBuilder buf= null;
|
||||||
int endOffset= 0;
|
int endOffset= 0;
|
||||||
loop: while (true) {
|
loop: while (true) {
|
||||||
t2= fetchToken();
|
t2= fetchToken();
|
||||||
|
@ -603,7 +616,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
case IToken.tUTF32STRING:
|
case IToken.tUTF32STRING:
|
||||||
st = StringType.max(st, StringType.fromToken(tt2));
|
st = StringType.max(st, StringType.fromToken(tt2));
|
||||||
if (buf == null) {
|
if (buf == null) {
|
||||||
buf= new StringBuffer();
|
buf= new StringBuilder();
|
||||||
appendStringContent(buf, t1);
|
appendStringContent(buf, t1);
|
||||||
}
|
}
|
||||||
appendStringContent(buf, t2);
|
appendStringContent(buf, t2);
|
||||||
|
@ -671,7 +684,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
return fCurrentContext.getCodeBranchNesting();
|
return fCurrentContext.getCodeBranchNesting();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void appendStringContent(StringBuffer buf, Token t1) {
|
private void appendStringContent(StringBuilder buf, Token t1) {
|
||||||
final char[] image= t1.getCharImage();
|
final char[] image= t1.getCharImage();
|
||||||
final int length= image.length;
|
final int length= image.length;
|
||||||
int start = 1;
|
int start = 1;
|
||||||
|
@ -689,7 +702,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Token internalFetchToken(final ScannerContext uptoEndOfCtx, int options, boolean withinExpansion) throws OffsetLimitReachedException {
|
Token internalFetchToken(final ScannerContext uptoEndOfCtx, int options, boolean withinExpansion)
|
||||||
|
throws OffsetLimitReachedException {
|
||||||
Token ppToken= fCurrentContext.currentLexerToken();
|
Token ppToken= fCurrentContext.currentLexerToken();
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (ppToken.getType()) {
|
switch (ppToken.getType()) {
|
||||||
|
@ -890,7 +904,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
continue loop;
|
continue loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i=0; i<fAdditionalNumericLiteralSuffixes.length; i++) {
|
for (int i= 0; i < fAdditionalNumericLiteralSuffixes.length; i++) {
|
||||||
if (fAdditionalNumericLiteralSuffixes[i] == c) {
|
if (fAdditionalNumericLiteralSuffixes[i] == c) {
|
||||||
continue loop;
|
continue loop;
|
||||||
}
|
}
|
||||||
|
@ -934,7 +948,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
// Check to see if we find a match in the current directory
|
// Check to see if we find a match in the current directory
|
||||||
final File currentDir= new File(currentFile).getParentFile();
|
final File currentDir= new File(currentFile).getParentFile();
|
||||||
if (currentDir != null) {
|
if (currentDir != null) {
|
||||||
final String fileLocation = ScannerUtility.createReconciledPath(currentDir.getAbsolutePath(), includeDirective);
|
final String fileLocation = ScannerUtility.createReconciledPath(
|
||||||
|
currentDir.getAbsolutePath(), includeDirective);
|
||||||
reader = tester.checkFile(fileLocation, false, null);
|
reader = tester.checkFile(fileLocation, false, null);
|
||||||
if (reader != null) {
|
if (reader != null) {
|
||||||
return reader;
|
return reader;
|
||||||
|
@ -994,7 +1009,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buffer = new StringBuffer("Scanner @ file:"); //$NON-NLS-1$
|
StringBuilder buffer = new StringBuilder("Scanner @ file:"); //$NON-NLS-1$
|
||||||
buffer.append(fCurrentContext.toString());
|
buffer.append(fCurrentContext.toString());
|
||||||
buffer.append(" line: "); //$NON-NLS-1$
|
buffer.append(" line: "); //$NON-NLS-1$
|
||||||
buffer.append(fLocationMap.getCurrentLineNumber(fCurrentContext.currentLexerToken().getOffset()));
|
buffer.append(fLocationMap.getCurrentLineNumber(fCurrentContext.currentLexerToken().getOffset()));
|
||||||
|
@ -1008,7 +1023,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
// this is an undef
|
// this is an undef
|
||||||
fMacroDictionary.remove(macro.getNameCharArray());
|
fMacroDictionary.remove(macro.getNameCharArray());
|
||||||
} else {
|
} else {
|
||||||
PreprocessorMacro result= MacroDefinitionParser.parseMacroDefinition(macro.getNameCharArray(), macro.getParameterList(), expansionImage);
|
PreprocessorMacro result= MacroDefinitionParser.parseMacroDefinition(
|
||||||
|
macro.getNameCharArray(), macro.getParameterList(), expansionImage);
|
||||||
final IASTFileLocation loc= macro.getFileLocation();
|
final IASTFileLocation loc= macro.getFileLocation();
|
||||||
fLocationMap.registerMacroFromIndex(result, loc, -1);
|
fLocationMap.registerMacroFromIndex(result, loc, -1);
|
||||||
fMacroDictionary.put(result.getNameCharArray(), result);
|
fMacroDictionary.put(result.getNameCharArray(), result);
|
||||||
|
@ -1034,7 +1050,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
* Assumes that the pound token has not yet been consumed
|
* Assumes that the pound token has not yet been consumed
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
private void executeDirective(final Lexer lexer, final int startOffset, boolean withinExpansion) throws OffsetLimitReachedException {
|
private void executeDirective(final Lexer lexer, final int startOffset, boolean withinExpansion)
|
||||||
|
throws OffsetLimitReachedException {
|
||||||
final Token ident= lexer.nextToken();
|
final Token ident= lexer.nextToken();
|
||||||
switch (ident.getType()) {
|
switch (ident.getType()) {
|
||||||
case IToken.tCOMPLETION:
|
case IToken.tCOMPLETION:
|
||||||
|
@ -1067,10 +1084,12 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case IPreprocessorDirective.ppImport:
|
case IPreprocessorDirective.ppImport:
|
||||||
case IPreprocessorDirective.ppInclude:
|
case IPreprocessorDirective.ppInclude:
|
||||||
executeInclude(lexer, startOffset, false, fCurrentContext.getCodeState() == CodeState.eActive, withinExpansion);
|
executeInclude(lexer, startOffset, false, fCurrentContext.getCodeState() == CodeState.eActive,
|
||||||
|
withinExpansion);
|
||||||
break;
|
break;
|
||||||
case IPreprocessorDirective.ppInclude_next:
|
case IPreprocessorDirective.ppInclude_next:
|
||||||
executeInclude(lexer, startOffset, true, fCurrentContext.getCodeState() == CodeState.eActive, withinExpansion);
|
executeInclude(lexer, startOffset, true, fCurrentContext.getCodeState() == CodeState.eActive,
|
||||||
|
withinExpansion);
|
||||||
break;
|
break;
|
||||||
case IPreprocessorDirective.ppDefine:
|
case IPreprocessorDirective.ppDefine:
|
||||||
CodeState state= fCurrentContext.getCodeState();
|
CodeState state= fCurrentContext.getCodeState();
|
||||||
|
@ -1149,7 +1168,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
default:
|
default:
|
||||||
int endOffset= lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
int endOffset= lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||||
if (fCurrentContext.getCodeState() == CodeState.eActive) {
|
if (fCurrentContext.getCodeState() == CodeState.eActive) {
|
||||||
handleProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE, ident.getCharImage(), startOffset, endOffset);
|
handleProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE, ident.getCharImage(),
|
||||||
|
startOffset, endOffset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1163,7 +1183,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
return fAllIncludedFiles.contains(location);
|
return fAllIncludedFiles.contains(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeInclude(final Lexer lexer, int poundOffset, boolean include_next, boolean active, boolean withinExpansion) throws OffsetLimitReachedException {
|
private void executeInclude(final Lexer lexer, int poundOffset, boolean include_next,
|
||||||
|
boolean active, boolean withinExpansion) throws OffsetLimitReachedException {
|
||||||
if (withinExpansion) {
|
if (withinExpansion) {
|
||||||
final char[] name= lexer.currentToken().getCharImage();
|
final char[] name= lexer.currentToken().getCharImage();
|
||||||
final int endOffset = lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
final int endOffset = lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||||
|
@ -1207,7 +1228,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
case IToken.tLT:
|
case IToken.tLT:
|
||||||
userInclude= false;
|
userInclude= false;
|
||||||
boolean complete= false;
|
boolean complete= false;
|
||||||
StringBuffer buf= new StringBuffer();
|
StringBuilder buf= new StringBuilder();
|
||||||
t= (Token) t.getNext();
|
t= (Token) t.getNext();
|
||||||
while (t != null) {
|
while (t != null) {
|
||||||
if (t.getType() == IToken.tGT) {
|
if (t.getType() == IToken.tGT) {
|
||||||
|
@ -1229,6 +1250,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
condEndOffset= lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
condEndOffset= lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (headerName == null || headerName.length == 0) {
|
if (headerName == null || headerName.length == 0) {
|
||||||
if (active) {
|
if (active) {
|
||||||
handleProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE,
|
handleProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE,
|
||||||
|
@ -1267,8 +1289,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
fAllIncludedFiles.add(path);
|
fAllIncludedFiles.add(path);
|
||||||
ILocationCtx ctx= fLocationMap.pushInclusion(poundOffset, nameOffsets[0], nameOffsets[1],
|
ILocationCtx ctx= fLocationMap.pushInclusion(poundOffset, nameOffsets[0], nameOffsets[1],
|
||||||
condEndOffset, source, path, headerName, userInclude, isHeuristic, fi.isSource());
|
condEndOffset, source, path, headerName, userInclude, isHeuristic, fi.isSource());
|
||||||
ScannerContext fctx= new ScannerContext(ctx, fCurrentContext, new Lexer(source,
|
ScannerContext fctx= new ScannerContext(ctx, fCurrentContext,
|
||||||
fLexOptions, this, this));
|
new Lexer(source, fLexOptions, this, this));
|
||||||
fctx.setFoundOnPath(fi.getFoundOnPath(), includeDirective);
|
fctx.setFoundOnPath(fi.getFoundOnPath(), includeDirective);
|
||||||
fCurrentContext= fctx;
|
fCurrentContext= fctx;
|
||||||
}
|
}
|
||||||
|
@ -1292,7 +1314,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reported) {
|
if (!reported) {
|
||||||
fLocationMap.encounterPoundInclude(poundOffset, nameOffsets[0], nameOffsets[1], condEndOffset, headerName, path, userInclude, active, isHeuristic);
|
fLocationMap.encounterPoundInclude(poundOffset, nameOffsets[0], nameOffsets[1],
|
||||||
|
condEndOffset, headerName, path, userInclude, active, isHeuristic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1304,7 +1327,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
fLocationMap.skippedFile(fLocationMap.getSequenceNumberForOffset(offset), fi);
|
fLocationMap.skippedFile(fLocationMap.getSequenceNumberForOffset(offset), fi);
|
||||||
}
|
}
|
||||||
|
|
||||||
private char[] extractHeaderName(final char[] image, final char startDelim, final char endDelim, int[] offsets) {
|
private char[] extractHeaderName(final char[] image, final char startDelim, final char endDelim,
|
||||||
|
int[] offsets) {
|
||||||
char[] headerName;
|
char[] headerName;
|
||||||
int start= 0;
|
int start= 0;
|
||||||
int length= image.length;
|
int length= image.length;
|
||||||
|
@ -1334,7 +1358,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void executeDefine(final Lexer lexer, int startOffset, boolean isActive) throws OffsetLimitReachedException {
|
private void executeDefine(final Lexer lexer, int startOffset, boolean isActive)
|
||||||
|
throws OffsetLimitReachedException {
|
||||||
try {
|
try {
|
||||||
ObjectStyleMacro macrodef = fMacroDefinitionParser.parseMacroDefinition(lexer, this);
|
ObjectStyleMacro macrodef = fMacroDefinitionParser.parseMacroDefinition(lexer, this);
|
||||||
if (isActive)
|
if (isActive)
|
||||||
|
@ -1349,7 +1374,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeUndefine(Lexer lexer, int startOffset, boolean isActive) throws OffsetLimitReachedException {
|
private void executeUndefine(Lexer lexer, int startOffset, boolean isActive)
|
||||||
|
throws OffsetLimitReachedException {
|
||||||
final Token name= lexer.nextToken();
|
final Token name= lexer.nextToken();
|
||||||
final int tt= name.getType();
|
final int tt= name.getType();
|
||||||
if (tt != IToken.tIDENTIFIER) {
|
if (tt != IToken.tIDENTIFIER) {
|
||||||
|
@ -1357,7 +1383,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
throw new OffsetLimitReachedException(ORIGIN_PREPROCESSOR_DIRECTIVE, name);
|
throw new OffsetLimitReachedException(ORIGIN_PREPROCESSOR_DIRECTIVE, name);
|
||||||
}
|
}
|
||||||
lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||||
handleProblem(IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, name.getCharImage(), startOffset, name.getEndOffset());
|
handleProblem(IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, name.getCharImage(), startOffset,
|
||||||
|
name.getEndOffset());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||||
|
@ -1369,10 +1396,12 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
} else {
|
} else {
|
||||||
definition= fMacroDictionary.get(namechars);
|
definition= fMacroDictionary.get(namechars);
|
||||||
}
|
}
|
||||||
fLocationMap.encounterPoundUndef(definition, startOffset, name.getOffset(), name.getEndOffset(), endOffset, namechars, isActive);
|
fLocationMap.encounterPoundUndef(definition, startOffset, name.getOffset(),
|
||||||
|
name.getEndOffset(), endOffset, namechars, isActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CodeState executeIfdef(Lexer lexer, int offset, boolean isIfndef, boolean withinExpansion) throws OffsetLimitReachedException {
|
private CodeState executeIfdef(Lexer lexer, int offset, boolean isIfndef,
|
||||||
|
boolean withinExpansion) throws OffsetLimitReachedException {
|
||||||
final Token name= lexer.nextToken();
|
final Token name= lexer.nextToken();
|
||||||
lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||||
final int tt= name.getType();
|
final int tt= name.getType();
|
||||||
|
@ -1413,7 +1442,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
return fCurrentContext.setBranchState(conditional, isTaken, withinExpansion, offset);
|
return fCurrentContext.setBranchState(conditional, isTaken, withinExpansion, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CodeState executeIf(Lexer lexer, int startOffset, boolean isElif, boolean withinExpansion) throws OffsetLimitReachedException {
|
private CodeState executeIf(Lexer lexer, int startOffset, boolean isElif,
|
||||||
|
boolean withinExpansion) throws OffsetLimitReachedException {
|
||||||
Conditional cond= fCurrentContext.newBranch(isElif ? BranchKind.eElif : BranchKind.eIf, withinExpansion);
|
Conditional cond= fCurrentContext.newBranch(isElif ? BranchKind.eElif : BranchKind.eIf, withinExpansion);
|
||||||
if (cond == null) {
|
if (cond == null) {
|
||||||
char[] name= lexer.currentToken().getCharImage();
|
char[] name= lexer.currentToken().getCharImage();
|
||||||
|
@ -1476,7 +1506,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
return fCurrentContext.setBranchState(cond, isTaken, withinExpansion, startOffset);
|
return fCurrentContext.setBranchState(cond, isTaken, withinExpansion, startOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CodeState executeEndif(Lexer lexer, int startOffset, boolean withinExpansion) throws OffsetLimitReachedException {
|
private CodeState executeEndif(Lexer lexer, int startOffset, boolean withinExpansion)
|
||||||
|
throws OffsetLimitReachedException {
|
||||||
final int endOffset= lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
final int endOffset= lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||||
final Conditional cond= fCurrentContext.newBranch(BranchKind.eEnd, withinExpansion);
|
final Conditional cond= fCurrentContext.newBranch(BranchKind.eEnd, withinExpansion);
|
||||||
if (cond == null) {
|
if (cond == null) {
|
||||||
|
@ -1496,7 +1527,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
* converted to the defined-token and its argument is not macro expanded.
|
* converted to the defined-token and its argument is not macro expanded.
|
||||||
* Returns the end-offset of the last token that was consumed.
|
* Returns the end-offset of the last token that was consumed.
|
||||||
*/
|
*/
|
||||||
private int getTokensWithinPPDirective(boolean isCondition, TokenList result, boolean withinExpansion) throws OffsetLimitReachedException {
|
private int getTokensWithinPPDirective(boolean isCondition, TokenList result,
|
||||||
|
boolean withinExpansion) throws OffsetLimitReachedException {
|
||||||
final ScannerContext scannerCtx= fCurrentContext;
|
final ScannerContext scannerCtx= fCurrentContext;
|
||||||
scannerCtx.clearInactiveCodeMarkerToken();
|
scannerCtx.clearInactiveCodeMarkerToken();
|
||||||
int options= STOP_AT_NL;
|
int options= STOP_AT_NL;
|
||||||
|
@ -1530,14 +1562,16 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
return scannerCtx.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
return scannerCtx.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void skipOverConditionalCode(final Lexer lexer, boolean withinExpansion) throws OffsetLimitReachedException {
|
private void skipOverConditionalCode(final Lexer lexer, boolean withinExpansion)
|
||||||
|
throws OffsetLimitReachedException {
|
||||||
CodeState state= CodeState.eSkipInactive;
|
CodeState state= CodeState.eSkipInactive;
|
||||||
while (state == CodeState.eSkipInactive) {
|
while (state == CodeState.eSkipInactive) {
|
||||||
state= skipBranch(lexer, withinExpansion);
|
state= skipBranch(lexer, withinExpansion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CodeState skipBranch(final Lexer lexer, boolean withinExpansion) throws OffsetLimitReachedException {
|
private CodeState skipBranch(final Lexer lexer, boolean withinExpansion)
|
||||||
|
throws OffsetLimitReachedException {
|
||||||
while (true) {
|
while (true) {
|
||||||
final Token pound = lexer.nextDirective();
|
final Token pound = lexer.nextDirective();
|
||||||
int tt = pound.getType();
|
int tt = pound.getType();
|
||||||
|
@ -1603,7 +1637,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
* @param isPPCondition whether the expansion is inside of a preprocessor condition. This
|
* @param isPPCondition whether the expansion is inside of a preprocessor condition. This
|
||||||
* implies a specific handling for the defined token.
|
* implies a specific handling for the defined token.
|
||||||
*/
|
*/
|
||||||
private boolean expandMacro(final Token identifier, Lexer lexer, int options, boolean withinExpansion) throws OffsetLimitReachedException {
|
private boolean expandMacro(final Token identifier, Lexer lexer, int options,
|
||||||
|
boolean withinExpansion) throws OffsetLimitReachedException {
|
||||||
final char[] name= identifier.getCharImage();
|
final char[] name= identifier.getCharImage();
|
||||||
PreprocessorMacro macro= fMacroDictionary.get(name);
|
PreprocessorMacro macro= fMacroDictionary.get(name);
|
||||||
if (macro == null) {
|
if (macro == null) {
|
||||||
|
@ -1625,13 +1660,15 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
final ITokenSequence input= stopAtNewline ? fLineInputToMacroExpansion : fInputToMacroExpansion;
|
final ITokenSequence input= stopAtNewline ? fLineInputToMacroExpansion : fInputToMacroExpansion;
|
||||||
final MacroExpander expander = withinExpansion ? new MacroExpander(this, fMacroDictionary,
|
final MacroExpander expander = withinExpansion ? new MacroExpander(this, fMacroDictionary,
|
||||||
fLocationMap, fLexOptions) : fMacroExpander;
|
fLocationMap, fLexOptions) : fMacroExpander;
|
||||||
TokenList replacement= expander.expand(input, (options & PROTECT_DEFINED) != 0, macro, identifier, contentAssist);
|
TokenList replacement= expander.expand(input, (options & PROTECT_DEFINED) != 0, macro,
|
||||||
|
identifier, contentAssist);
|
||||||
final IASTName[] expansions= expander.clearImplicitExpansions();
|
final IASTName[] expansions= expander.clearImplicitExpansions();
|
||||||
final ImageLocationInfo[] ili= expander.clearImageLocationInfos();
|
final ImageLocationInfo[] ili= expander.clearImageLocationInfos();
|
||||||
final Token last= replacement.last();
|
final Token last= replacement.last();
|
||||||
final int length= last == null ? 0 : last.getEndOffset();
|
final int length= last == null ? 0 : last.getEndOffset();
|
||||||
ILocationCtx ctx= fLocationMap.pushMacroExpansion(
|
ILocationCtx ctx= fLocationMap.pushMacroExpansion(
|
||||||
identifier.getOffset(), identifier.getEndOffset(), lexer.getLastEndOffset(), length, macro, expansions, ili);
|
identifier.getOffset(), identifier.getEndOffset(), lexer.getLastEndOffset(), length,
|
||||||
|
macro, expansions, ili);
|
||||||
fCurrentContext= new ScannerContext(ctx, fCurrentContext, replacement);
|
fCurrentContext= new ScannerContext(ctx, fCurrentContext, replacement);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent.Inclusio
|
||||||
* Internal implementation of the file content providers
|
* Internal implementation of the file content providers
|
||||||
*/
|
*/
|
||||||
public abstract class InternalFileContentProvider extends IncludeFileContentProvider {
|
public abstract class InternalFileContentProvider extends IncludeFileContentProvider {
|
||||||
|
|
||||||
private IIncludeFileResolutionHeuristics fIncludeResolutionHeuristics;
|
private IIncludeFileResolutionHeuristics fIncludeResolutionHeuristics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||||
|
|
||||||
|
@ -22,14 +22,17 @@ import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
|
||||||
final class ScannerContext {
|
final class ScannerContext {
|
||||||
enum BranchKind {eIf, eElif, eElse, eEnd}
|
enum BranchKind {eIf, eElif, eElse, eEnd}
|
||||||
enum CodeState {eActive, eParseInactive, eSkipInactive}
|
enum CodeState {eActive, eParseInactive, eSkipInactive}
|
||||||
|
|
||||||
final static class Conditional {
|
final static class Conditional {
|
||||||
private final CodeState fInitialState;
|
private final CodeState fInitialState;
|
||||||
private BranchKind fLast;
|
private BranchKind fLast;
|
||||||
private boolean fTakeElse= true;
|
private boolean fTakeElse= true;
|
||||||
|
|
||||||
Conditional(CodeState state) {
|
Conditional(CodeState state) {
|
||||||
fInitialState= state;
|
fInitialState= state;
|
||||||
fLast= BranchKind.eIf;
|
fLast= BranchKind.eIf;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean canHaveActiveBranch(boolean withinExpansion) {
|
boolean canHaveActiveBranch(boolean withinExpansion) {
|
||||||
return fTakeElse && isActive(withinExpansion);
|
return fTakeElse && isActive(withinExpansion);
|
||||||
}
|
}
|
||||||
|
@ -174,12 +177,12 @@ final class ScannerContext {
|
||||||
private int getOldNestingLevel(BranchKind kind, int nesting) {
|
private int getOldNestingLevel(BranchKind kind, int nesting) {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case eIf:
|
case eIf:
|
||||||
return nesting-1;
|
return nesting - 1;
|
||||||
case eElif:
|
case eElif:
|
||||||
case eElse:
|
case eElse:
|
||||||
return nesting;
|
return nesting;
|
||||||
case eEnd:
|
case eEnd:
|
||||||
return nesting+1;
|
return nesting + 1;
|
||||||
}
|
}
|
||||||
return nesting;
|
return nesting;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public class LongString implements IString {
|
public class LongString implements IString {
|
||||||
|
|
||||||
private final Database db;
|
private final Database db;
|
||||||
private final long record;
|
private final long record;
|
||||||
private int hash;
|
private int hash;
|
||||||
|
@ -370,7 +369,7 @@ public class LongString implements IString {
|
||||||
|
|
||||||
public String getString() throws CoreException {
|
public String getString() throws CoreException {
|
||||||
int length = db.getInt(record + LENGTH);
|
int length = db.getInt(record + LENGTH);
|
||||||
final StringBuffer buffer = new StringBuffer(length);
|
final StringBuilder buffer = new StringBuilder(length);
|
||||||
readChars(length, new IReader() {
|
readChars(length, new IReader() {
|
||||||
public void appendChar(char c) {
|
public void appendChar(char c) {
|
||||||
buffer.append(c);
|
buffer.append(c);
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.db;
|
package org.eclipse.cdt.internal.core.pdom.db;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -22,7 +21,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public class ShortString implements IString {
|
public class ShortString implements IString {
|
||||||
|
|
||||||
private final Database db;
|
private final Database db;
|
||||||
private final long record;
|
private final long record;
|
||||||
private int hash;
|
private int hash;
|
||||||
|
@ -77,7 +75,7 @@ public class ShortString implements IString {
|
||||||
Chunk chunk = db.getChunk(record);
|
Chunk chunk = db.getChunk(record);
|
||||||
int length = chunk.getInt(record + LENGTH);
|
int length = chunk.getInt(record + LENGTH);
|
||||||
char[] chars = new char[length];
|
char[] chars = new char[length];
|
||||||
chunk.getCharArray(record+CHARS, chars);
|
chunk.getCharArray(record + CHARS, chars);
|
||||||
return chars;
|
return chars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +183,7 @@ public class ShortString implements IString {
|
||||||
|
|
||||||
while (i1 < n1 && i2 < n2) {
|
while (i1 < n1 && i2 < n2) {
|
||||||
int cmp= compareChars(chunk.getChar(i1), other[i2], caseSensitive);
|
int cmp= compareChars(chunk.getChar(i1), other[i2], caseSensitive);
|
||||||
if(cmp!=0)
|
if (cmp != 0)
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
||||||
i1 += 2;
|
i1 += 2;
|
||||||
|
@ -220,7 +218,7 @@ public class ShortString implements IString {
|
||||||
|
|
||||||
while (i1 < n1 && i2 < n2) {
|
while (i1 < n1 && i2 < n2) {
|
||||||
int cmp= compareChars(chunk1.getChar(i1), chunk2.getChar(i2), caseSensitive);
|
int cmp= compareChars(chunk1.getChar(i1), chunk2.getChar(i2), caseSensitive);
|
||||||
if(cmp!=0)
|
if (cmp != 0)
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
||||||
i1 += 2;
|
i1 += 2;
|
||||||
|
@ -245,7 +243,7 @@ public class ShortString implements IString {
|
||||||
|
|
||||||
while (i1 < n1 && i2 < n2) {
|
while (i1 < n1 && i2 < n2) {
|
||||||
int cmp= compareChars(chunk.getChar(i1), other.charAt(i2), caseSensitive);
|
int cmp= compareChars(chunk.getChar(i1), other.charAt(i2), caseSensitive);
|
||||||
if(cmp!=0)
|
if (cmp != 0)
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
||||||
i1 += 2;
|
i1 += 2;
|
||||||
|
@ -260,7 +258,6 @@ public class ShortString implements IString {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int compareCompatibleWithIgnoreCase(IString string) throws CoreException {
|
public int compareCompatibleWithIgnoreCase(IString string) throws CoreException {
|
||||||
if (string instanceof ShortString)
|
if (string instanceof ShortString)
|
||||||
return compareCompatibleWithIgnoreCase((ShortString)string);
|
return compareCompatibleWithIgnoreCase((ShortString)string);
|
||||||
|
@ -270,7 +267,6 @@ public class ShortString implements IString {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int compareCompatibleWithIgnoreCase(ShortString other) throws CoreException {
|
public int compareCompatibleWithIgnoreCase(ShortString other) throws CoreException {
|
||||||
Chunk chunk1 = db.getChunk(record);
|
Chunk chunk1 = db.getChunk(record);
|
||||||
Chunk chunk2 = other.db.getChunk(other.record);
|
Chunk chunk2 = other.db.getChunk(other.record);
|
||||||
|
@ -285,7 +281,7 @@ public class ShortString implements IString {
|
||||||
final char c2= chunk2.getChar(i2);
|
final char c2= chunk2.getChar(i2);
|
||||||
if (c1 != c2) {
|
if (c1 != c2) {
|
||||||
int cmp= compareChars(c1, c2, false); // insensitive
|
int cmp= compareChars(c1, c2, false); // insensitive
|
||||||
if(cmp!=0)
|
if (cmp != 0)
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
||||||
if (sensitiveCmp == 0) {
|
if (sensitiveCmp == 0) {
|
||||||
|
@ -323,7 +319,7 @@ public class ShortString implements IString {
|
||||||
final char c2= chars[i2];
|
final char c2= chars[i2];
|
||||||
if (c1 != c2) {
|
if (c1 != c2) {
|
||||||
int cmp= compareChars(c1, c2, false); // insensitive
|
int cmp= compareChars(c1, c2, false); // insensitive
|
||||||
if(cmp!=0)
|
if (cmp != 0)
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
||||||
if (sensitiveCmp == 0) {
|
if (sensitiveCmp == 0) {
|
||||||
|
@ -358,7 +354,7 @@ public class ShortString implements IString {
|
||||||
|
|
||||||
while (i1 < n1 && i2 < n2) {
|
while (i1 < n1 && i2 < n2) {
|
||||||
int cmp= compareChars(chunk.getChar(i1), other[i2], caseSensitive);
|
int cmp= compareChars(chunk.getChar(i1), other[i2], caseSensitive);
|
||||||
if(cmp!=0)
|
if (cmp != 0)
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
||||||
i1 += 2;
|
i1 += 2;
|
||||||
|
@ -372,7 +368,7 @@ public class ShortString implements IString {
|
||||||
}
|
}
|
||||||
|
|
||||||
public char charAt(int i) throws CoreException {
|
public char charAt(int i) throws CoreException {
|
||||||
long ptr = record + CHARS + (i*2);
|
long ptr = record + CHARS + (i * 2);
|
||||||
return db.getChar(ptr);
|
return db.getChar(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +391,7 @@ public class ShortString implements IString {
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public static int compareChars(char a, char b, boolean caseSensitive) {
|
public static int compareChars(char a, char b, boolean caseSensitive) {
|
||||||
if(caseSensitive) {
|
if (caseSensitive) {
|
||||||
if (a < b)
|
if (a < b)
|
||||||
return -1;
|
return -1;
|
||||||
if (a > b)
|
if (a > b)
|
||||||
|
@ -417,7 +413,7 @@ public class ShortString implements IString {
|
||||||
* benchmark first.
|
* benchmark first.
|
||||||
*
|
*
|
||||||
* public static int compareChars(char a, char b, boolean caseSensitive) {
|
* public static int compareChars(char a, char b, boolean caseSensitive) {
|
||||||
if(caseSensitive) {
|
if (caseSensitive) {
|
||||||
if (a < b)
|
if (a < b)
|
||||||
return -1;
|
return -1;
|
||||||
if (a > b)
|
if (a > b)
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
|
@ -607,8 +607,8 @@ public class PDOMFile implements IIndexFragmentFile {
|
||||||
if (nameOffset + name.getNodeLength() <= offset + length) {
|
if (nameOffset + name.getNodeLength() <= offset + length) {
|
||||||
result.add(name);
|
result.add(name);
|
||||||
} else if (name.isReference()) {
|
} else if (name.isReference()) {
|
||||||
// names are ordered, but callers are inserted before
|
// Names are ordered, but callers are inserted before
|
||||||
// their references
|
// their references.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -640,23 +640,22 @@ public class PDOMFile implements IIndexFragmentFile {
|
||||||
return result.toArray(new IIndexName[result.size()]);
|
return result.toArray(new IIndexName[result.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PDOMFile findFile(PDOMLinkage linkage, BTree btree, IIndexFileLocation location, IIndexLocationConverter strategy)
|
public static PDOMFile findFile(PDOMLinkage linkage, BTree btree, IIndexFileLocation location,
|
||||||
throws CoreException {
|
IIndexLocationConverter strategy) throws CoreException {
|
||||||
String internalRepresentation= strategy.toInternalFormat(location);
|
String internalRepresentation= strategy.toInternalFormat(location);
|
||||||
long record= 0;
|
|
||||||
if (internalRepresentation != null) {
|
if (internalRepresentation != null) {
|
||||||
Finder finder = new Finder(linkage.getDB(), internalRepresentation, linkage.getLinkageID());
|
Finder finder = new Finder(linkage.getDB(), internalRepresentation, linkage.getLinkageID());
|
||||||
btree.accept(finder);
|
btree.accept(finder);
|
||||||
record= finder.getRecord();
|
long record= finder.getRecord();
|
||||||
}
|
if (record != 0) {
|
||||||
if (record != 0) {
|
return new PDOMFile(linkage, record);
|
||||||
return new PDOMFile(linkage, record);
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IIndexFragmentFile[] findFiles(PDOM pdom, BTree btree, IIndexFileLocation location, IIndexLocationConverter strategy)
|
public static IIndexFragmentFile[] findFiles(PDOM pdom, BTree btree, IIndexFileLocation location,
|
||||||
throws CoreException {
|
IIndexLocationConverter strategy) throws CoreException {
|
||||||
String internalRepresentation= strategy.toInternalFormat(location);
|
String internalRepresentation= strategy.toInternalFormat(location);
|
||||||
if (internalRepresentation != null) {
|
if (internalRepresentation != null) {
|
||||||
Finder finder = new Finder(pdom.getDB(), internalRepresentation, -1);
|
Finder finder = new Finder(pdom.getDB(), internalRepresentation, -1);
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
|
@ -138,7 +138,6 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation {
|
||||||
if (nextName != null)
|
if (nextName != null)
|
||||||
nextName.setPrevInContainer(prevName);
|
nextName.setPrevInContainer(prevName);
|
||||||
|
|
||||||
|
|
||||||
final IString expansion = getExpansionInDB();
|
final IString expansion = getExpansionInDB();
|
||||||
if (expansion != null) {
|
if (expansion != null) {
|
||||||
expansion.delete();
|
expansion.delete();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2010 IBM Corporation and others.
|
* Copyright (c) 2005, 2011 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -564,9 +564,19 @@ outer:
|
||||||
*/
|
*/
|
||||||
public void generateExternalMarker(IResource file, int lineNumber, String desc, int severity, String varName, IPath externalPath) {
|
public void generateExternalMarker(IResource file, int lineNumber, String desc, int severity, String varName, IPath externalPath) {
|
||||||
ProblemMarkerInfo problemMarkerInfo = new ProblemMarkerInfo(file, lineNumber, desc, severity, varName, externalPath);
|
ProblemMarkerInfo problemMarkerInfo = new ProblemMarkerInfo(file, lineNumber, desc, severity, varName, externalPath);
|
||||||
|
this.addProblemMarker(problemMarkerInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the given marker to the list of error markers.
|
||||||
|
*
|
||||||
|
* @param problemMarkerInfo - The marker to be added.
|
||||||
|
* @since 5.4
|
||||||
|
*/
|
||||||
|
public void addProblemMarker(ProblemMarkerInfo problemMarkerInfo){
|
||||||
fErrors.add(problemMarkerInfo);
|
fErrors.add(problemMarkerInfo);
|
||||||
fMarkerGenerator.addMarker(problemMarkerInfo);
|
fMarkerGenerator.addMarker(problemMarkerInfo);
|
||||||
if (severity == IMarkerGenerator.SEVERITY_ERROR_RESOURCE)
|
if (problemMarkerInfo.severity == IMarkerGenerator.SEVERITY_ERROR_RESOURCE)
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2009 Siemens AG.
|
* Copyright (c) 2006, 2011 Siemens AG and others.
|
||||||
* All rights reserved. This content and the accompanying materials
|
* All rights reserved. This content and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,14 +7,27 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Norbert Ploett - Initial implementation
|
* Norbert Ploett - Initial implementation
|
||||||
|
* Sami Wagiaalla (Red Hat) - Bug 352166: Added attributes and type API
|
||||||
|
* and improved documentation.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.core;
|
package org.eclipse.cdt.core;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||||
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* {@code ProblemMarkerInfo} is an object used to pass error properties to {@link ErrorParserManager}.
|
||||||
|
* The information stored in this object will later be used to create an {@link IMarker} by {@link ACBuilder}
|
||||||
|
* @see ErrorParserManager#addProblemMarker(ProblemMarkerInfo)
|
||||||
|
* @see ErrorParserManager#generateMarker(IResource, int, String, int, String)
|
||||||
|
* @see ErrorParserManager#generateExternalMarker(IResource, int, String, int, String, IPath)
|
||||||
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*/
|
*/
|
||||||
public class ProblemMarkerInfo {
|
public class ProblemMarkerInfo {
|
||||||
|
@ -25,25 +38,98 @@ public class ProblemMarkerInfo {
|
||||||
public int severity;
|
public int severity;
|
||||||
public String variableName;
|
public String variableName;
|
||||||
public IPath externalPath ;
|
public IPath externalPath ;
|
||||||
|
private Map<String, String> attributes;
|
||||||
|
private String type;
|
||||||
|
|
||||||
public ProblemMarkerInfo(IResource file, int lineNumber, String desciption, int severity, String variableName) {
|
/**
|
||||||
this.file = file;
|
* Create a new {@link ProblemMarkerInfo} object.
|
||||||
this.lineNumber = lineNumber;
|
*
|
||||||
this.description = desciption;
|
* @param file - the file where the problem has occurred.
|
||||||
this.severity = severity;
|
* @param lineNumber - the line number of the problem.
|
||||||
this.variableName = variableName;
|
* @param description - a description of the problem.
|
||||||
this.externalPath = null ;
|
* @param severity - the severity of the problem, see {@link IMarkerGenerator}
|
||||||
}
|
* for acceptable severity values.
|
||||||
|
* @param variableName - the name of the variable involved in the error if any.
|
||||||
|
*/
|
||||||
public ProblemMarkerInfo(IResource file, int lineNumber, String description, int severity, String variableName, IPath externalPath) {
|
public ProblemMarkerInfo(IResource file, int lineNumber, String description, int severity, String variableName) {
|
||||||
super();
|
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.lineNumber = lineNumber;
|
this.lineNumber = lineNumber;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.severity = severity;
|
this.severity = severity;
|
||||||
this.variableName = variableName;
|
this.variableName = variableName;
|
||||||
|
this.externalPath = null ;
|
||||||
|
this.type = null;
|
||||||
|
this.attributes = new HashMap<String, String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@link ProblemMarkerInfo} object.
|
||||||
|
*
|
||||||
|
* @param file - the file where the problem has occurred.
|
||||||
|
* @param lineNumber - the line number of the problem.
|
||||||
|
* @param description - a description of the problem.
|
||||||
|
* @param severity - the severity of the problem, see {@link IMarkerGenerator}
|
||||||
|
* for acceptable severity values
|
||||||
|
* @param variableName - the name of the variable involved in the error if any.
|
||||||
|
* @param externalPath - if this error involves a file outside the workspace this parameter should
|
||||||
|
* contain the path to that file.
|
||||||
|
*/
|
||||||
|
public ProblemMarkerInfo(IResource file, int lineNumber, String description, int severity, String variableName, IPath externalPath) {
|
||||||
|
this(file, lineNumber, description, severity, variableName);
|
||||||
this.externalPath = externalPath;
|
this.externalPath = externalPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attribute map.
|
||||||
|
* @return Map of attributes and their values.
|
||||||
|
* @since 5.4
|
||||||
|
*/
|
||||||
|
public Map<String, String> getAttributes(){
|
||||||
|
return this.attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the value of the attribute with the given key,
|
||||||
|
* or null if no such attribute exists.
|
||||||
|
*
|
||||||
|
* @param key - attribute key.
|
||||||
|
* @return attribute value
|
||||||
|
* @since 5.4
|
||||||
|
*/
|
||||||
|
public String getAttribute(String key){
|
||||||
|
return this.attributes.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of the attribute with the given key
|
||||||
|
* to the given value, or add one if one does not already
|
||||||
|
* exist.
|
||||||
|
*
|
||||||
|
* @param key - attribute key.
|
||||||
|
* @param value - new attribute value.
|
||||||
|
* @since 5.4
|
||||||
|
*/
|
||||||
|
public void setAttribute(String key, String value){
|
||||||
|
this.attributes.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the type of this problem marker or null
|
||||||
|
* if type was not set.
|
||||||
|
* @return the type.
|
||||||
|
* @since 5.4
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the type of this problem marker.
|
||||||
|
*
|
||||||
|
* @param type - the new type.
|
||||||
|
* @since 5.4
|
||||||
|
*/
|
||||||
|
public void setType(String type){
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ package org.eclipse.cdt.core.resources;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CCorePreferenceConstants;
|
import org.eclipse.cdt.core.CCorePreferenceConstants;
|
||||||
|
@ -85,7 +86,11 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IMarker marker = markerResource.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
|
String type = problemMarkerInfo.getType();
|
||||||
|
if (type == null)
|
||||||
|
type = ICModelMarker.C_MODEL_PROBLEM_MARKER;
|
||||||
|
|
||||||
|
IMarker marker = markerResource.createMarker(type);
|
||||||
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
||||||
marker.setAttribute(IMarker.SEVERITY, mapMarkerSeverity(problemMarkerInfo.severity));
|
marker.setAttribute(IMarker.SEVERITY, mapMarkerSeverity(problemMarkerInfo.severity));
|
||||||
marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber);
|
marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber);
|
||||||
|
@ -105,6 +110,14 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
||||||
} else if (problemMarkerInfo.lineNumber==0){
|
} else if (problemMarkerInfo.lineNumber==0){
|
||||||
marker.setAttribute(IMarker.LOCATION, " "); //$NON-NLS-1$
|
marker.setAttribute(IMarker.LOCATION, " "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add all other client defined attributes.
|
||||||
|
Map<String, String> attributes = problemMarkerInfo.getAttributes();
|
||||||
|
if (attributes != null){
|
||||||
|
for (Entry<String, String> entry : attributes.entrySet()) {
|
||||||
|
marker.setAttribute(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (CoreException e) {
|
catch (CoreException e) {
|
||||||
CCorePlugin.log(e.getStatus());
|
CCorePlugin.log(e.getStatus());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2009 QNX Software Systems and others.
|
* Copyright (c) 2000, 2011 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -178,6 +178,10 @@ public class CCodeFormatter extends CodeFormatter {
|
||||||
ParserUtil.getParserLogService());
|
ParserUtil.getParserLogService());
|
||||||
CodeFormatterVisitor codeFormatter = new CodeFormatterVisitor(preferences, offset, length);
|
CodeFormatterVisitor codeFormatter = new CodeFormatterVisitor(preferences, offset, length);
|
||||||
edit= codeFormatter.format(source, ast);
|
edit= codeFormatter.format(source, ast);
|
||||||
|
IStatus status= codeFormatter.getStatus();
|
||||||
|
if (!status.isOK()) {
|
||||||
|
CCorePlugin.log(status);
|
||||||
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
throw new AbortFormatting(e);
|
throw new AbortFormatting(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1603,8 +1603,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
private int visit(IASTArrayDeclarator node) {
|
private int visit(IASTArrayDeclarator node) {
|
||||||
IASTArrayModifier[] arrayModifiers= node.getArrayModifiers();
|
IASTArrayModifier[] arrayModifiers= node.getArrayModifiers();
|
||||||
if (arrayModifiers != null) {
|
if (arrayModifiers != null) {
|
||||||
for (IASTArrayModifier arrayModifier2 : arrayModifiers) {
|
for (IASTArrayModifier arrayModifier : arrayModifiers) {
|
||||||
IASTArrayModifier arrayModifier = arrayModifier2;
|
|
||||||
scribe.printNextToken(Token.tLBRACKET, preferences.insert_space_before_opening_bracket);
|
scribe.printNextToken(Token.tLBRACKET, preferences.insert_space_before_opening_bracket);
|
||||||
boolean emptyBrackets= arrayModifier.getConstantExpression() == null
|
boolean emptyBrackets= arrayModifier.getConstantExpression() == null
|
||||||
&& !(arrayModifier instanceof ICASTArrayModifier);
|
&& !(arrayModifier instanceof ICASTArrayModifier);
|
||||||
|
@ -1625,10 +1624,13 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Runnable tailFormatter = scribe.takeTailFormatter();
|
||||||
try {
|
try {
|
||||||
arrayModifier.accept(this);
|
arrayModifier.accept(this);
|
||||||
} catch (ASTProblemException e) {
|
} catch (ASTProblemException e) {
|
||||||
scribe.skipToToken(Token.tRBRACKET);
|
scribe.skipToToken(Token.tRBRACKET);
|
||||||
|
} finally {
|
||||||
|
scribe.setTailFormatter(tailFormatter);
|
||||||
}
|
}
|
||||||
boolean insertSpace= emptyBrackets ?
|
boolean insertSpace= emptyBrackets ?
|
||||||
preferences.insert_space_between_empty_brackets :
|
preferences.insert_space_between_empty_brackets :
|
||||||
|
@ -1772,7 +1774,9 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
|
|
||||||
// Consider macro expansion
|
// Consider macro expansion
|
||||||
if (withinMacroExpansion(node, scribe.scanner.getCurrentPosition())) {
|
if (withinMacroExpansion(node, scribe.scanner.getCurrentPosition())) {
|
||||||
|
scribe.printNextToken(peekNextToken());
|
||||||
continueNode(node);
|
continueNode(node);
|
||||||
|
if (scribe.printComment()) scribe.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (node.getKey()) {
|
switch (node.getKey()) {
|
||||||
|
@ -1823,7 +1827,9 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
|
|
||||||
// Consider macro expansion
|
// Consider macro expansion
|
||||||
if (withinMacroExpansion(node, scribe.scanner.getCurrentPosition())) {
|
if (withinMacroExpansion(node, scribe.scanner.getCurrentPosition())) {
|
||||||
|
scribe.printNextToken(peekNextToken());
|
||||||
continueNode(node);
|
continueNode(node);
|
||||||
|
if (scribe.printComment()) scribe.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (node.getKey()) {
|
switch (node.getKey()) {
|
||||||
|
@ -2078,7 +2084,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < elementsLength; i++) {
|
for (i = 0; i < elementsLength; i++) {
|
||||||
final IASTNode node= elements.get(i);
|
final IASTNode node= elements.get(i);
|
||||||
if (i < alignment.fragmentCount - 1) {
|
if (i < elementsLength - 1) {
|
||||||
scribe.setTailFormatter(
|
scribe.setTailFormatter(
|
||||||
new TrailingTokenFormatter(options.fSeparatorToken,
|
new TrailingTokenFormatter(options.fSeparatorToken,
|
||||||
options.fSpaceBeforeSeparator,
|
options.fSpaceBeforeSeparator,
|
||||||
|
@ -2093,7 +2099,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
} else {
|
} else {
|
||||||
node.accept(this);
|
node.accept(this);
|
||||||
}
|
}
|
||||||
if (i < alignment.fragmentCount - 1) {
|
if (i < elementsLength - 1) {
|
||||||
scribe.runTailFormatter();
|
scribe.runTailFormatter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2366,7 +2372,12 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
if (preferences.insert_space_after_opening_paren_in_method_invocation) {
|
if (preferences.insert_space_after_opening_paren_in_method_invocation) {
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
node.getOperand().accept(this);
|
Runnable tailFormatter = scribe.takeTailFormatter();
|
||||||
|
try {
|
||||||
|
node.getOperand().accept(this);
|
||||||
|
} finally {
|
||||||
|
scribe.setTailFormatter(tailFormatter);
|
||||||
|
}
|
||||||
scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_method_invocation);
|
scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_method_invocation);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2595,7 +2606,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
return formatOverloadedLeftShiftChain(node);
|
return formatOverloadedLeftShiftChain(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
Runnable tailFormatter = scribe.takeTailFormatter();
|
Runnable tailFormatter = endsWithMacroExpansion(node) ? null : scribe.takeTailFormatter();
|
||||||
|
|
||||||
Alignment expressionAlignment= scribe.createAlignment(
|
Alignment expressionAlignment= scribe.createAlignment(
|
||||||
Alignment.BINARY_EXPRESSION,
|
Alignment.BINARY_EXPRESSION,
|
||||||
|
@ -3132,11 +3143,18 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
formatLeftCurlyBrace(line, preferences.brace_position_for_block);
|
formatLeftCurlyBrace(line, preferences.brace_position_for_block);
|
||||||
if (startNode(body)) {
|
if (startNode(body)) {
|
||||||
try {
|
try {
|
||||||
|
final boolean braceOnSameLine = DefaultCodeFormatterConstants.END_OF_LINE.equals(preferences.brace_position_for_block);
|
||||||
|
if (!braceOnSameLine) {
|
||||||
|
ok = true;
|
||||||
|
scribe.exitAlignment(alignment, true);
|
||||||
|
}
|
||||||
formatBlockOpening((IASTCompoundStatement) body,
|
formatBlockOpening((IASTCompoundStatement) body,
|
||||||
preferences.brace_position_for_block,
|
preferences.brace_position_for_block,
|
||||||
preferences.insert_space_before_opening_brace_in_block);
|
preferences.insert_space_before_opening_brace_in_block);
|
||||||
ok = true;
|
if (braceOnSameLine) {
|
||||||
scribe.exitAlignment(alignment, true);
|
ok = true;
|
||||||
|
scribe.exitAlignment(alignment, true);
|
||||||
|
}
|
||||||
formatOpenedBlock((IASTCompoundStatement) body,
|
formatOpenedBlock((IASTCompoundStatement) body,
|
||||||
preferences.brace_position_for_block,
|
preferences.brace_position_for_block,
|
||||||
preferences.indent_statements_compare_to_block);
|
preferences.indent_statements_compare_to_block);
|
||||||
|
@ -3300,7 +3318,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elseStatement instanceof IASTCompoundStatement) {
|
if (elseStatement instanceof IASTCompoundStatement && !enclosedInMacroExpansion(elseStatement)) {
|
||||||
elseStatement.accept(this);
|
elseStatement.accept(this);
|
||||||
} else if (elseStatement instanceof IASTIfStatement) {
|
} else if (elseStatement instanceof IASTIfStatement) {
|
||||||
if (!preferences.compact_else_if) {
|
if (!preferences.compact_else_if) {
|
||||||
|
@ -3805,8 +3823,13 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
if (preferences.insert_space_after_opening_paren_in_parenthesized_expression ) {
|
if (preferences.insert_space_after_opening_paren_in_parenthesized_expression ) {
|
||||||
scribe.space();
|
scribe.space();
|
||||||
}
|
}
|
||||||
if (operand != null) {
|
Runnable tailFormatter = scribe.takeTailFormatter();
|
||||||
operand.accept(this);
|
try {
|
||||||
|
if (operand != null) {
|
||||||
|
operand.accept(this);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
scribe.setTailFormatter(tailFormatter);
|
||||||
}
|
}
|
||||||
if (peekNextToken() != Token.tRPAREN) {
|
if (peekNextToken() != Token.tRPAREN) {
|
||||||
if (!enclosedInMacroExpansion(operand)) {
|
if (!enclosedInMacroExpansion(operand)) {
|
||||||
|
@ -3883,22 +3906,22 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean withinMacroExpansion(IASTNode node, int offset) {
|
private static boolean withinMacroExpansion(IASTNode node, int offset) {
|
||||||
|
IASTFileLocation loc = node.getFileLocation();
|
||||||
|
if (loc == null || offset < loc.getNodeOffset() || offset >= loc.getNodeOffset() + loc.getNodeLength()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
IASTNodeLocation[] locations= node.getNodeLocations();
|
IASTNodeLocation[] locations= node.getNodeLocations();
|
||||||
for (IASTNodeLocation location : locations) {
|
for (IASTNodeLocation location : locations) {
|
||||||
if (location instanceof IASTMacroExpansionLocation) {
|
IASTFileLocation fileLocation = location.asFileLocation();
|
||||||
IASTFileLocation fileLocation = location.asFileLocation();
|
if (fileLocation != null) {
|
||||||
if (fileLocation != null) {
|
final int nodeOffset = fileLocation.getNodeOffset();
|
||||||
final int nodeOffset = fileLocation.getNodeOffset();
|
final int endOffset = nodeOffset + fileLocation.getNodeLength();
|
||||||
final int endOffset = nodeOffset + fileLocation.getNodeLength();
|
if (offset >= nodeOffset && offset < endOffset) {
|
||||||
if (offset >= nodeOffset && offset < endOffset) {
|
return location instanceof IASTMacroExpansionLocation;
|
||||||
return true;
|
|
||||||
} else if (offset < nodeOffset) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean doNodeLocationsOverlap(IASTNode node1, IASTNode node2) {
|
private static boolean doNodeLocationsOverlap(IASTNode node1, IASTNode node2) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
* Copyright (c) 2004, 2011 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -800,7 +800,7 @@ public class SimpleScanner {
|
||||||
private void getRestOfPreprocessorLine() {
|
private void getRestOfPreprocessorLine() {
|
||||||
int c = getChar();
|
int c = getChar();
|
||||||
while (true) {
|
while (true) {
|
||||||
while ((c != '\n') && (c != '\r') && (c != '/') && (c != EOFCHAR)) {
|
while ((c != '\n') && (c != '\r') && (c != '/') && (c != '"') && (c != EOFCHAR)) {
|
||||||
c = getChar();
|
c = getChar();
|
||||||
}
|
}
|
||||||
if (c == '/') {
|
if (c == '/') {
|
||||||
|
@ -823,6 +823,9 @@ public class SimpleScanner {
|
||||||
c = next;
|
c = next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
} else if (c == '"') {
|
||||||
|
matchStringLiteral();
|
||||||
|
c = getChar();
|
||||||
} else {
|
} else {
|
||||||
ungetChar(c);
|
ungetChar(c);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
@ -266,8 +265,6 @@ public class XmlUtil {
|
||||||
if (!storeFile.exists()) {
|
if (!storeFile.exists()) {
|
||||||
storeFile.createNewFile();
|
storeFile.createNewFile();
|
||||||
}
|
}
|
||||||
OutputStream fileStream = new FileOutputStream(storeFile);
|
|
||||||
|
|
||||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||||
Transformer transformer = transformerFactory.newTransformer();
|
Transformer transformer = transformerFactory.newTransformer();
|
||||||
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
|
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
|
||||||
|
@ -279,7 +276,7 @@ public class XmlUtil {
|
||||||
StreamResult result = new StreamResult(new FileOutputStream(storeFile));
|
StreamResult result = new StreamResult(new FileOutputStream(storeFile));
|
||||||
transformer.transform(source, result);
|
transformer.transform(source, result);
|
||||||
|
|
||||||
fileStream.close();
|
result.getOutputStream().close();
|
||||||
ResourcesUtil.refreshWorkspaceFiles(uriLocation);
|
ResourcesUtil.refreshWorkspaceFiles(uriLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,9 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
* Reads multiple sections in comments from the source of the given class.
|
* Reads multiple sections in comments from the source of the given class.
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public StringBuffer[] getContentsForTest(int sections) throws IOException {
|
public StringBuilder[] getContentsForTest(int sections) throws IOException {
|
||||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", getClass(), getName(), sections);
|
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui",
|
||||||
|
getClass(), getName(), sections);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAboveComment() throws IOException {
|
public String getAboveComment() throws IOException {
|
||||||
|
|
|
@ -551,7 +551,7 @@ public class BasicCallHierarchyTest extends CallHierarchyBaseTest {
|
||||||
// sf();
|
// sf();
|
||||||
// }
|
// }
|
||||||
public void testStaticFunctionsC() throws Exception {
|
public void testStaticFunctionsC() throws Exception {
|
||||||
StringBuffer[] sbs= getContentsForTest(2);
|
StringBuilder[] sbs= getContentsForTest(2);
|
||||||
String content2= sbs[0].toString();
|
String content2= sbs[0].toString();
|
||||||
String content1= content2 + sbs[1].toString();
|
String content1= content2 + sbs[1].toString();
|
||||||
IFile file1= createFile(getProject(), "staticFunc1.c", content1);
|
IFile file1= createFile(getProject(), "staticFunc1.c", content1);
|
||||||
|
@ -620,7 +620,7 @@ public class BasicCallHierarchyTest extends CallHierarchyBaseTest {
|
||||||
// sf();
|
// sf();
|
||||||
// }
|
// }
|
||||||
public void testStaticFunctionsCpp() throws Exception {
|
public void testStaticFunctionsCpp() throws Exception {
|
||||||
StringBuffer[] sbs= getContentsForTest(2);
|
StringBuilder[] sbs= getContentsForTest(2);
|
||||||
String content2= sbs[0].toString();
|
String content2= sbs[0].toString();
|
||||||
String content1= content2 + sbs[1].toString();
|
String content1= content2 + sbs[1].toString();
|
||||||
IFile file1= createFile(getProject(), "staticFunc1.cpp", content1);
|
IFile file1= createFile(getProject(), "staticFunc1.cpp", content1);
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
||||||
// n->inline_method(); // r3
|
// n->inline_method(); // r3
|
||||||
// }
|
// }
|
||||||
public void testMethods() throws Exception {
|
public void testMethods() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(2);
|
StringBuilder[] content= getContentsForTest(2);
|
||||||
String header= content[0].toString();
|
String header= content[0].toString();
|
||||||
String source = content[1].toString();
|
String source = content[1].toString();
|
||||||
IFile headerFile= createFile(fCProject.getProject(), "testMethods.h", header);
|
IFile headerFile= createFile(fCProject.getProject(), "testMethods.h", header);
|
||||||
|
@ -155,7 +155,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
||||||
// method3();
|
// method3();
|
||||||
// }
|
// }
|
||||||
public void testMethodsInMultipleFiles() throws Exception {
|
public void testMethodsInMultipleFiles() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(3);
|
StringBuilder[] content= getContentsForTest(3);
|
||||||
String header= content[0].toString();
|
String header= content[0].toString();
|
||||||
String source1 = content[1].toString();
|
String source1 = content[1].toString();
|
||||||
String source2 = content[2].toString();
|
String source2 = content[2].toString();
|
||||||
|
@ -205,7 +205,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
||||||
// method3();
|
// method3();
|
||||||
// }
|
// }
|
||||||
public void testMultipleImplsForMethod() throws Exception {
|
public void testMultipleImplsForMethod() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(3);
|
StringBuilder[] content= getContentsForTest(3);
|
||||||
String header= content[0].toString();
|
String header= content[0].toString();
|
||||||
String source1 = content[1].toString();
|
String source1 = content[1].toString();
|
||||||
String source2 = content[2].toString();
|
String source2 = content[2].toString();
|
||||||
|
@ -266,7 +266,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
||||||
// mc.method1();
|
// mc.method1();
|
||||||
// }
|
// }
|
||||||
public void testReverseMultipleImplsForMethod() throws Exception {
|
public void testReverseMultipleImplsForMethod() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(3);
|
StringBuilder[] content= getContentsForTest(3);
|
||||||
String header= content[0].toString();
|
String header= content[0].toString();
|
||||||
String source1 = content[1].toString();
|
String source1 = content[1].toString();
|
||||||
String source2 = content[2].toString();
|
String source2 = content[2].toString();
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
||||||
// field= 1;
|
// field= 1;
|
||||||
// }
|
// }
|
||||||
public void testCallHierarchyFromOutlineView_183941() throws Exception {
|
public void testCallHierarchyFromOutlineView_183941() throws Exception {
|
||||||
StringBuffer[] contents = getContentsForTest(2);
|
StringBuilder[] contents = getContentsForTest(2);
|
||||||
IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString());
|
IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString());
|
||||||
IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString());
|
IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString());
|
||||||
waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||||
|
@ -95,7 +95,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
||||||
// ref2= 0;
|
// ref2= 0;
|
||||||
// }
|
// }
|
||||||
public void testCallHierarchyFromOutlineViewAmbiguous_183941() throws Exception {
|
public void testCallHierarchyFromOutlineViewAmbiguous_183941() throws Exception {
|
||||||
StringBuffer[] contents = getContentsForTest(2);
|
StringBuilder[] contents = getContentsForTest(2);
|
||||||
IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString());
|
IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString());
|
||||||
IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString());
|
IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString());
|
||||||
waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||||
|
@ -363,7 +363,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
||||||
// shared_func();
|
// shared_func();
|
||||||
// }
|
// }
|
||||||
public void testMultiLanguageWithPrototype_260262() throws Exception {
|
public void testMultiLanguageWithPrototype_260262() throws Exception {
|
||||||
final StringBuffer[] contents = getContentsForTest(3);
|
final StringBuilder[] contents = getContentsForTest(3);
|
||||||
final String hcontent = contents[0].toString();
|
final String hcontent = contents[0].toString();
|
||||||
final String content_inc = contents[1].toString();
|
final String content_inc = contents[1].toString();
|
||||||
final String content_full = content_inc + contents[2].toString();
|
final String content_full = content_inc + contents[2].toString();
|
||||||
|
@ -393,7 +393,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
||||||
// shared_func();
|
// shared_func();
|
||||||
// }
|
// }
|
||||||
public void testMultiLanguageWithInlinedfunc_260262() throws Exception {
|
public void testMultiLanguageWithInlinedfunc_260262() throws Exception {
|
||||||
final StringBuffer[] contents = getContentsForTest(3);
|
final StringBuilder[] contents = getContentsForTest(3);
|
||||||
final String hcontent = contents[0].toString();
|
final String hcontent = contents[0].toString();
|
||||||
final String content_inc = contents[1].toString();
|
final String content_inc = contents[1].toString();
|
||||||
final String content_full = content_inc + contents[2].toString();
|
final String content_full = content_inc + contents[2].toString();
|
||||||
|
@ -425,7 +425,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
public void testUnnamedNamespace_283679() throws Exception {
|
public void testUnnamedNamespace_283679() throws Exception {
|
||||||
final StringBuffer[] contents = getContentsForTest(1);
|
final StringBuilder[] contents = getContentsForTest(1);
|
||||||
final String content = contents[0].toString();
|
final String content = contents[0].toString();
|
||||||
IFile f2= createFile(getProject(), "testUnnamedNamespace_283679.cpp", content);
|
IFile f2= createFile(getProject(), "testUnnamedNamespace_283679.cpp", content);
|
||||||
waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||||
|
@ -460,7 +460,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
||||||
// delete dbPtr;
|
// delete dbPtr;
|
||||||
// }
|
// }
|
||||||
public void testCallsToFromVirtualMethod_246064() throws Exception {
|
public void testCallsToFromVirtualMethod_246064() throws Exception {
|
||||||
final StringBuffer[] contents = getContentsForTest(1);
|
final StringBuilder[] contents = getContentsForTest(1);
|
||||||
final String content = contents[0].toString();
|
final String content = contents[0].toString();
|
||||||
IFile f2= createFile(getProject(), "testCallsToFromVirtualMethod_246064.cpp", content);
|
IFile f2= createFile(getProject(), "testCallsToFromVirtualMethod_246064.cpp", content);
|
||||||
waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
||||||
// n->inline_method(); // r3
|
// n->inline_method(); // r3
|
||||||
// }
|
// }
|
||||||
public void testMethods() throws Exception {
|
public void testMethods() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(2);
|
CharSequence[] content= getContentsForTest(2);
|
||||||
String header= content[0].toString();
|
String header= content[0].toString();
|
||||||
String source = content[1].toString();
|
String source = content[1].toString();
|
||||||
IFile headerFile= createFile(getProject(), "testMethods.h", header);
|
IFile headerFile= createFile(getProject(), "testMethods.h", header);
|
||||||
|
@ -127,7 +127,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
||||||
// method3();
|
// method3();
|
||||||
// }
|
// }
|
||||||
public void testMethodsInMultipleFiles() throws Exception {
|
public void testMethodsInMultipleFiles() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(3);
|
CharSequence[] content= getContentsForTest(3);
|
||||||
String header= content[0].toString();
|
String header= content[0].toString();
|
||||||
String source1 = content[1].toString();
|
String source1 = content[1].toString();
|
||||||
String source2 = content[2].toString();
|
String source2 = content[2].toString();
|
||||||
|
@ -177,7 +177,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
||||||
// method3();
|
// method3();
|
||||||
// }
|
// }
|
||||||
public void testMultipleImplsForMethod() throws Exception {
|
public void testMultipleImplsForMethod() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(3);
|
CharSequence[] content= getContentsForTest(3);
|
||||||
String header= content[0].toString();
|
String header= content[0].toString();
|
||||||
String source1 = content[1].toString();
|
String source1 = content[1].toString();
|
||||||
String source2 = content[2].toString();
|
String source2 = content[2].toString();
|
||||||
|
@ -237,7 +237,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
||||||
// mc.method1();
|
// mc.method1();
|
||||||
// }
|
// }
|
||||||
public void testReverseMultipleImplsForMethod() throws Exception {
|
public void testReverseMultipleImplsForMethod() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(3);
|
CharSequence[] content= getContentsForTest(3);
|
||||||
String header= content[0].toString();
|
String header= content[0].toString();
|
||||||
String source1 = content[1].toString();
|
String source1 = content[1].toString();
|
||||||
String source2 = content[2].toString();
|
String source2 = content[2].toString();
|
||||||
|
@ -294,7 +294,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
||||||
// cxcpp();
|
// cxcpp();
|
||||||
// }
|
// }
|
||||||
public void testCPPCallsC() throws Exception {
|
public void testCPPCallsC() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(2);
|
CharSequence[] content= getContentsForTest(2);
|
||||||
String cSource= content[0].toString();
|
String cSource= content[0].toString();
|
||||||
String cppSource = content[1].toString();
|
String cppSource = content[1].toString();
|
||||||
IFile cFile= createFile(getProject(), "s.c", cSource);
|
IFile cFile= createFile(getProject(), "s.c", cSource);
|
||||||
|
@ -339,7 +339,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
||||||
// cppfunc();
|
// cppfunc();
|
||||||
// }}
|
// }}
|
||||||
public void testCCallsCPP() throws Exception {
|
public void testCCallsCPP() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(2);
|
CharSequence[] content= getContentsForTest(2);
|
||||||
String cSource= content[0].toString();
|
String cSource= content[0].toString();
|
||||||
String cppSource = content[1].toString();
|
String cppSource = content[1].toString();
|
||||||
IFile cFile= createFile(getProject(), "s.c", cSource);
|
IFile cFile= createFile(getProject(), "s.c", cSource);
|
||||||
|
@ -411,7 +411,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
||||||
// f('1');
|
// f('1');
|
||||||
// }
|
// }
|
||||||
public void testTemplates() throws Exception {
|
public void testTemplates() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(1);
|
CharSequence[] content= getContentsForTest(1);
|
||||||
String source = content[0].toString();
|
String source = content[0].toString();
|
||||||
IFile file= createFile(getProject(), "testTemplates.cpp", source);
|
IFile file= createFile(getProject(), "testTemplates.cpp", source);
|
||||||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||||
|
@ -475,7 +475,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
||||||
// []{c();}();
|
// []{c();}();
|
||||||
// }
|
// }
|
||||||
public void testClosures_316307() throws Exception {
|
public void testClosures_316307() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(1);
|
CharSequence[] content= getContentsForTest(1);
|
||||||
String source = content[0].toString();
|
String source = content[0].toString();
|
||||||
IFile file= createFile(getProject(), "testClosures.cpp", source);
|
IFile file= createFile(getProject(), "testClosures.cpp", source);
|
||||||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
||||||
public void testSimpleInclusion() throws Exception {
|
public void testSimpleInclusion() throws Exception {
|
||||||
TestScannerProvider.sIncludes= new String[]{getProject().getProject().getLocation().toOSString()};
|
TestScannerProvider.sIncludes= new String[]{getProject().getProject().getLocation().toOSString()};
|
||||||
|
|
||||||
StringBuffer[] contents= getContentsForTest(1);
|
StringBuilder[] contents= getContentsForTest(1);
|
||||||
IProject project= getProject().getProject();
|
IProject project= getProject().getProject();
|
||||||
IFile user= createFile(project, "user.h", "");
|
IFile user= createFile(project, "user.h", "");
|
||||||
IFile system= createFile(project, "system.h", "");
|
IFile system= createFile(project, "system.h", "");
|
||||||
|
@ -76,7 +76,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
||||||
|
|
||||||
TestScannerProvider.sIncludes= new String[]{op.getProject().getLocation().toOSString()};
|
TestScannerProvider.sIncludes= new String[]{op.getProject().getLocation().toOSString()};
|
||||||
|
|
||||||
StringBuffer[] contents= getContentsForTest(1);
|
StringBuilder[] contents= getContentsForTest(1);
|
||||||
IFile user= createFile(op.getProject(), "user.h", "");
|
IFile user= createFile(op.getProject(), "user.h", "");
|
||||||
IFile system= createFile(op.getProject(), "system.h", "");
|
IFile system= createFile(op.getProject(), "system.h", "");
|
||||||
IFile source= createFile(getProject().getProject(), "source.cpp", contents[0].toString());
|
IFile source= createFile(getProject().getProject(), "source.cpp", contents[0].toString());
|
||||||
|
@ -98,8 +98,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
||||||
checkTreeNode(tree, 0, "system.h");
|
checkTreeNode(tree, 0, "system.h");
|
||||||
checkTreeNode(tree, 0, 0, "source.cpp");
|
checkTreeNode(tree, 0, 0, "source.cpp");
|
||||||
|
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
CProjectHelper.delete(op);
|
CProjectHelper.delete(op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
||||||
//#define MACRO2()
|
//#define MACRO2()
|
||||||
//int main(int argc, char** argv) {}
|
//int main(int argc, char** argv) {}
|
||||||
public void testSimpleOutlineContent() throws Exception {
|
public void testSimpleOutlineContent() throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(1);
|
StringBuilder[] contents= getContentsForTest(1);
|
||||||
IProject project= getProject().getProject();
|
IProject project= getProject().getProject();
|
||||||
IFile source= createFile(project, "source.cpp", contents[0].toString());
|
IFile source= createFile(project, "source.cpp", contents[0].toString());
|
||||||
waitForIndexer(project, source);
|
waitForIndexer(project, source);
|
||||||
|
@ -121,7 +121,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
||||||
//int Foo::field = 5;
|
//int Foo::field = 5;
|
||||||
//void Foo::foo() {}
|
//void Foo::foo() {}
|
||||||
public void testGroupedMembers() throws Exception {
|
public void testGroupedMembers() throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
StringBuilder[] contents= getContentsForTest(2);
|
||||||
IProject project= getProject().getProject();
|
IProject project= getProject().getProject();
|
||||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||||
|
@ -162,7 +162,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
||||||
//void Foo::foo() {}
|
//void Foo::foo() {}
|
||||||
//}
|
//}
|
||||||
public void testGroupedMembersInNamespace() throws Exception {
|
public void testGroupedMembersInNamespace() throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
StringBuilder[] contents= getContentsForTest(2);
|
||||||
IProject project= getProject().getProject();
|
IProject project= getProject().getProject();
|
||||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||||
|
@ -208,7 +208,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
||||||
//void Foo::foo() {}
|
//void Foo::foo() {}
|
||||||
//}
|
//}
|
||||||
public void testGroupedNamespaces() throws Exception {
|
public void testGroupedNamespaces() throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
StringBuilder[] contents= getContentsForTest(2);
|
||||||
IProject project= getProject().getProject();
|
IProject project= getProject().getProject();
|
||||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||||
|
@ -252,7 +252,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
||||||
//void Foo::foo() {}
|
//void Foo::foo() {}
|
||||||
//}
|
//}
|
||||||
public void testGroupedMembersInGroupedNamespaces() throws Exception {
|
public void testGroupedMembersInGroupedNamespaces() throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
StringBuilder[] contents= getContentsForTest(2);
|
||||||
IProject project= getProject().getProject();
|
IProject project= getProject().getProject();
|
||||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||||
|
|
|
@ -58,7 +58,7 @@ import org.eclipse.cdt.internal.ui.search.PDOMSearchViewPage;
|
||||||
|
|
||||||
public class BasicSearchTest extends BaseUITestCase {
|
public class BasicSearchTest extends BaseUITestCase {
|
||||||
ICProject fCProject;
|
ICProject fCProject;
|
||||||
StringBuffer[] testData;
|
CharSequence[] testData;
|
||||||
|
|
||||||
public static TestSuite suite() {
|
public static TestSuite suite() {
|
||||||
return suite(BasicSearchTest.class);
|
return suite(BasicSearchTest.class);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class LinkedNamesFinderTest extends AST2BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
protected CharSequence[] getContents(int sections) throws IOException {
|
||||||
CTestPlugin plugin = CTestPlugin.getDefault();
|
CTestPlugin plugin = CTestPlugin.getDefault();
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
throw new AssertionFailedError("This test must be run as a JUnit plugin test");
|
throw new AssertionFailedError("This test must be run as a JUnit plugin test");
|
||||||
|
|
|
@ -233,7 +233,7 @@ public class AbstractAutoEditTest extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuffer[] getTestContents() {
|
protected CharSequence[] getTestContents() {
|
||||||
try {
|
try {
|
||||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 2);
|
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 2);
|
||||||
} catch(IOException ioe) {
|
} catch(IOException ioe) {
|
||||||
|
@ -242,7 +242,7 @@ public class AbstractAutoEditTest extends BaseTestCase {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuffer[] getTestContents1() {
|
protected CharSequence[] getTestContents1() {
|
||||||
try {
|
try {
|
||||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 1);
|
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 1);
|
||||||
} catch(IOException ioe) {
|
} catch(IOException ioe) {
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class AddBlockCommentTest extends BaseUITestCase {
|
||||||
*/
|
*/
|
||||||
protected void assertFormatterResult(LinePosition startLinePosition, LinePosition endLinePosition)
|
protected void assertFormatterResult(LinePosition startLinePosition, LinePosition endLinePosition)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
StringBuilder[] contents= getContentsForTest(2);
|
||||||
String before = contents[0].toString();
|
String before = contents[0].toString();
|
||||||
String after = contents[1].toString();
|
String after = contents[1].toString();
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class CIndenterTest extends BaseUITestCase {
|
||||||
|
|
||||||
protected void assertIndenterResult() throws Exception {
|
protected void assertIndenterResult() throws Exception {
|
||||||
CCorePlugin.setOptions(fOptions);
|
CCorePlugin.setOptions(fOptions);
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
StringBuilder[] contents= getContentsForTest(2);
|
||||||
String before= contents[0].toString();
|
String before= contents[0].toString();
|
||||||
IDocument document= new Document(before);
|
IDocument document= new Document(before);
|
||||||
String expected= contents[1].toString();
|
String expected= contents[1].toString();
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertFormatterResult() throws Exception {
|
protected void assertFormatterResult() throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
CharSequence[] contents= getContentsForTest(2);
|
||||||
String before= contents[0].toString();
|
String before= contents[0].toString();
|
||||||
String expected= contents[1].toString();
|
String expected= contents[1].toString();
|
||||||
assertFormatterResult(before, expected);
|
assertFormatterResult(before, expected);
|
||||||
|
@ -2383,4 +2383,198 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testDoubleClosingAngleBrackets_Bug333816() throws Exception {
|
public void testDoubleClosingAngleBrackets_Bug333816() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//void foo() {
|
||||||
|
// int i;
|
||||||
|
// for (iiiiiiiiiiiiiiiiii = 0; iiiiiiiiiiiiiiiiii < 10; iiiiiiiiiiiiiiiiii++) {
|
||||||
|
// }
|
||||||
|
// foo();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void foo() {
|
||||||
|
// int i;
|
||||||
|
// for (iiiiiiiiiiiiiiiiii = 0; iiiiiiiiiiiiiiiiii < 10;
|
||||||
|
// iiiiiiiiiiiiiiiiii++) {
|
||||||
|
// }
|
||||||
|
// foo();
|
||||||
|
//}
|
||||||
|
public void testForLoopWrappingAtOpeningBrace() throws Exception {
|
||||||
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "80");
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
//void foo() {
|
||||||
|
// int i;
|
||||||
|
// for (i = 0; i < 10; i++) {
|
||||||
|
// }
|
||||||
|
// foo();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void foo() {
|
||||||
|
// int i;
|
||||||
|
// for (i = 0; i < 10; i++) {
|
||||||
|
// }
|
||||||
|
// foo();
|
||||||
|
//}
|
||||||
|
public void testForLoopKnR_Bug351399() throws Exception {
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
//void foo() {
|
||||||
|
// int i;
|
||||||
|
// for (i = 0; i < 10; i++) {
|
||||||
|
// }
|
||||||
|
// foo();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void foo()
|
||||||
|
// {
|
||||||
|
// int i;
|
||||||
|
// for (i = 0; i < 10; i++)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
// foo();
|
||||||
|
// }
|
||||||
|
public void testForLoopWhitesmiths_Bug351399() throws Exception {
|
||||||
|
fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap());
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
//void foo() {
|
||||||
|
// int i;
|
||||||
|
// for (i = 0; i < 10; i++) {
|
||||||
|
// }
|
||||||
|
// foo();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void
|
||||||
|
//foo()
|
||||||
|
//{
|
||||||
|
// int i;
|
||||||
|
// for (i = 0; i < 10; i++)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
// foo();
|
||||||
|
//}
|
||||||
|
public void testForLoopGNU_Bug351399() throws Exception {
|
||||||
|
fOptions.putAll(DefaultCodeFormatterOptions.getGNUSettings().getMap());
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
//void foo() {
|
||||||
|
// int i;
|
||||||
|
// for (i = 0; i < 10; i++) {
|
||||||
|
// }
|
||||||
|
// foo();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void foo()
|
||||||
|
//{
|
||||||
|
// int i;
|
||||||
|
// for (i = 0; i < 10; i++)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
// foo();
|
||||||
|
//}
|
||||||
|
public void testForLoopAllman_Bug351399() throws Exception {
|
||||||
|
fOptions.putAll(DefaultCodeFormatterOptions.getAllmanSettings().getMap());
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
//void f() {
|
||||||
|
// int i = static_cast<int>(5+1);
|
||||||
|
// int j;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void f() {
|
||||||
|
// int i = static_cast<int>(5 + 1);
|
||||||
|
// int j;
|
||||||
|
//}
|
||||||
|
public void testStaticCastInInitializer_Bug353974() throws Exception {
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
//#define A 1
|
||||||
|
//#define B 2
|
||||||
|
//#define C 4
|
||||||
|
//void f(int x, int y) {
|
||||||
|
// f(A|B|C,5);
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//#define A 1
|
||||||
|
//#define B 2
|
||||||
|
//#define C 4
|
||||||
|
//void f(int x, int y) {
|
||||||
|
// f(A | B | C, 5);
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
public void testMacroInBinaryExpression_Bug344379() throws Exception {
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBackslashUInPreprocessorDirective_Bug350433() throws Exception {
|
||||||
|
String before= "#include \"test\\udp.h\"\n";
|
||||||
|
String expected= before;
|
||||||
|
assertFormatterResult(before, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
//#define SIZE 5
|
||||||
|
//char s0[5];
|
||||||
|
//char s1[1+1];
|
||||||
|
//char s2[SIZE];
|
||||||
|
//char s3[SIZE+1];
|
||||||
|
//char s4[SIZE+SIZE];
|
||||||
|
//char s5[1+SIZE];
|
||||||
|
|
||||||
|
//#define SIZE 5
|
||||||
|
//char s0[5];
|
||||||
|
//char s1[1 + 1];
|
||||||
|
//char s2[SIZE];
|
||||||
|
//char s3[SIZE + 1];
|
||||||
|
//char s4[SIZE + SIZE];
|
||||||
|
//char s5[1 + SIZE];
|
||||||
|
public void testExpressionInArrayDeclarator_Bug350816() throws Exception {
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
//void f(int p0 ,... ){}
|
||||||
|
|
||||||
|
//void f(int p0, ...) {
|
||||||
|
//}
|
||||||
|
public void testEllipsisInFunctionDefinition_Bug350689() throws Exception {
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
//struct{int n;}* l;
|
||||||
|
//void f(int p0, int p1) { f((p0 + 2), l->n); }
|
||||||
|
|
||||||
|
//struct {
|
||||||
|
// int n;
|
||||||
|
//}* l;
|
||||||
|
//void f(int p0, int p1) {
|
||||||
|
// f((p0 + 2), l->n);
|
||||||
|
//}
|
||||||
|
public void testParenthesizedExpressionInArgumentList_Bug350689() throws Exception {
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
//#define m(x) { x=1; }
|
||||||
|
//void f() {
|
||||||
|
// int i;
|
||||||
|
// if (1) i=1;
|
||||||
|
// else m(i);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//#define m(x) { x=1; }
|
||||||
|
//void f() {
|
||||||
|
// int i;
|
||||||
|
// if (1)
|
||||||
|
// i = 1;
|
||||||
|
// else
|
||||||
|
// m(i);
|
||||||
|
//}
|
||||||
|
public void testMacroInElseBranch_Bug350689() throws Exception {
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -599,7 +599,7 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
|
||||||
IDocument doc = new Document();
|
IDocument doc = new Document();
|
||||||
textTools.setupCDocument(doc);
|
textTools.setupCDocument(doc);
|
||||||
|
|
||||||
StringBuffer[] raw= getTestContents();
|
CharSequence[] raw= getTestContents();
|
||||||
String init= raw[0].toString(), expected= raw[1].toString();
|
String init= raw[0].toString(), expected= raw[1].toString();
|
||||||
|
|
||||||
int caretInit= init.indexOf('X');
|
int caretInit= init.indexOf('X');
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class RemoveBlockCommentTest extends BaseUITestCase {
|
||||||
protected void assertFormatterResult(
|
protected void assertFormatterResult(
|
||||||
LinePosition startLinePosition,
|
LinePosition startLinePosition,
|
||||||
LinePosition endLinePosition) throws Exception {
|
LinePosition endLinePosition) throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
CharSequence[] contents= getContentsForTest(2);
|
||||||
String before = contents[0].toString();
|
String before = contents[0].toString();
|
||||||
String after = contents[1].toString();
|
String after = contents[1].toString();
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class ShiftActionTest extends BaseUITestCase {
|
||||||
// for(;;) {
|
// for(;;) {
|
||||||
// }
|
// }
|
||||||
public void testShiftRight() throws Exception {
|
public void testShiftRight() throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
CharSequence[] contents= getContentsForTest(2);
|
||||||
String before= contents[0].toString();
|
String before= contents[0].toString();
|
||||||
String after= contents[1].toString();
|
String after= contents[1].toString();
|
||||||
fDocument.set(before);
|
fDocument.set(before);
|
||||||
|
@ -150,7 +150,7 @@ public class ShiftActionTest extends BaseUITestCase {
|
||||||
// for(;;) {
|
// for(;;) {
|
||||||
//}
|
//}
|
||||||
public void testShiftLeft() throws Exception {
|
public void testShiftLeft() throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
CharSequence[] contents= getContentsForTest(2);
|
||||||
String before= contents[0].toString();
|
String before= contents[0].toString();
|
||||||
String after= contents[1].toString();
|
String after= contents[1].toString();
|
||||||
fDocument.set(before);
|
fDocument.set(before);
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class SortLinesTest extends BaseUITestCase {
|
||||||
// // e.h
|
// // e.h
|
||||||
// #include "e.h"
|
// #include "e.h"
|
||||||
public void testSortLinesMixed() throws Exception {
|
public void testSortLinesMixed() throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
CharSequence[] contents= getContentsForTest(2);
|
||||||
String before= contents[0].toString();
|
String before= contents[0].toString();
|
||||||
String after= contents[1].toString();
|
String after= contents[1].toString();
|
||||||
fDocument.set(before);
|
fDocument.set(before);
|
||||||
|
@ -179,7 +179,7 @@ public class SortLinesTest extends BaseUITestCase {
|
||||||
// * Callisto
|
// * Callisto
|
||||||
// */
|
// */
|
||||||
public void testSortLinesCommentsOnly() throws Exception {
|
public void testSortLinesCommentsOnly() throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
CharSequence[] contents= getContentsForTest(2);
|
||||||
String before= contents[0].toString();
|
String before= contents[0].toString();
|
||||||
String after= contents[1].toString();
|
String after= contents[1].toString();
|
||||||
fDocument.set(before);
|
fDocument.set(before);
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class TemplateFormatterTest extends BaseUITestCase {
|
||||||
assertFormatterResult(false);
|
assertFormatterResult(false);
|
||||||
}
|
}
|
||||||
protected void assertFormatterResult(boolean useFormatter) throws Exception {
|
protected void assertFormatterResult(boolean useFormatter) throws Exception {
|
||||||
StringBuffer[] contents= getContentsForTest(2);
|
CharSequence[] contents= getContentsForTest(2);
|
||||||
String before= contents[0].toString().replaceAll("\\r\\n", "\n");
|
String before= contents[0].toString().replaceAll("\\r\\n", "\n");
|
||||||
String expected= contents[1].toString();
|
String expected= contents[1].toString();
|
||||||
final Document document = new Document(before);
|
final Document document = new Document(before);
|
||||||
|
|
|
@ -192,7 +192,7 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||||
fProject= project;
|
fProject= project;
|
||||||
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
||||||
StringBuffer sourceContent= getContentsForTest(1)[0];
|
StringBuilder sourceContent= getContentsForTest(1)[0];
|
||||||
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n");
|
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n");
|
||||||
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
||||||
assertTrue("No cursor location specified", fCursorOffset >= 0);
|
assertTrue("No cursor location specified", fCursorOffset >= 0);
|
||||||
|
@ -955,7 +955,7 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
// #include "header191315.h"
|
// #include "header191315.h"
|
||||||
// void xxx() { c_lin/*cursor*/
|
// void xxx() { c_lin/*cursor*/
|
||||||
public void testExternC_bug191315() throws Exception {
|
public void testExternC_bug191315() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(3);
|
CharSequence[] content= getContentsForTest(3);
|
||||||
createFile(fProject, "header191315.h", content[0].toString());
|
createFile(fProject, "header191315.h", content[0].toString());
|
||||||
createFile(fProject, "source191315.c", content[1].toString());
|
createFile(fProject, "source191315.c", content[1].toString());
|
||||||
createFile(fProject, "source191315.cpp", content[1].toString());
|
createFile(fProject, "source191315.cpp", content[1].toString());
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
||||||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||||
fProject= project;
|
fProject= project;
|
||||||
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
||||||
StringBuffer sourceContent= getContentsForTest(1)[0];
|
StringBuilder sourceContent= getContentsForTest(1)[0];
|
||||||
int includeOffset= Math.max(0, sourceContent.indexOf(INCLUDE_LOCATION_TAG));
|
int includeOffset= Math.max(0, sourceContent.indexOf(INCLUDE_LOCATION_TAG));
|
||||||
sourceContent.insert(includeOffset, "#include \""+HEADER_FILE_NAME+"\"\n");
|
sourceContent.insert(includeOffset, "#include \""+HEADER_FILE_NAME+"\"\n");
|
||||||
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
||||||
|
@ -309,7 +309,7 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
||||||
// #include "header191315.h"
|
// #include "header191315.h"
|
||||||
// void xxx() { c_lin/*cursor*/
|
// void xxx() { c_lin/*cursor*/
|
||||||
public void testExternC_bug191315() throws Exception {
|
public void testExternC_bug191315() throws Exception {
|
||||||
StringBuffer[] content= getContentsForTest(3);
|
CharSequence[] content= getContentsForTest(3);
|
||||||
createFile(fProject, "header191315.h", content[0].toString());
|
createFile(fProject, "header191315.h", content[0].toString());
|
||||||
createFile(fProject, "source191315.c", content[1].toString());
|
createFile(fProject, "source191315.c", content[1].toString());
|
||||||
createFile(fProject, "source191315.cpp", content[1].toString());
|
createFile(fProject, "source191315.cpp", content[1].toString());
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ParameterHintTests extends AbstractContentAssistTest {
|
||||||
@Override
|
@Override
|
||||||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||||
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
||||||
StringBuffer sourceContent= getContentsForTest(1)[0];
|
StringBuilder sourceContent= getContentsForTest(1)[0];
|
||||||
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n");
|
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n");
|
||||||
assertNotNull(createFile(project, HEADER_FILE_NAME, headerContent));
|
assertNotNull(createFile(project, HEADER_FILE_NAME, headerContent));
|
||||||
return createFile(project, SOURCE_FILE_NAME, sourceContent.toString());
|
return createFile(project, SOURCE_FILE_NAME, sourceContent.toString());
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class ShowCamelCasePreferenceTest extends AbstractContentAssistTest {
|
||||||
@Override
|
@Override
|
||||||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||||
fProject= project;
|
fProject= project;
|
||||||
StringBuffer sourceContent= getContentsForTest(1)[0];
|
StringBuilder sourceContent= getContentsForTest(1)[0];
|
||||||
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
||||||
assertTrue("No cursor location specified", fCursorOffset >= 0);
|
assertTrue("No cursor location specified", fCursorOffset >= 0);
|
||||||
sourceContent.delete(fCursorOffset, fCursorOffset+CURSOR_LOCATION_TAG.length());
|
sourceContent.delete(fCursorOffset, fCursorOffset+CURSOR_LOCATION_TAG.length());
|
||||||
|
|
|
@ -673,7 +673,7 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit
|
||||||
final IDocument doc = new Document();
|
final IDocument doc = new Document();
|
||||||
textTools.setupCDocument(doc);
|
textTools.setupCDocument(doc);
|
||||||
|
|
||||||
StringBuffer[] raw= getTestContents();
|
CharSequence[] raw= getTestContents();
|
||||||
String init= raw[0].toString(), expected= raw[1].toString();
|
String init= raw[0].toString(), expected= raw[1].toString();
|
||||||
|
|
||||||
int caretInit= init.indexOf('X');
|
int caretInit= init.indexOf('X');
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue