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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -87,9 +87,13 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
|
|||
}
|
||||
|
||||
if (file!=null) {
|
||||
String filePath = new Path(fileName).toString();
|
||||
String foundLocation = file.getLocation().toString();
|
||||
if (!foundLocation.endsWith(filePath)) {
|
||||
IPath filePath = new Path(fileName);
|
||||
if(filePath.segment(0).compareTo("..") == 0) { //$NON-NLS-1$
|
||||
filePath = filePath.removeFirstSegments(1);
|
||||
}
|
||||
|
||||
String foundLocation = file.getLocationURI().toString();
|
||||
if (!foundLocation.endsWith(filePath.toString())) {
|
||||
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-Localization: plugin
|
||||
Export-Package: org.eclipse.cdt.build.core.scannerconfig,
|
||||
org.eclipse.cdt.build.internal.core.scannerconfig;x-internal:=true,
|
||||
org.eclipse.cdt.build.internal.core.scannerconfig2;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-friends:="org.eclipse.cdt.managedbuilder.ui",
|
||||
org.eclipse.cdt.managedbuilder.buildmodel,
|
||||
org.eclipse.cdt.managedbuilder.buildproperties,
|
||||
org.eclipse.cdt.managedbuilder.core,
|
||||
org.eclipse.cdt.managedbuilder.envvar,
|
||||
org.eclipse.cdt.managedbuilder.internal.buildmodel;x-internal:=true,
|
||||
org.eclipse.cdt.managedbuilder.internal.core;x-internal:=true,
|
||||
org.eclipse.cdt.managedbuilder.internal.buildmodel;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
||||
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.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.macros,
|
||||
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.projectconverter,
|
||||
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.processes,
|
||||
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;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.cdt.codan.core.param.IProblemPreference;
|
||||
import org.eclipse.cdt.codan.core.test.CheckerTestCase;
|
||||
import org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectChecker;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Test for {@see StatementHasNoEffectChecker} class
|
||||
*
|
||||
|
@ -107,7 +107,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
|
|||
// }
|
||||
/* this test is using two files */
|
||||
public void test2FilesUnaryExpression() throws IOException {
|
||||
StringBuffer[] code = getContents(2);
|
||||
CharSequence[] code = getContents(2);
|
||||
File f1 = loadcode(code[0].toString());
|
||||
File f2 = loadcode(code[1].toString());
|
||||
runOnProject();
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.codan.core.test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
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.semantics.CPPVisitor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* TODO: add description
|
||||
*/
|
||||
|
@ -56,7 +56,7 @@ public abstract class CodanFastCxxAstTestCase extends TestCase {
|
|||
return getContents(1)[0].toString();
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) {
|
||||
protected StringBuilder[] getContents(int sections) {
|
||||
try {
|
||||
CodanCoreTestActivator plugin = CodanCoreTestActivator.getDefault();
|
||||
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() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final NullLogService NULL_LOG = new NullLogService();
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,12 +10,6 @@
|
|||
*******************************************************************************/
|
||||
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.dom.IPDOMManager;
|
||||
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.Plugin;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* TODO: add description
|
||||
*/
|
||||
|
@ -170,9 +170,10 @@ public class CodanTestCase extends BaseTestCase {
|
|||
return getContents(1)[0].toString();
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) {
|
||||
protected StringBuilder[] getContents(int sections) {
|
||||
try {
|
||||
return TestSourceReader.getContentsForTest(getPlugin().getBundle(), getSourcePrefix(), getClass(), getName(), sections);
|
||||
return TestSourceReader.getContentsForTest(getPlugin().getBundle(), getSourcePrefix(),
|
||||
getClass(), getName(), sections);
|
||||
} catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
return null;
|
||||
|
|
|
@ -10,16 +10,16 @@
|
|||
*******************************************************************************/
|
||||
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.ui.AbstractCodanCMarkerResolution;
|
||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||
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
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@ public class SuggestedParenthesisQuickFixTest extends QuickFixTestCase {
|
|||
* quick fix is not called
|
||||
*/
|
||||
public void test2FilesExample() throws FileNotFoundException, IOException {
|
||||
StringBuffer[] code = getContents(2);
|
||||
CharSequence[] code = getContents(2);
|
||||
File f1 = loadcode(code[0].toString());
|
||||
File f2 = loadcode(code[1].toString());
|
||||
// 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();
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected CharSequence[] getContents(int sections) throws IOException {
|
||||
CTestPlugin plugin = CTestPlugin.getDefault();
|
||||
if (plugin == null)
|
||||
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 {
|
||||
final StringBuffer[] contents = getContents(3);
|
||||
final CharSequence[] contents = getContents(3);
|
||||
final String code= contents[0].toString();
|
||||
final String end= contents[2].toString();
|
||||
parseAndCheckBindings(code + end, ParserLanguage.CPP);
|
||||
|
|
|
@ -145,7 +145,7 @@ public class AST2FileBasePluginTest extends TestCase {
|
|||
return file;
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||
}
|
||||
|
|
|
@ -4039,7 +4039,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// ASSERT(false);// fine
|
||||
// }
|
||||
public void testBug188855_gccExtensionForVariadicMacros() throws Exception {
|
||||
StringBuffer[] buffer = getContents(2);
|
||||
CharSequence[] buffer = getContents(2);
|
||||
final String content1 = buffer[0].toString();
|
||||
final String content2 = buffer[1].toString();
|
||||
parse(content1, ParserLanguage.CPP);
|
||||
|
@ -4843,7 +4843,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// return 0;
|
||||
// }
|
||||
public void testBug228422_noKnrParam() throws Exception {
|
||||
StringBuffer buffer = getContents(1)[0];
|
||||
CharSequence buffer = getContents(1)[0];
|
||||
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)(a)-a // typeof a,a,cast,a,-
|
||||
public void testBinaryVsCastAmbiguities_Bug237057() throws Exception {
|
||||
StringBuffer[] input= getContents(2);
|
||||
CharSequence[] input= getContents(2);
|
||||
String code= input[0].toString();
|
||||
String[] samples= input[1].toString().split("\n");
|
||||
for (ParserLanguage lang : ParserLanguage.values()) {
|
||||
|
@ -5302,7 +5302,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// (f)(a)+1 // f,a,(),1,+
|
||||
// (t)(t)+1 // t,t,1,unary+,cast,cast
|
||||
public void testCastVsFunctionCallAmbiguities_Bug237057() throws Exception {
|
||||
StringBuffer[] input= getContents(2);
|
||||
CharSequence[] input= getContents(2);
|
||||
String code= input[0].toString();
|
||||
String[] samples= input[1].toString().split("\n");
|
||||
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,,
|
||||
// 1 ? 2 ? 3 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,?
|
||||
public void testBinaryExpressionBinding() throws Exception {
|
||||
StringBuffer[] input= getContents(2);
|
||||
CharSequence[] input= getContents(2);
|
||||
String code= input[0].toString();
|
||||
String[] samples= input[1].toString().split("\n");
|
||||
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 : 4 ? 5 : 6 : 7 // 1,2,3,4,5,6,?,?,7,?
|
||||
public void testConstantExpressionBinding() throws Exception {
|
||||
StringBuffer[] input= getContents(2);
|
||||
CharSequence[] input= getContents(2);
|
||||
String code= input[0].toString();
|
||||
String[] samples= input[1].toString().split("\n");
|
||||
for (ParserLanguage lang : ParserLanguage.values()) {
|
||||
|
@ -5859,7 +5859,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
public void testScalabilityOfLargeTrivialInitializer_Bug253690() throws Exception {
|
||||
sValidateCopy= false;
|
||||
final int AMOUNT= 250000;
|
||||
final StringBuffer[] input = getContents(3);
|
||||
final CharSequence[] input = getContents(3);
|
||||
StringBuilder buf= new StringBuilder();
|
||||
buf.append(input[0].toString());
|
||||
final String line= input[1].toString();
|
||||
|
@ -5892,7 +5892,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
public void testLargeTrivialAggregateInitializer_Bug253690() throws Exception {
|
||||
sValidateCopy= false;
|
||||
final int AMOUNT= 250000;
|
||||
final StringBuffer[] input = getContents(3);
|
||||
final CharSequence[] input = getContents(3);
|
||||
StringBuilder buf= new StringBuilder();
|
||||
buf.append(input[0].toString());
|
||||
final String line= input[1].toString();
|
||||
|
|
|
@ -201,7 +201,7 @@ public class CommentTests extends AST2BaseTest {
|
|||
// // comment2
|
||||
// #endif
|
||||
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);
|
||||
IASTComment[] comments = tu.getComments();
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class CommentTests extends AST2BaseTest {
|
|||
|
||||
// //comment
|
||||
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);
|
||||
IASTComment[] comments = tu.getComments();
|
||||
|
||||
|
@ -236,7 +236,7 @@ public class CommentTests extends AST2BaseTest {
|
|||
// // TODO: shows up in task list
|
||||
|
||||
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);
|
||||
IASTComment[] comments = tu.getComments();
|
||||
|
||||
|
@ -246,7 +246,7 @@ public class CommentTests extends AST2BaseTest {
|
|||
for (IASTComment comment : comments) {
|
||||
IASTFileLocation loc= comment.getFileLocation();
|
||||
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
|
||||
// #endif
|
||||
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);
|
||||
IASTPreprocessorStatement[] st = tu.getAllPreprocessorStatements();
|
||||
assertEquals(3, st.length);
|
||||
|
|
|
@ -371,4 +371,11 @@ public class BasicCompletionTest extends CompletionTestBase {
|
|||
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();
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||
CTestPlugin plugin = CTestPlugin.getDefault();
|
||||
if (plugin == null)
|
||||
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 {
|
||||
StringBuffer[] bufs= TestSourceReader.getContentsForTest(
|
||||
CharSequence[] bufs= TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), steps+2);
|
||||
String[] input= new String[steps+2];
|
||||
int i= -1;
|
||||
for (StringBuffer buf : bufs) {
|
||||
for (CharSequence buf : bufs) {
|
||||
input[++i]= buf.toString().trim();
|
||||
}
|
||||
final MacroExpander expander= createExpander(input[0]);
|
||||
|
|
|
@ -113,7 +113,7 @@ public class LocationMapTests extends BaseTestCase {
|
|||
super.tearDown();
|
||||
}
|
||||
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected StringBuilder[] getContents(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||
}
|
||||
|
|
|
@ -95,10 +95,9 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
|
|||
initializeScanner(getAboveComment());
|
||||
}
|
||||
|
||||
protected StringBuffer[] getTestContent(int sections) throws IOException {
|
||||
StringBuffer[] input= TestSourceReader.getContentsForTest(
|
||||
protected StringBuilder[] getTestContent(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||
return input;
|
||||
}
|
||||
|
||||
protected String getAboveComment() throws IOException {
|
||||
|
@ -110,8 +109,7 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
|
|||
for(;;) {
|
||||
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 tearDown() throws Exception;
|
||||
public IASTTranslationUnit getAst();
|
||||
public StringBuffer[] getTestData();
|
||||
public StringBuilder[] getTestData();
|
||||
public ICProject getCProject();
|
||||
public boolean isCompositeIndex();
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
class SinglePDOMTestFirstASTStrategy implements ITestStrategy {
|
||||
private IIndex index;
|
||||
private ICProject cproject;
|
||||
private StringBuffer[] testData;
|
||||
private StringBuilder[] testData;
|
||||
private IASTTranslationUnit ast;
|
||||
private boolean cpp;
|
||||
|
||||
|
@ -254,7 +254,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
return cproject;
|
||||
}
|
||||
|
||||
public StringBuffer[] getTestData() {
|
||||
public StringBuilder[] getTestData() {
|
||||
return testData;
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
class SinglePDOMTestStrategy implements ITestStrategy {
|
||||
private IIndex index;
|
||||
private ICProject cproject;
|
||||
private StringBuffer[] testData;
|
||||
private StringBuilder[] testData;
|
||||
private IASTTranslationUnit ast;
|
||||
private boolean cpp;
|
||||
|
||||
|
@ -320,7 +320,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
return cproject;
|
||||
}
|
||||
|
||||
public StringBuffer[] getTestData() {
|
||||
public StringBuilder[] getTestData() {
|
||||
return testData;
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
class ReferencedProject implements ITestStrategy {
|
||||
private IIndex index;
|
||||
private ICProject cproject, referenced;
|
||||
private StringBuffer[] testData;
|
||||
private StringBuilder[] testData;
|
||||
private IASTTranslationUnit ast;
|
||||
private boolean cpp;
|
||||
|
||||
|
@ -453,7 +453,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
return index;
|
||||
}
|
||||
|
||||
public StringBuffer[] getTestData() {
|
||||
public StringBuilder[] getTestData() {
|
||||
return testData;
|
||||
}
|
||||
|
||||
|
|
|
@ -275,11 +275,11 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
}
|
||||
|
||||
protected String[] getContentsForTest(int blocks) throws IOException {
|
||||
StringBuffer[] help= TestSourceReader.getContentsForTest(
|
||||
CharSequence[] help= TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
||||
String[] result= new String[help.length];
|
||||
int i= 0;
|
||||
for (StringBuffer buf : help) {
|
||||
for (CharSequence buf : help) {
|
||||
result[i++]= buf.toString();
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -63,7 +63,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
|||
|
||||
IIndex index;
|
||||
|
||||
protected StringBuffer[] getContentsForTest(int blocks) throws IOException {
|
||||
protected StringBuilder[] getContentsForTest(int blocks) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
|||
|
||||
// class B {};
|
||||
public void testPairDisjointContent() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(2);
|
||||
CharSequence[] contents = getContentsForTest(2);
|
||||
List projects = new ArrayList();
|
||||
|
||||
try {
|
||||
|
@ -117,7 +117,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
|||
// void foo(X::B2 c) {}
|
||||
// namespace X { class A2 {}; B2 b; C2 c; }
|
||||
public void testTripleLinear() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(3);
|
||||
CharSequence[] contents = getContentsForTest(3);
|
||||
List projects = new ArrayList();
|
||||
|
||||
try {
|
||||
|
@ -224,7 +224,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
|||
// namespace X { class A2 {}; }
|
||||
// B1 ab;
|
||||
public void testTripleUpwardV() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(3);
|
||||
CharSequence[] contents = getContentsForTest(3);
|
||||
List projects = new ArrayList();
|
||||
|
||||
|
||||
|
@ -313,7 +313,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
|||
// void foo(A1 a, A1 b) {}
|
||||
// namespace X { class A2 {}; }
|
||||
public void testTripleDownwardV() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(3);
|
||||
CharSequence[] contents = getContentsForTest(3);
|
||||
List projects = new ArrayList();
|
||||
|
||||
try {
|
||||
|
@ -450,7 +450,7 @@ class ProjectBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
ProjectBuilder addFile(String relativePath, StringBuffer content) {
|
||||
ProjectBuilder addFile(String relativePath, CharSequence content) {
|
||||
path2content.put(relativePath, content.toString());
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
// #include "header1.h"
|
||||
// #include "header2.h"
|
||||
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 h2= TestSourceReader.createFile(fProject.getProject(), "header2.h", sources[1].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 {
|
||||
waitForIndexer();
|
||||
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 s1= TestSourceReader.createFile(fProject.getProject(), "s20070427.cpp",
|
||||
source[0].toString() + "\nint a20070427;");
|
||||
|
|
|
@ -90,7 +90,7 @@ public class IndexLocationTest extends BaseTestCase {
|
|||
|
||||
try {
|
||||
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());
|
||||
createExternalFile(externalHeader, testData[1].toString());
|
||||
|
|
|
@ -59,7 +59,7 @@ public class IndexTestBase extends BaseTestCase {
|
|||
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(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
private ICProject fCppProject= null;
|
||||
private ICProject fCProject= null;
|
||||
private IIndex fIndex= null;
|
||||
private StringBuffer[] fContents;
|
||||
private CharSequence[] fContents;
|
||||
private IFile fFile;
|
||||
private IFile fHeader;
|
||||
private int fContentUsed;
|
||||
|
|
|
@ -59,9 +59,9 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
}
|
||||
|
||||
protected void setUpSections(int sections) throws Exception {
|
||||
StringBuffer[] contents= TestSourceReader.getContentsForTest(
|
||||
CharSequence[] contents= TestSourceReader.getContentsForTest(
|
||||
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());
|
||||
}
|
||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||
|
@ -76,7 +76,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
if(pdom!=null) {
|
||||
if(pdom != null) {
|
||||
pdom.releaseReadLock();
|
||||
}
|
||||
pdom= null;
|
||||
|
|
|
@ -43,9 +43,9 @@ public class CPPFunctionTemplateTests extends PDOMTestBase {
|
|||
}
|
||||
|
||||
protected void setUpSections(int sections) throws Exception {
|
||||
StringBuffer[] contents= TestSourceReader.getContentsForTest(
|
||||
StringBuilder[] contents= TestSourceReader.getContentsForTest(
|
||||
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());
|
||||
}
|
||||
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 {
|
||||
cproject= CProjectHelper.createCProject("PDOMCBugsTest"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
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());
|
||||
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);
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Symbian - Initial implementation
|
||||
* Symbian - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.pdom.tests;
|
||||
|
||||
|
@ -28,7 +28,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* a lo-fidelity debugging tool)
|
||||
*/
|
||||
public class PDOMPrettyPrinter implements IPDOMVisitor {
|
||||
StringBuffer indent = new StringBuffer();
|
||||
StringBuilder indent = new StringBuilder();
|
||||
final String step = " "; //$NON-NLS-1$
|
||||
|
||||
public void leave(IPDOMNode node) throws CoreException {
|
||||
|
|
|
@ -57,18 +57,19 @@ import org.osgi.framework.Bundle;
|
|||
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.
|
||||
* @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 clazz the name of the class containing the test
|
||||
* @param testName the name of the test
|
||||
* @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.
|
||||
* @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('.', '/');
|
||||
fqn = fqn.indexOf("$")==-1 ? fqn : fqn.substring(0,fqn.indexOf("$"));
|
||||
String classFile = fqn + ".java";
|
||||
|
@ -91,7 +92,7 @@ public class TestSourceReader {
|
|||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
|
||||
List contents = new ArrayList();
|
||||
StringBuffer content = new StringBuffer();
|
||||
StringBuilder content = new StringBuilder();
|
||||
for(String line = br.readLine(); line!=null; line = br.readLine()) {
|
||||
line = line.replaceFirst("^\\s*", ""); // replace leading whitespace, preserve trailing
|
||||
if(line.startsWith("//")) {
|
||||
|
@ -101,11 +102,11 @@ public class TestSourceReader {
|
|||
contents.add(content);
|
||||
if(contents.size()==sections+1)
|
||||
contents.remove(0);
|
||||
content = new StringBuffer();
|
||||
content = new StringBuilder();
|
||||
}
|
||||
int idx= line.indexOf(testName);
|
||||
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 {
|
||||
int c= 0;
|
||||
int offset= 0;
|
||||
StringBuffer buf= new StringBuffer();
|
||||
StringBuilder buf= new StringBuilder();
|
||||
while ((c = reader.read()) >= 0) {
|
||||
buf.append((char) c);
|
||||
if (c == '\n') {
|
||||
|
@ -182,7 +183,7 @@ public class TestSourceReader {
|
|||
InputStream in= FileLocator.openStream(bundle, filePath, false);
|
||||
LineNumberReader reader= new LineNumberReader(new InputStreamReader(in));
|
||||
boolean found= false;
|
||||
final StringBuffer content= new StringBuffer();
|
||||
final StringBuilder content= new StringBuilder();
|
||||
try {
|
||||
String line= reader.readLine();
|
||||
while (line != null) {
|
||||
|
@ -222,7 +223,6 @@ public class TestSourceReader {
|
|||
* @param contents the content for the file
|
||||
* @return a file object.
|
||||
* @throws CoreException
|
||||
* @throws Exception
|
||||
* @since 4.0
|
||||
*/
|
||||
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 filePath the path relative to the container to create the file at
|
||||
* @param contents the content for the file
|
||||
* @return
|
||||
* @return a file object.
|
||||
* @throws Exception
|
||||
* @throws Exception
|
||||
* @since 4.0
|
||||
*/
|
||||
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.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
|
@ -573,7 +573,14 @@ public class LanguageManager {
|
|||
IProject project = file.getProject();
|
||||
|
||||
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) {
|
||||
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.internal.core.dom.parser.ASTQueries;
|
||||
|
||||
|
||||
/**
|
||||
* This is a utility class to help convert AST elements to Strings.
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.ASTTypeUtil
|
||||
*/
|
||||
|
||||
public class ASTStringUtil {
|
||||
private static final String 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>
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
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.ICSettingEntry;
|
||||
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.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
|
@ -243,10 +245,11 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
|||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
IResource rc = root.findMember(path);
|
||||
if(rc != null){
|
||||
path = rc.getLocation();
|
||||
path = new Path(EFSExtensionManager.getDefault().getPathFromURI(rc.getLocationURI()));
|
||||
}
|
||||
} 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)
|
||||
path = projLocation.append(path);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Doug Schaefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Doug Schaefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
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.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IASTPreprocessorMacroDefinition extends
|
||||
IASTPreprocessorStatement, IASTNameOwner {
|
||||
|
||||
public interface IASTPreprocessorMacroDefinition extends IASTPreprocessorStatement, IASTNameOwner {
|
||||
/**
|
||||
* <code>MACRO_NAME</code> describes the relationship between a macro
|
||||
* definition and it's name.
|
||||
|
@ -44,7 +42,6 @@ public interface IASTPreprocessorMacroDefinition extends
|
|||
*/
|
||||
public IASTFileLocation getExpansionLocation();
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this macro definition occurs in active code.
|
||||
* @since 5.1
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
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
|
||||
* descriptions of modifications to nodes and translates these descriptions into text edits that can then be
|
||||
* applied to the original source. This is all done without actually modifying the original AST. The rewrite
|
||||
* infrastructure tries to generate minimal text changes, preserve existing comments and indentation, and
|
||||
* follow code formatter settings. A {@link IASTComment} can be removed from or added to a node.
|
||||
* descriptions of modifications to nodes and translates these descriptions into text edits that can
|
||||
* then be applied to the original source. This is all done without actually modifying the original
|
||||
* AST. The rewrite infrastructure tries to generate minimal text changes, preserve existing
|
||||
* comments and indentation, and follow code formatter settings. A {@link IASTComment} can be
|
||||
* removed from or added to a node.
|
||||
* <p>
|
||||
* The initial implementation does not support nodes that implement {@link IASTPreprocessorStatement} or
|
||||
* {@link IASTProblem}.
|
||||
* The initial implementation does not support nodes that implement
|
||||
* {@link IASTPreprocessorStatement} or {@link IASTProblem}.
|
||||
* <p>
|
||||
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part of a work in progress. There
|
||||
* is no guarantee that this API will work or that it will remain the same. Please do not use this API without
|
||||
* consulting with the CDT team.
|
||||
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part of a work in
|
||||
* progress. There is no guarantee that this API will work or that it will remain the same.
|
||||
* Please do not use this API without consulting with the CDT team.
|
||||
* </p>
|
||||
*
|
||||
* @since 5.0
|
||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
*/
|
||||
public final class ASTRewrite {
|
||||
|
||||
/**
|
||||
* Defines the positions of the comment.
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public enum CommentPosition{
|
||||
|
||||
public enum CommentPosition {
|
||||
/**
|
||||
* Comments before a statement, declaration, or definition
|
||||
*/
|
||||
|
@ -63,8 +62,8 @@ public final class ASTRewrite {
|
|||
*/
|
||||
trailing,
|
||||
/**
|
||||
* Comments before a closing brace such as they occur in namespace-, class- and method-definitions or
|
||||
* at the end of a file
|
||||
* Comments before a closing brace such as they occur in namespace-, class- and
|
||||
* method-definitions or at the end of a file
|
||||
*/
|
||||
freestanding
|
||||
}
|
||||
|
@ -82,13 +81,14 @@ public final class ASTRewrite {
|
|||
private final ASTModification fParentMod;
|
||||
private final NodeCommentMap fCommentMap;
|
||||
|
||||
private enum Operation{
|
||||
private enum Operation {
|
||||
insertBefore,
|
||||
replace,
|
||||
remove
|
||||
}
|
||||
|
||||
private ASTRewrite(IASTNode root, ASTModificationStore modStore, ASTModification parentMod, NodeCommentMap commentMap) {
|
||||
private ASTRewrite(IASTNode root, ASTModificationStore modStore, ASTModification parentMod,
|
||||
NodeCommentMap commentMap) {
|
||||
fRoot= root;
|
||||
fModificationStore= modStore;
|
||||
fParentMod= parentMod;
|
||||
|
@ -115,9 +115,9 @@ public final class ASTRewrite {
|
|||
*
|
||||
* @param node the node being removed
|
||||
* @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
|
||||
* part of this rewriter's AST.
|
||||
* part of this rewriter's AST.
|
||||
*/
|
||||
public final void remove(IASTNode node, TextEditGroup editGroup) {
|
||||
checkBelongsToAST(node);
|
||||
|
@ -134,11 +134,11 @@ public final class ASTRewrite {
|
|||
*
|
||||
* @param node the node being replaced
|
||||
* @param replacement the node replacing the given one
|
||||
* @param editGroup the edit group in which to collect the corresponding
|
||||
* text edits, or <code>null</code>
|
||||
* @param editGroup the edit group in which to collect the corresponding text edits,
|
||||
* or <code>null</code>
|
||||
* @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
|
||||
* part of this rewriter's AST
|
||||
* @throws IllegalArgumentException if the node or the replacement is null, or if the node is
|
||||
* not part of this rewriter's AST
|
||||
*/
|
||||
public final ASTRewrite replace(IASTNode node, IASTNode replacement, TextEditGroup editGroup) {
|
||||
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
|
||||
* (newly created) node.
|
||||
* @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 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.
|
||||
* @throws IllegalArgumentException if the parent or the newNode is null, or if the parent is not
|
||||
* part of this rewriter's AST, or the insertionPoint is not a child of the parent.
|
||||
* @throws IllegalArgumentException if the parent or the newNode is null, or if the parent is
|
||||
* 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) {
|
||||
checkBelongsToAST(parent);
|
||||
}
|
||||
|
@ -180,8 +182,7 @@ public final class ASTRewrite {
|
|||
ASTModification mod;
|
||||
if (insertionPoint == null) {
|
||||
mod= new ASTModification(ModificationKind.APPEND_CHILD, parent, newNode, editGroup);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (insertionPoint.getParent() != parent) {
|
||||
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
|
||||
* refactoring framework.
|
||||
* Converts all modifications recorded by this rewriter into the change object required by
|
||||
* the refactoring framework.
|
||||
* <p>
|
||||
* 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,
|
||||
* 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>
|
||||
*
|
||||
* @return Change object describing the changes to the
|
||||
|
@ -223,7 +225,7 @@ public final class ASTRewrite {
|
|||
|
||||
private void checkSupportedNode(IASTNode node, Operation op) {
|
||||
if (node instanceof IASTComment) {
|
||||
if(op != Operation.remove) {
|
||||
if (op != Operation.remove) {
|
||||
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.
|
||||
*
|
||||
* @param node
|
||||
* @param comment
|
||||
* @param pos
|
||||
* @param node the node.
|
||||
* @param comment the comment to be attached to the node at the given position.
|
||||
* @param pos the position of the comment.
|
||||
* @since 5.3
|
||||
*/
|
||||
public void addComment(IASTNode node, IASTComment comment, CommentPosition pos) {
|
||||
|
@ -258,13 +259,10 @@ public final class ASTRewrite {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* @param node
|
||||
* the node
|
||||
* @param pos
|
||||
* the position
|
||||
* @param node the node
|
||||
* @param pos the position
|
||||
* @return All comments assigned to the node at this position
|
||||
* @since 5.3
|
||||
*/
|
||||
|
@ -276,7 +274,6 @@ public final class ASTRewrite {
|
|||
return fCommentMap.getTrailingCommentsForNode(node);
|
||||
case freestanding:
|
||||
return fCommentMap.getFreestandingCommentsForNode(node);
|
||||
|
||||
}
|
||||
return fCommentMap.getLeadingCommentsForNode(node);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.index;
|
||||
|
||||
|
@ -90,7 +90,7 @@ public interface IIndexFile {
|
|||
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;
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.index;
|
||||
|
||||
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.
|
||||
*/
|
||||
public interface IIndexMacro extends IMacroBinding, IIndexBinding {
|
||||
|
||||
IIndexMacro[] EMPTY_INDEX_MACRO_ARRAY = new IIndexMacro[0];
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,18 +6,17 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
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
|
||||
* you'll get the container as a result.
|
||||
* Represents a binding for all macros with the same name. When you try to adapt a macro binding
|
||||
* in an index you'll get the container as a result.
|
||||
* @since 5.0
|
||||
*
|
||||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IIndexMacroContainer extends IIndexBinding {
|
||||
|
||||
}
|
||||
|
|
|
@ -13,14 +13,16 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
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.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
|
||||
/**
|
||||
* Implementation of field designators
|
||||
*/
|
||||
public class CASTFieldDesignator extends ASTNode implements ICASTFieldDesignator {
|
||||
public class CASTFieldDesignator extends ASTNode implements ICASTFieldDesignator, IASTCompletionContext {
|
||||
|
||||
private IASTName name;
|
||||
|
||||
|
@ -74,4 +76,8 @@ public class CASTFieldDesignator extends ASTNode implements ICASTFieldDesignator
|
|||
|
||||
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) {
|
||||
final ICompositeType ct = (ICompositeType) type;
|
||||
if (type instanceof IIndexBinding) {
|
||||
type= ((CASTTranslationUnit) fieldReference.getTranslationUnit()).mapToASTType((ICompositeType) type);
|
||||
type= ((CASTTranslationUnit) fieldReference.getTranslationUnit()).mapToASTType(ct);
|
||||
}
|
||||
if (prefix) {
|
||||
IBinding[] result = null;
|
||||
char[] p = fieldReference.getFieldName().toCharArray();
|
||||
IContentAssistMatcher matcher = ContentAssistMatcherFactory.getInstance().createMatcher(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 findFieldsByPrefix(ct, p);
|
||||
}
|
||||
return ((ICompositeType) type).findField(fieldReference.getFieldName().toString());
|
||||
return ct.findField(fieldReference.getFieldName().toString());
|
||||
}
|
||||
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) {
|
||||
IScope scope = getContainingScope(expr);
|
||||
IBinding[] bs = scope.find(PTRDIFF_T);
|
||||
|
@ -1463,6 +1468,8 @@ public class CVisitor extends ASTQueries {
|
|||
|
||||
if (prop == IASTFieldReference.FIELD_NAME) {
|
||||
result = (IBinding[]) findBinding((IASTFieldReference) name.getParent(), isPrefix);
|
||||
} else if (prop == ICASTFieldDesignator.FIELD_NAME) {
|
||||
result = findBindingForContentAssist((ICASTFieldDesignator) name.getParent(), isPrefix);
|
||||
} else {
|
||||
IScope scope= getContainingScope(name);
|
||||
try {
|
||||
|
@ -1477,7 +1484,35 @@ public class CVisitor extends ASTQueries {
|
|||
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());
|
||||
|
||||
// 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.
|
||||
result.addClause(clause);
|
||||
} else {
|
||||
// Gnu extension: the assign operator is optional
|
||||
if (LT(1) == IToken.tASSIGN)
|
||||
consume(IToken.tASSIGN);
|
||||
|
||||
IASTInitializerClause clause= initClause(false);
|
||||
ICASTDesignatedInitializer desigInitializer = nodeFactory.newDesignatedInitializer(clause);
|
||||
ICASTDesignatedInitializer desigInitializer = nodeFactory.newDesignatedInitializer((IASTInitializerClause) null);
|
||||
setRange(desigInitializer, designator.get(0));
|
||||
adjustLength(desigInitializer, clause);
|
||||
|
||||
for (ICASTDesignator d : designator) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* in separate modification maps. I.e. a modification map represents one level of
|
||||
* modifications.
|
||||
|
@ -28,51 +28,51 @@ import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKin
|
|||
* @since 5.0
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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);
|
||||
if (mods == null || mods.isEmpty()) {
|
||||
mods= new ArrayList<ASTModification>();
|
||||
mods.add(mod);
|
||||
fModifications.put(targetNode, mods);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
switch (mod.getKind()) {
|
||||
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$
|
||||
}
|
||||
mods.add(mod);
|
||||
break;
|
||||
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$
|
||||
}
|
||||
mods.add(mod);
|
||||
break;
|
||||
case INSERT_BEFORE:
|
||||
int i;
|
||||
for (i=mods.size()-1; i>=0; i--) {
|
||||
for (i= mods.size(); --i >= 0;) {
|
||||
if (mods.get(i).getKind() == ModificationKind.INSERT_BEFORE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
mods.add(i+1, mod);
|
||||
mods.add(i + 1, mod);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of modifications for a given node. The list can contain different modifications.
|
||||
* It is guaranteed that INSERT_BEFORE modifications appear first. Furthermore, if there is a
|
||||
* REPLACE modification the list will not contain any other REPLACE or APPEND_CHILD modifications.
|
||||
* Returns the list of modifications for a given node. The list can contain different
|
||||
* modifications. It is guaranteed that INSERT_BEFORE modifications appear first. Furthermore,
|
||||
* 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.
|
||||
*/
|
||||
public List<ASTModification> getModificationsForNode(IASTNode node) {
|
||||
|
|
|
@ -195,8 +195,9 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
|
||||
createChange(synthNode, synthSource);
|
||||
|
||||
int newOffset = synthNode.getFileLocation().getNodeOffset() + synthNode.getFileLocation().getNodeLength();
|
||||
sourceOffsets.put(synthNode.getFileLocation().getFileName(), Integer.valueOf(newOffset));
|
||||
IASTFileLocation fileLocation = synthNode.getFileLocation();
|
||||
int newOffset = fileLocation.getNodeOffset() + fileLocation.getNodeLength();
|
||||
sourceOffsets.put(fileLocation.getFileName(), Integer.valueOf(newOffset));
|
||||
}
|
||||
|
||||
private void synthTreatment(IASTTranslationUnit synthTU) {
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
* IBM Corporation
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
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) {
|
||||
if(defaultEncoding.equals(encoding)){
|
||||
return;
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
* IBM - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
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 int tDEFINED= IToken.FIRST_RESERVED_PREPROCESSOR;
|
||||
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 tSPACE= IToken.FIRST_RESERVED_PREPROCESSOR+3;
|
||||
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 tEXPANDED_IDENTIFIER= IToken.FIRST_RESERVED_PREPROCESSOR + 1;
|
||||
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 tNOSPACE= IToken.FIRST_RESERVED_PREPROCESSOR + 4;
|
||||
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_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 __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_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 __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>() {
|
||||
public IncludeResolution checkFile(String path, boolean isHeuristicMatch, IncludeSearchPathElement onPath) {
|
||||
if (fFileContentProvider.getInclusionExists(path)) {
|
||||
|
@ -123,9 +128,11 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
|
||||
private final class TokenSequence implements ITokenSequence {
|
||||
private final boolean fStopAtNewline;
|
||||
|
||||
TokenSequence(boolean stopAtNewline) {
|
||||
fStopAtNewline= stopAtNewline;
|
||||
}
|
||||
|
||||
public Token nextToken() throws OffsetLimitReachedException {
|
||||
final Lexer lexer= fCurrentContext.getLexer();
|
||||
Token t= lexer.nextToken();
|
||||
|
@ -138,9 +145,11 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
|
||||
return t;
|
||||
}
|
||||
|
||||
public int getLastEndOffset() {
|
||||
return fCurrentContext.getLexer().getLastEndOffset();
|
||||
}
|
||||
|
||||
public Token currentToken() {
|
||||
Token t= fCurrentContext.currentLexerToken();
|
||||
if (fStopAtNewline && t.getType() == Lexer.tNEWLINE)
|
||||
|
@ -149,6 +158,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
TokenSequence fInputToMacroExpansion= new TokenSequence(false);
|
||||
TokenSequence fLineInputToMacroExpansion= new TokenSequence(true);
|
||||
|
||||
|
@ -191,9 +201,9 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
|
||||
private InternalFileContent fRootContent;
|
||||
|
||||
|
||||
public CPreprocessor(FileContent fileContent, IScannerInfo info, ParserLanguage language, IParserLogService log,
|
||||
IScannerExtensionConfiguration configuration, IncludeFileContentProvider readerFactory) {
|
||||
public CPreprocessor(FileContent fileContent, IScannerInfo info, ParserLanguage language,
|
||||
IParserLogService log, IScannerExtensionConfiguration configuration,
|
||||
IncludeFileContentProvider readerFactory) {
|
||||
if (readerFactory instanceof InternalFileContentProvider) {
|
||||
fFileContentProvider= (InternalFileContentProvider) readerFactory;
|
||||
} else if (readerFactory == null) {
|
||||
|
@ -320,7 +330,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
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
|
||||
fMacroDictionary.put(__CDT_PARSER__.getNameCharArray(), __CDT_PARSER__);
|
||||
fMacroDictionary.put(__STDC__.getNameCharArray(), __STDC__);
|
||||
|
@ -530,7 +541,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
Token t4= fetchToken();
|
||||
end= t4.getEndOffset();
|
||||
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;
|
||||
} else {
|
||||
end= t3.getEndOffset();
|
||||
|
@ -549,7 +561,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
end= t1.getEndOffset();
|
||||
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:
|
||||
StringType st = StringType.fromToken(tt1);
|
||||
Token t2;
|
||||
StringBuffer buf= null;
|
||||
StringBuilder buf= null;
|
||||
int endOffset= 0;
|
||||
loop: while (true) {
|
||||
t2= fetchToken();
|
||||
|
@ -603,7 +616,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
case IToken.tUTF32STRING:
|
||||
st = StringType.max(st, StringType.fromToken(tt2));
|
||||
if (buf == null) {
|
||||
buf= new StringBuffer();
|
||||
buf= new StringBuilder();
|
||||
appendStringContent(buf, t1);
|
||||
}
|
||||
appendStringContent(buf, t2);
|
||||
|
@ -671,7 +684,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
return fCurrentContext.getCodeBranchNesting();
|
||||
}
|
||||
|
||||
private void appendStringContent(StringBuffer buf, Token t1) {
|
||||
private void appendStringContent(StringBuilder buf, Token t1) {
|
||||
final char[] image= t1.getCharImage();
|
||||
final int length= image.length;
|
||||
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();
|
||||
while (true) {
|
||||
switch (ppToken.getType()) {
|
||||
|
@ -890,7 +904,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
continue loop;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<fAdditionalNumericLiteralSuffixes.length; i++) {
|
||||
for (int i= 0; i < fAdditionalNumericLiteralSuffixes.length; i++) {
|
||||
if (fAdditionalNumericLiteralSuffixes[i] == c) {
|
||||
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
|
||||
final File currentDir= new File(currentFile).getParentFile();
|
||||
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);
|
||||
if (reader != null) {
|
||||
return reader;
|
||||
|
@ -994,7 +1009,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
|
||||
@Override
|
||||
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(" line: "); //$NON-NLS-1$
|
||||
buffer.append(fLocationMap.getCurrentLineNumber(fCurrentContext.currentLexerToken().getOffset()));
|
||||
|
@ -1008,7 +1023,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
// this is an undef
|
||||
fMacroDictionary.remove(macro.getNameCharArray());
|
||||
} else {
|
||||
PreprocessorMacro result= MacroDefinitionParser.parseMacroDefinition(macro.getNameCharArray(), macro.getParameterList(), expansionImage);
|
||||
PreprocessorMacro result= MacroDefinitionParser.parseMacroDefinition(
|
||||
macro.getNameCharArray(), macro.getParameterList(), expansionImage);
|
||||
final IASTFileLocation loc= macro.getFileLocation();
|
||||
fLocationMap.registerMacroFromIndex(result, loc, -1);
|
||||
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
|
||||
* @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();
|
||||
switch (ident.getType()) {
|
||||
case IToken.tCOMPLETION:
|
||||
|
@ -1067,10 +1084,12 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
switch (type) {
|
||||
case IPreprocessorDirective.ppImport:
|
||||
case IPreprocessorDirective.ppInclude:
|
||||
executeInclude(lexer, startOffset, false, fCurrentContext.getCodeState() == CodeState.eActive, withinExpansion);
|
||||
executeInclude(lexer, startOffset, false, fCurrentContext.getCodeState() == CodeState.eActive,
|
||||
withinExpansion);
|
||||
break;
|
||||
case IPreprocessorDirective.ppInclude_next:
|
||||
executeInclude(lexer, startOffset, true, fCurrentContext.getCodeState() == CodeState.eActive, withinExpansion);
|
||||
executeInclude(lexer, startOffset, true, fCurrentContext.getCodeState() == CodeState.eActive,
|
||||
withinExpansion);
|
||||
break;
|
||||
case IPreprocessorDirective.ppDefine:
|
||||
CodeState state= fCurrentContext.getCodeState();
|
||||
|
@ -1149,7 +1168,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
default:
|
||||
int endOffset= lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||
if (fCurrentContext.getCodeState() == CodeState.eActive) {
|
||||
handleProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE, ident.getCharImage(), startOffset, endOffset);
|
||||
handleProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE, ident.getCharImage(),
|
||||
startOffset, endOffset);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1163,7 +1183,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
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) {
|
||||
final char[] name= lexer.currentToken().getCharImage();
|
||||
final int endOffset = lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||
|
@ -1207,7 +1228,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
case IToken.tLT:
|
||||
userInclude= false;
|
||||
boolean complete= false;
|
||||
StringBuffer buf= new StringBuffer();
|
||||
StringBuilder buf= new StringBuilder();
|
||||
t= (Token) t.getNext();
|
||||
while (t != null) {
|
||||
if (t.getType() == IToken.tGT) {
|
||||
|
@ -1229,6 +1250,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
condEndOffset= lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (headerName == null || headerName.length == 0) {
|
||||
if (active) {
|
||||
handleProblem(IProblem.PREPROCESSOR_INVALID_DIRECTIVE,
|
||||
|
@ -1267,8 +1289,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
fAllIncludedFiles.add(path);
|
||||
ILocationCtx ctx= fLocationMap.pushInclusion(poundOffset, nameOffsets[0], nameOffsets[1],
|
||||
condEndOffset, source, path, headerName, userInclude, isHeuristic, fi.isSource());
|
||||
ScannerContext fctx= new ScannerContext(ctx, fCurrentContext, new Lexer(source,
|
||||
fLexOptions, this, this));
|
||||
ScannerContext fctx= new ScannerContext(ctx, fCurrentContext,
|
||||
new Lexer(source, fLexOptions, this, this));
|
||||
fctx.setFoundOnPath(fi.getFoundOnPath(), includeDirective);
|
||||
fCurrentContext= fctx;
|
||||
}
|
||||
|
@ -1292,7 +1314,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
int start= 0;
|
||||
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 {
|
||||
ObjectStyleMacro macrodef = fMacroDefinitionParser.parseMacroDefinition(lexer, this);
|
||||
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 int tt= name.getType();
|
||||
if (tt != IToken.tIDENTIFIER) {
|
||||
|
@ -1357,7 +1383,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
throw new OffsetLimitReachedException(ORIGIN_PREPROCESSOR_DIRECTIVE, name);
|
||||
}
|
||||
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;
|
||||
}
|
||||
lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||
|
@ -1369,10 +1396,12 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
} else {
|
||||
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();
|
||||
lexer.consumeLine(ORIGIN_PREPROCESSOR_DIRECTIVE);
|
||||
final int tt= name.getType();
|
||||
|
@ -1413,7 +1442,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
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);
|
||||
if (cond == null) {
|
||||
char[] name= lexer.currentToken().getCharImage();
|
||||
|
@ -1476,7 +1506,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
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 Conditional cond= fCurrentContext.newBranch(BranchKind.eEnd, withinExpansion);
|
||||
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.
|
||||
* 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;
|
||||
scannerCtx.clearInactiveCodeMarkerToken();
|
||||
int options= STOP_AT_NL;
|
||||
|
@ -1530,14 +1562,16 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
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;
|
||||
while (state == CodeState.eSkipInactive) {
|
||||
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) {
|
||||
final Token pound = lexer.nextDirective();
|
||||
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
|
||||
* 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();
|
||||
PreprocessorMacro macro= fMacroDictionary.get(name);
|
||||
if (macro == null) {
|
||||
|
@ -1625,13 +1660,15 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
final ITokenSequence input= stopAtNewline ? fLineInputToMacroExpansion : fInputToMacroExpansion;
|
||||
final MacroExpander expander = withinExpansion ? new MacroExpander(this, fMacroDictionary,
|
||||
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 ImageLocationInfo[] ili= expander.clearImageLocationInfos();
|
||||
final Token last= replacement.last();
|
||||
final int length= last == null ? 0 : last.getEndOffset();
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
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
|
||||
*/
|
||||
public abstract class InternalFileContentProvider extends IncludeFileContentProvider {
|
||||
|
||||
private IIncludeFileResolutionHeuristics fIncludeResolutionHeuristics;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||
|
||||
|
@ -22,14 +22,17 @@ import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
|
|||
final class ScannerContext {
|
||||
enum BranchKind {eIf, eElif, eElse, eEnd}
|
||||
enum CodeState {eActive, eParseInactive, eSkipInactive}
|
||||
|
||||
final static class Conditional {
|
||||
private final CodeState fInitialState;
|
||||
private BranchKind fLast;
|
||||
private boolean fTakeElse= true;
|
||||
|
||||
Conditional(CodeState state) {
|
||||
fInitialState= state;
|
||||
fLast= BranchKind.eIf;
|
||||
}
|
||||
|
||||
boolean canHaveActiveBranch(boolean withinExpansion) {
|
||||
return fTakeElse && isActive(withinExpansion);
|
||||
}
|
||||
|
@ -174,12 +177,12 @@ final class ScannerContext {
|
|||
private int getOldNestingLevel(BranchKind kind, int nesting) {
|
||||
switch (kind) {
|
||||
case eIf:
|
||||
return nesting-1;
|
||||
return nesting - 1;
|
||||
case eElif:
|
||||
case eElse:
|
||||
return nesting;
|
||||
case eEnd:
|
||||
return nesting+1;
|
||||
return nesting + 1;
|
||||
}
|
||||
return nesting;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Doug Schaefer
|
||||
*/
|
||||
public class LongString implements IString {
|
||||
|
||||
private final Database db;
|
||||
private final long record;
|
||||
private int hash;
|
||||
|
@ -370,7 +369,7 @@ public class LongString implements IString {
|
|||
|
||||
public String getString() throws CoreException {
|
||||
int length = db.getInt(record + LENGTH);
|
||||
final StringBuffer buffer = new StringBuffer(length);
|
||||
final StringBuilder buffer = new StringBuilder(length);
|
||||
readChars(length, new IReader() {
|
||||
public void appendChar(char c) {
|
||||
buffer.append(c);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.pdom.db;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
|
@ -22,7 +21,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Doug Schaefer
|
||||
*/
|
||||
public class ShortString implements IString {
|
||||
|
||||
private final Database db;
|
||||
private final long record;
|
||||
private int hash;
|
||||
|
@ -77,7 +75,7 @@ public class ShortString implements IString {
|
|||
Chunk chunk = db.getChunk(record);
|
||||
int length = chunk.getInt(record + LENGTH);
|
||||
char[] chars = new char[length];
|
||||
chunk.getCharArray(record+CHARS, chars);
|
||||
chunk.getCharArray(record + CHARS, chars);
|
||||
return chars;
|
||||
}
|
||||
|
||||
|
@ -185,7 +183,7 @@ public class ShortString implements IString {
|
|||
|
||||
while (i1 < n1 && i2 < n2) {
|
||||
int cmp= compareChars(chunk.getChar(i1), other[i2], caseSensitive);
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
i1 += 2;
|
||||
|
@ -220,7 +218,7 @@ public class ShortString implements IString {
|
|||
|
||||
while (i1 < n1 && i2 < n2) {
|
||||
int cmp= compareChars(chunk1.getChar(i1), chunk2.getChar(i2), caseSensitive);
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
i1 += 2;
|
||||
|
@ -245,7 +243,7 @@ public class ShortString implements IString {
|
|||
|
||||
while (i1 < n1 && i2 < n2) {
|
||||
int cmp= compareChars(chunk.getChar(i1), other.charAt(i2), caseSensitive);
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
i1 += 2;
|
||||
|
@ -260,7 +258,6 @@ public class ShortString implements IString {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public int compareCompatibleWithIgnoreCase(IString string) throws CoreException {
|
||||
if (string instanceof ShortString)
|
||||
return compareCompatibleWithIgnoreCase((ShortString)string);
|
||||
|
@ -270,7 +267,6 @@ public class ShortString implements IString {
|
|||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
|
||||
public int compareCompatibleWithIgnoreCase(ShortString other) throws CoreException {
|
||||
Chunk chunk1 = db.getChunk(record);
|
||||
Chunk chunk2 = other.db.getChunk(other.record);
|
||||
|
@ -285,7 +281,7 @@ public class ShortString implements IString {
|
|||
final char c2= chunk2.getChar(i2);
|
||||
if (c1 != c2) {
|
||||
int cmp= compareChars(c1, c2, false); // insensitive
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
if (sensitiveCmp == 0) {
|
||||
|
@ -323,7 +319,7 @@ public class ShortString implements IString {
|
|||
final char c2= chars[i2];
|
||||
if (c1 != c2) {
|
||||
int cmp= compareChars(c1, c2, false); // insensitive
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
if (sensitiveCmp == 0) {
|
||||
|
@ -358,7 +354,7 @@ public class ShortString implements IString {
|
|||
|
||||
while (i1 < n1 && i2 < n2) {
|
||||
int cmp= compareChars(chunk.getChar(i1), other[i2], caseSensitive);
|
||||
if(cmp!=0)
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
|
||||
i1 += 2;
|
||||
|
@ -372,7 +368,7 @@ public class ShortString implements IString {
|
|||
}
|
||||
|
||||
public char charAt(int i) throws CoreException {
|
||||
long ptr = record + CHARS + (i*2);
|
||||
long ptr = record + CHARS + (i * 2);
|
||||
return db.getChar(ptr);
|
||||
}
|
||||
|
||||
|
@ -395,7 +391,7 @@ public class ShortString implements IString {
|
|||
* </ul>
|
||||
*/
|
||||
public static int compareChars(char a, char b, boolean caseSensitive) {
|
||||
if(caseSensitive) {
|
||||
if (caseSensitive) {
|
||||
if (a < b)
|
||||
return -1;
|
||||
if (a > b)
|
||||
|
@ -417,7 +413,7 @@ public class ShortString implements IString {
|
|||
* benchmark first.
|
||||
*
|
||||
* public static int compareChars(char a, char b, boolean caseSensitive) {
|
||||
if(caseSensitive) {
|
||||
if (caseSensitive) {
|
||||
if (a < b)
|
||||
return -1;
|
||||
if (a > b)
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||
|
||||
|
@ -607,8 +607,8 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
if (nameOffset + name.getNodeLength() <= offset + length) {
|
||||
result.add(name);
|
||||
} else if (name.isReference()) {
|
||||
// names are ordered, but callers are inserted before
|
||||
// their references
|
||||
// Names are ordered, but callers are inserted before
|
||||
// their references.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -640,23 +640,22 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
return result.toArray(new IIndexName[result.size()]);
|
||||
}
|
||||
|
||||
public static PDOMFile findFile(PDOMLinkage linkage, BTree btree, IIndexFileLocation location, IIndexLocationConverter strategy)
|
||||
throws CoreException {
|
||||
public static PDOMFile findFile(PDOMLinkage linkage, BTree btree, IIndexFileLocation location,
|
||||
IIndexLocationConverter strategy) throws CoreException {
|
||||
String internalRepresentation= strategy.toInternalFormat(location);
|
||||
long record= 0;
|
||||
if (internalRepresentation != null) {
|
||||
Finder finder = new Finder(linkage.getDB(), internalRepresentation, linkage.getLinkageID());
|
||||
btree.accept(finder);
|
||||
record= finder.getRecord();
|
||||
}
|
||||
if (record != 0) {
|
||||
return new PDOMFile(linkage, record);
|
||||
long record= finder.getRecord();
|
||||
if (record != 0) {
|
||||
return new PDOMFile(linkage, record);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IIndexFragmentFile[] findFiles(PDOM pdom, BTree btree, IIndexFileLocation location, IIndexLocationConverter strategy)
|
||||
throws CoreException {
|
||||
public static IIndexFragmentFile[] findFiles(PDOM pdom, BTree btree, IIndexFileLocation location,
|
||||
IIndexLocationConverter strategy) throws CoreException {
|
||||
String internalRepresentation= strategy.toInternalFormat(location);
|
||||
if (internalRepresentation != null) {
|
||||
Finder finder = new Finder(pdom.getDB(), internalRepresentation, -1);
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||
|
||||
|
@ -138,7 +138,6 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation {
|
|||
if (nextName != null)
|
||||
nextName.setPrevInContainer(prevName);
|
||||
|
||||
|
||||
final IString expansion = getExpansionInDB();
|
||||
if (expansion != null) {
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* 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) {
|
||||
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);
|
||||
fMarkerGenerator.addMarker(problemMarkerInfo);
|
||||
if (severity == IMarkerGenerator.SEVERITY_ERROR_RESOURCE)
|
||||
if (problemMarkerInfo.severity == IMarkerGenerator.SEVERITY_ERROR_RESOURCE)
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,14 +7,27 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Norbert Ploett - Initial implementation
|
||||
* Sami Wagiaalla (Red Hat) - Bug 352166: Added attributes and type API
|
||||
* and improved documentation.
|
||||
*******************************************************************************/
|
||||
|
||||
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.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.
|
||||
*/
|
||||
public class ProblemMarkerInfo {
|
||||
|
@ -25,25 +38,98 @@ public class ProblemMarkerInfo {
|
|||
public int severity;
|
||||
public String variableName;
|
||||
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;
|
||||
this.lineNumber = lineNumber;
|
||||
this.description = desciption;
|
||||
this.severity = severity;
|
||||
this.variableName = variableName;
|
||||
this.externalPath = null ;
|
||||
}
|
||||
|
||||
|
||||
public ProblemMarkerInfo(IResource file, int lineNumber, String description, int severity, String variableName, IPath externalPath) {
|
||||
super();
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public ProblemMarkerInfo(IResource file, int lineNumber, String description, int severity, String variableName) {
|
||||
this.file = file;
|
||||
this.lineNumber = lineNumber;
|
||||
this.description = description;
|
||||
this.severity = severity;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
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.SEVERITY, mapMarkerSeverity(problemMarkerInfo.severity));
|
||||
marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber);
|
||||
|
@ -105,6 +110,14 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
|||
} else if (problemMarkerInfo.lineNumber==0){
|
||||
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) {
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -178,6 +178,10 @@ public class CCodeFormatter extends CodeFormatter {
|
|||
ParserUtil.getParserLogService());
|
||||
CodeFormatterVisitor codeFormatter = new CodeFormatterVisitor(preferences, offset, length);
|
||||
edit= codeFormatter.format(source, ast);
|
||||
IStatus status= codeFormatter.getStatus();
|
||||
if (!status.isOK()) {
|
||||
CCorePlugin.log(status);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
throw new AbortFormatting(e);
|
||||
}
|
||||
|
|
|
@ -1603,8 +1603,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
private int visit(IASTArrayDeclarator node) {
|
||||
IASTArrayModifier[] arrayModifiers= node.getArrayModifiers();
|
||||
if (arrayModifiers != null) {
|
||||
for (IASTArrayModifier arrayModifier2 : arrayModifiers) {
|
||||
IASTArrayModifier arrayModifier = arrayModifier2;
|
||||
for (IASTArrayModifier arrayModifier : arrayModifiers) {
|
||||
scribe.printNextToken(Token.tLBRACKET, preferences.insert_space_before_opening_bracket);
|
||||
boolean emptyBrackets= arrayModifier.getConstantExpression() == null
|
||||
&& !(arrayModifier instanceof ICASTArrayModifier);
|
||||
|
@ -1625,10 +1624,13 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
scribe.space();
|
||||
}
|
||||
}
|
||||
Runnable tailFormatter = scribe.takeTailFormatter();
|
||||
try {
|
||||
arrayModifier.accept(this);
|
||||
} catch (ASTProblemException e) {
|
||||
scribe.skipToToken(Token.tRBRACKET);
|
||||
} finally {
|
||||
scribe.setTailFormatter(tailFormatter);
|
||||
}
|
||||
boolean insertSpace= emptyBrackets ?
|
||||
preferences.insert_space_between_empty_brackets :
|
||||
|
@ -1772,7 +1774,9 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
|
||||
// Consider macro expansion
|
||||
if (withinMacroExpansion(node, scribe.scanner.getCurrentPosition())) {
|
||||
scribe.printNextToken(peekNextToken());
|
||||
continueNode(node);
|
||||
if (scribe.printComment()) scribe.space();
|
||||
}
|
||||
|
||||
switch (node.getKey()) {
|
||||
|
@ -1823,7 +1827,9 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
|
||||
// Consider macro expansion
|
||||
if (withinMacroExpansion(node, scribe.scanner.getCurrentPosition())) {
|
||||
scribe.printNextToken(peekNextToken());
|
||||
continueNode(node);
|
||||
if (scribe.printComment()) scribe.space();
|
||||
}
|
||||
|
||||
switch (node.getKey()) {
|
||||
|
@ -2078,7 +2084,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
int i;
|
||||
for (i = 0; i < elementsLength; i++) {
|
||||
final IASTNode node= elements.get(i);
|
||||
if (i < alignment.fragmentCount - 1) {
|
||||
if (i < elementsLength - 1) {
|
||||
scribe.setTailFormatter(
|
||||
new TrailingTokenFormatter(options.fSeparatorToken,
|
||||
options.fSpaceBeforeSeparator,
|
||||
|
@ -2093,7 +2099,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
} else {
|
||||
node.accept(this);
|
||||
}
|
||||
if (i < alignment.fragmentCount - 1) {
|
||||
if (i < elementsLength - 1) {
|
||||
scribe.runTailFormatter();
|
||||
}
|
||||
}
|
||||
|
@ -2366,7 +2372,12 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
if (preferences.insert_space_after_opening_paren_in_method_invocation) {
|
||||
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);
|
||||
break;
|
||||
default:
|
||||
|
@ -2595,7 +2606,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
return formatOverloadedLeftShiftChain(node);
|
||||
}
|
||||
|
||||
Runnable tailFormatter = scribe.takeTailFormatter();
|
||||
Runnable tailFormatter = endsWithMacroExpansion(node) ? null : scribe.takeTailFormatter();
|
||||
|
||||
Alignment expressionAlignment= scribe.createAlignment(
|
||||
Alignment.BINARY_EXPRESSION,
|
||||
|
@ -3132,11 +3143,18 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
formatLeftCurlyBrace(line, preferences.brace_position_for_block);
|
||||
if (startNode(body)) {
|
||||
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,
|
||||
preferences.brace_position_for_block,
|
||||
preferences.insert_space_before_opening_brace_in_block);
|
||||
ok = true;
|
||||
scribe.exitAlignment(alignment, true);
|
||||
if (braceOnSameLine) {
|
||||
ok = true;
|
||||
scribe.exitAlignment(alignment, true);
|
||||
}
|
||||
formatOpenedBlock((IASTCompoundStatement) body,
|
||||
preferences.brace_position_for_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);
|
||||
} else if (elseStatement instanceof IASTIfStatement) {
|
||||
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 ) {
|
||||
scribe.space();
|
||||
}
|
||||
if (operand != null) {
|
||||
operand.accept(this);
|
||||
Runnable tailFormatter = scribe.takeTailFormatter();
|
||||
try {
|
||||
if (operand != null) {
|
||||
operand.accept(this);
|
||||
}
|
||||
} finally {
|
||||
scribe.setTailFormatter(tailFormatter);
|
||||
}
|
||||
if (peekNextToken() != Token.tRPAREN) {
|
||||
if (!enclosedInMacroExpansion(operand)) {
|
||||
|
@ -3883,22 +3906,22 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
}
|
||||
|
||||
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();
|
||||
for (IASTNodeLocation location : locations) {
|
||||
if (location instanceof IASTMacroExpansionLocation) {
|
||||
IASTFileLocation fileLocation = location.asFileLocation();
|
||||
if (fileLocation != null) {
|
||||
final int nodeOffset = fileLocation.getNodeOffset();
|
||||
final int endOffset = nodeOffset + fileLocation.getNodeLength();
|
||||
if (offset >= nodeOffset && offset < endOffset) {
|
||||
return true;
|
||||
} else if (offset < nodeOffset) {
|
||||
return false;
|
||||
}
|
||||
IASTFileLocation fileLocation = location.asFileLocation();
|
||||
if (fileLocation != null) {
|
||||
final int nodeOffset = fileLocation.getNodeOffset();
|
||||
final int endOffset = nodeOffset + fileLocation.getNodeLength();
|
||||
if (offset >= nodeOffset && offset < endOffset) {
|
||||
return location instanceof IASTMacroExpansionLocation;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -800,7 +800,7 @@ public class SimpleScanner {
|
|||
private void getRestOfPreprocessorLine() {
|
||||
int c = getChar();
|
||||
while (true) {
|
||||
while ((c != '\n') && (c != '\r') && (c != '/') && (c != EOFCHAR)) {
|
||||
while ((c != '\n') && (c != '\r') && (c != '/') && (c != '"') && (c != EOFCHAR)) {
|
||||
c = getChar();
|
||||
}
|
||||
if (c == '/') {
|
||||
|
@ -823,6 +823,9 @@ public class SimpleScanner {
|
|||
c = next;
|
||||
continue;
|
||||
}
|
||||
} else if (c == '"') {
|
||||
matchStringLiteral();
|
||||
c = getChar();
|
||||
} else {
|
||||
ungetChar(c);
|
||||
break;
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.io.FileInputStream;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
|
@ -266,8 +265,6 @@ public class XmlUtil {
|
|||
if (!storeFile.exists()) {
|
||||
storeFile.createNewFile();
|
||||
}
|
||||
OutputStream fileStream = new FileOutputStream(storeFile);
|
||||
|
||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||
Transformer transformer = transformerFactory.newTransformer();
|
||||
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
|
||||
|
@ -279,7 +276,7 @@ public class XmlUtil {
|
|||
StreamResult result = new StreamResult(new FileOutputStream(storeFile));
|
||||
transformer.transform(source, result);
|
||||
|
||||
fileStream.close();
|
||||
result.getOutputStream().close();
|
||||
ResourcesUtil.refreshWorkspaceFiles(uriLocation);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,8 +101,9 @@ public class BaseUITestCase extends BaseTestCase {
|
|||
* Reads multiple sections in comments from the source of the given class.
|
||||
* @since 4.0
|
||||
*/
|
||||
public StringBuffer[] getContentsForTest(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", getClass(), getName(), sections);
|
||||
public StringBuilder[] getContentsForTest(int sections) throws IOException {
|
||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui",
|
||||
getClass(), getName(), sections);
|
||||
}
|
||||
|
||||
public String getAboveComment() throws IOException {
|
||||
|
|
|
@ -551,7 +551,7 @@ public class BasicCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// sf();
|
||||
// }
|
||||
public void testStaticFunctionsC() throws Exception {
|
||||
StringBuffer[] sbs= getContentsForTest(2);
|
||||
StringBuilder[] sbs= getContentsForTest(2);
|
||||
String content2= sbs[0].toString();
|
||||
String content1= content2 + sbs[1].toString();
|
||||
IFile file1= createFile(getProject(), "staticFunc1.c", content1);
|
||||
|
@ -620,7 +620,7 @@ public class BasicCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// sf();
|
||||
// }
|
||||
public void testStaticFunctionsCpp() throws Exception {
|
||||
StringBuffer[] sbs= getContentsForTest(2);
|
||||
StringBuilder[] sbs= getContentsForTest(2);
|
||||
String content2= sbs[0].toString();
|
||||
String content1= content2 + sbs[1].toString();
|
||||
IFile file1= createFile(getProject(), "staticFunc1.cpp", content1);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
|||
// n->inline_method(); // r3
|
||||
// }
|
||||
public void testMethods() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(2);
|
||||
StringBuilder[] content= getContentsForTest(2);
|
||||
String header= content[0].toString();
|
||||
String source = content[1].toString();
|
||||
IFile headerFile= createFile(fCProject.getProject(), "testMethods.h", header);
|
||||
|
@ -155,7 +155,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
|||
// method3();
|
||||
// }
|
||||
public void testMethodsInMultipleFiles() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
StringBuilder[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
@ -205,7 +205,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
|||
// method3();
|
||||
// }
|
||||
public void testMultipleImplsForMethod() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
StringBuilder[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
@ -266,7 +266,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
|||
// mc.method1();
|
||||
// }
|
||||
public void testReverseMultipleImplsForMethod() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
StringBuilder[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
|
|
@ -54,7 +54,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// field= 1;
|
||||
// }
|
||||
public void testCallHierarchyFromOutlineView_183941() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(2);
|
||||
StringBuilder[] contents = getContentsForTest(2);
|
||||
IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString());
|
||||
IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString());
|
||||
waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
|
@ -95,7 +95,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// ref2= 0;
|
||||
// }
|
||||
public void testCallHierarchyFromOutlineViewAmbiguous_183941() throws Exception {
|
||||
StringBuffer[] contents = getContentsForTest(2);
|
||||
StringBuilder[] contents = getContentsForTest(2);
|
||||
IFile file1= createFile(getProject(), "SomeClass.h", contents[0].toString());
|
||||
IFile file2= createFile(getProject(), "SomeClass.cpp", contents[1].toString());
|
||||
waitForIndexer(fIndex, file2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
|
@ -363,7 +363,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// shared_func();
|
||||
// }
|
||||
public void testMultiLanguageWithPrototype_260262() throws Exception {
|
||||
final StringBuffer[] contents = getContentsForTest(3);
|
||||
final StringBuilder[] contents = getContentsForTest(3);
|
||||
final String hcontent = contents[0].toString();
|
||||
final String content_inc = contents[1].toString();
|
||||
final String content_full = content_inc + contents[2].toString();
|
||||
|
@ -393,7 +393,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// shared_func();
|
||||
// }
|
||||
public void testMultiLanguageWithInlinedfunc_260262() throws Exception {
|
||||
final StringBuffer[] contents = getContentsForTest(3);
|
||||
final StringBuilder[] contents = getContentsForTest(3);
|
||||
final String hcontent = contents[0].toString();
|
||||
final String content_inc = contents[1].toString();
|
||||
final String content_full = content_inc + contents[2].toString();
|
||||
|
@ -425,7 +425,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// return 0;
|
||||
// }
|
||||
public void testUnnamedNamespace_283679() throws Exception {
|
||||
final StringBuffer[] contents = getContentsForTest(1);
|
||||
final StringBuilder[] contents = getContentsForTest(1);
|
||||
final String content = contents[0].toString();
|
||||
IFile f2= createFile(getProject(), "testUnnamedNamespace_283679.cpp", content);
|
||||
waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
|
@ -460,7 +460,7 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
|
|||
// delete dbPtr;
|
||||
// }
|
||||
public void testCallsToFromVirtualMethod_246064() throws Exception {
|
||||
final StringBuffer[] contents = getContentsForTest(1);
|
||||
final StringBuilder[] contents = getContentsForTest(1);
|
||||
final String content = contents[0].toString();
|
||||
IFile f2= createFile(getProject(), "testCallsToFromVirtualMethod_246064.cpp", content);
|
||||
waitForIndexer(fIndex, f2, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
|
|
|
@ -57,7 +57,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// n->inline_method(); // r3
|
||||
// }
|
||||
public void testMethods() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(2);
|
||||
CharSequence[] content= getContentsForTest(2);
|
||||
String header= content[0].toString();
|
||||
String source = content[1].toString();
|
||||
IFile headerFile= createFile(getProject(), "testMethods.h", header);
|
||||
|
@ -127,7 +127,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// method3();
|
||||
// }
|
||||
public void testMethodsInMultipleFiles() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
CharSequence[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
@ -177,7 +177,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// method3();
|
||||
// }
|
||||
public void testMultipleImplsForMethod() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
CharSequence[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
@ -237,7 +237,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// mc.method1();
|
||||
// }
|
||||
public void testReverseMultipleImplsForMethod() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
CharSequence[] content= getContentsForTest(3);
|
||||
String header= content[0].toString();
|
||||
String source1 = content[1].toString();
|
||||
String source2 = content[2].toString();
|
||||
|
@ -294,7 +294,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// cxcpp();
|
||||
// }
|
||||
public void testCPPCallsC() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(2);
|
||||
CharSequence[] content= getContentsForTest(2);
|
||||
String cSource= content[0].toString();
|
||||
String cppSource = content[1].toString();
|
||||
IFile cFile= createFile(getProject(), "s.c", cSource);
|
||||
|
@ -339,7 +339,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// cppfunc();
|
||||
// }}
|
||||
public void testCCallsCPP() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(2);
|
||||
CharSequence[] content= getContentsForTest(2);
|
||||
String cSource= content[0].toString();
|
||||
String cppSource = content[1].toString();
|
||||
IFile cFile= createFile(getProject(), "s.c", cSource);
|
||||
|
@ -411,7 +411,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// f('1');
|
||||
// }
|
||||
public void testTemplates() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(1);
|
||||
CharSequence[] content= getContentsForTest(1);
|
||||
String source = content[0].toString();
|
||||
IFile file= createFile(getProject(), "testTemplates.cpp", source);
|
||||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
|
@ -475,7 +475,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
// []{c();}();
|
||||
// }
|
||||
public void testClosures_316307() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(1);
|
||||
CharSequence[] content= getContentsForTest(1);
|
||||
String source = content[0].toString();
|
||||
IFile file= createFile(getProject(), "testClosures.cpp", source);
|
||||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
|
|
|
@ -42,7 +42,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
|||
public void testSimpleInclusion() throws Exception {
|
||||
TestScannerProvider.sIncludes= new String[]{getProject().getProject().getLocation().toOSString()};
|
||||
|
||||
StringBuffer[] contents= getContentsForTest(1);
|
||||
StringBuilder[] contents= getContentsForTest(1);
|
||||
IProject project= getProject().getProject();
|
||||
IFile user= createFile(project, "user.h", "");
|
||||
IFile system= createFile(project, "system.h", "");
|
||||
|
@ -76,7 +76,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
|||
|
||||
TestScannerProvider.sIncludes= new String[]{op.getProject().getLocation().toOSString()};
|
||||
|
||||
StringBuffer[] contents= getContentsForTest(1);
|
||||
StringBuilder[] contents= getContentsForTest(1);
|
||||
IFile user= createFile(op.getProject(), "user.h", "");
|
||||
IFile system= createFile(op.getProject(), "system.h", "");
|
||||
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, 0, "source.cpp");
|
||||
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
CProjectHelper.delete(op);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
|||
//#define MACRO2()
|
||||
//int main(int argc, char** argv) {}
|
||||
public void testSimpleOutlineContent() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(1);
|
||||
StringBuilder[] contents= getContentsForTest(1);
|
||||
IProject project= getProject().getProject();
|
||||
IFile source= createFile(project, "source.cpp", contents[0].toString());
|
||||
waitForIndexer(project, source);
|
||||
|
@ -121,7 +121,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
|||
//int Foo::field = 5;
|
||||
//void Foo::foo() {}
|
||||
public void testGroupedMembers() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
IProject project= getProject().getProject();
|
||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||
|
@ -162,7 +162,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
|||
//void Foo::foo() {}
|
||||
//}
|
||||
public void testGroupedMembersInNamespace() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
IProject project= getProject().getProject();
|
||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||
|
@ -208,7 +208,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
|||
//void Foo::foo() {}
|
||||
//}
|
||||
public void testGroupedNamespaces() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
IProject project= getProject().getProject();
|
||||
IFile header= createFile(project, "header.h", contents[0].toString());
|
||||
IFile source= createFile(project, "source.cpp", contents[1].toString());
|
||||
|
@ -252,7 +252,7 @@ public class BasicOutlineTest extends BaseUITestCase {
|
|||
//void Foo::foo() {}
|
||||
//}
|
||||
public void testGroupedMembersInGroupedNamespaces() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
IProject project= getProject().getProject();
|
||||
IFile header= createFile(project, "header.h", contents[0].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 {
|
||||
ICProject fCProject;
|
||||
StringBuffer[] testData;
|
||||
CharSequence[] testData;
|
||||
|
||||
public static TestSuite suite() {
|
||||
return suite(BasicSearchTest.class);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class LinkedNamesFinderTest extends AST2BaseTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected StringBuffer[] getContents(int sections) throws IOException {
|
||||
protected CharSequence[] getContents(int sections) throws IOException {
|
||||
CTestPlugin plugin = CTestPlugin.getDefault();
|
||||
if (plugin == null)
|
||||
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 {
|
||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 2);
|
||||
} catch(IOException ioe) {
|
||||
|
@ -242,7 +242,7 @@ public class AbstractAutoEditTest extends BaseTestCase {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected StringBuffer[] getTestContents1() {
|
||||
protected CharSequence[] getTestContents1() {
|
||||
try {
|
||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui", this.getClass(), getName(), 1);
|
||||
} catch(IOException ioe) {
|
||||
|
|
|
@ -99,7 +99,7 @@ public class AddBlockCommentTest extends BaseUITestCase {
|
|||
*/
|
||||
protected void assertFormatterResult(LinePosition startLinePosition, LinePosition endLinePosition)
|
||||
throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
String before = contents[0].toString();
|
||||
String after = contents[1].toString();
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class CIndenterTest extends BaseUITestCase {
|
|||
|
||||
protected void assertIndenterResult() throws Exception {
|
||||
CCorePlugin.setOptions(fOptions);
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
StringBuilder[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
IDocument document= new Document(before);
|
||||
String expected= contents[1].toString();
|
||||
|
|
|
@ -59,7 +59,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
}
|
||||
|
||||
protected void assertFormatterResult() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
String expected= contents[1].toString();
|
||||
assertFormatterResult(before, expected);
|
||||
|
@ -2383,4 +2383,198 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
public void testDoubleClosingAngleBrackets_Bug333816() throws Exception {
|
||||
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();
|
||||
textTools.setupCDocument(doc);
|
||||
|
||||
StringBuffer[] raw= getTestContents();
|
||||
CharSequence[] raw= getTestContents();
|
||||
String init= raw[0].toString(), expected= raw[1].toString();
|
||||
|
||||
int caretInit= init.indexOf('X');
|
||||
|
|
|
@ -81,7 +81,7 @@ public class RemoveBlockCommentTest extends BaseUITestCase {
|
|||
protected void assertFormatterResult(
|
||||
LinePosition startLinePosition,
|
||||
LinePosition endLinePosition) throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before = contents[0].toString();
|
||||
String after = contents[1].toString();
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ShiftActionTest extends BaseUITestCase {
|
|||
// for(;;) {
|
||||
// }
|
||||
public void testShiftRight() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
String after= contents[1].toString();
|
||||
fDocument.set(before);
|
||||
|
@ -150,7 +150,7 @@ public class ShiftActionTest extends BaseUITestCase {
|
|||
// for(;;) {
|
||||
//}
|
||||
public void testShiftLeft() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
String after= contents[1].toString();
|
||||
fDocument.set(before);
|
||||
|
|
|
@ -158,7 +158,7 @@ public class SortLinesTest extends BaseUITestCase {
|
|||
// // e.h
|
||||
// #include "e.h"
|
||||
public void testSortLinesMixed() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
String after= contents[1].toString();
|
||||
fDocument.set(before);
|
||||
|
@ -179,7 +179,7 @@ public class SortLinesTest extends BaseUITestCase {
|
|||
// * Callisto
|
||||
// */
|
||||
public void testSortLinesCommentsOnly() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(2);
|
||||
CharSequence[] contents= getContentsForTest(2);
|
||||
String before= contents[0].toString();
|
||||
String after= contents[1].toString();
|
||||
fDocument.set(before);
|
||||
|
|
|
@ -81,7 +81,7 @@ public class TemplateFormatterTest extends BaseUITestCase {
|
|||
assertFormatterResult(false);
|
||||
}
|
||||
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 expected= contents[1].toString();
|
||||
final Document document = new Document(before);
|
||||
|
|
|
@ -192,7 +192,7 @@ public class CompletionTests extends AbstractContentAssistTest {
|
|||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||
fProject= project;
|
||||
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
||||
StringBuffer sourceContent= getContentsForTest(1)[0];
|
||||
StringBuilder sourceContent= getContentsForTest(1)[0];
|
||||
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n");
|
||||
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
||||
assertTrue("No cursor location specified", fCursorOffset >= 0);
|
||||
|
@ -955,7 +955,7 @@ public class CompletionTests extends AbstractContentAssistTest {
|
|||
// #include "header191315.h"
|
||||
// void xxx() { c_lin/*cursor*/
|
||||
public void testExternC_bug191315() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
CharSequence[] content= getContentsForTest(3);
|
||||
createFile(fProject, "header191315.h", content[0].toString());
|
||||
createFile(fProject, "source191315.c", 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 {
|
||||
fProject= project;
|
||||
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));
|
||||
sourceContent.insert(includeOffset, "#include \""+HEADER_FILE_NAME+"\"\n");
|
||||
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
||||
|
@ -309,7 +309,7 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
|||
// #include "header191315.h"
|
||||
// void xxx() { c_lin/*cursor*/
|
||||
public void testExternC_bug191315() throws Exception {
|
||||
StringBuffer[] content= getContentsForTest(3);
|
||||
CharSequence[] content= getContentsForTest(3);
|
||||
createFile(fProject, "header191315.h", content[0].toString());
|
||||
createFile(fProject, "source191315.c", content[1].toString());
|
||||
createFile(fProject, "source191315.cpp", content[1].toString());
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ParameterHintTests extends AbstractContentAssistTest {
|
|||
@Override
|
||||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
||||
StringBuffer sourceContent= getContentsForTest(1)[0];
|
||||
StringBuilder sourceContent= getContentsForTest(1)[0];
|
||||
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n");
|
||||
assertNotNull(createFile(project, HEADER_FILE_NAME, headerContent));
|
||||
return createFile(project, SOURCE_FILE_NAME, sourceContent.toString());
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ShowCamelCasePreferenceTest extends AbstractContentAssistTest {
|
|||
@Override
|
||||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||
fProject= project;
|
||||
StringBuffer sourceContent= getContentsForTest(1)[0];
|
||||
StringBuilder sourceContent= getContentsForTest(1)[0];
|
||||
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
|
||||
assertTrue("No cursor location specified", fCursorOffset >= 0);
|
||||
sourceContent.delete(fCursorOffset, fCursorOffset+CURSOR_LOCATION_TAG.length());
|
||||
|
|
|
@ -673,7 +673,7 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit
|
|||
final IDocument doc = new Document();
|
||||
textTools.setupCDocument(doc);
|
||||
|
||||
StringBuffer[] raw= getTestContents();
|
||||
CharSequence[] raw= getTestContents();
|
||||
String init= raw[0].toString(), expected= raw[1].toString();
|
||||
|
||||
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