mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
fix for 184804 - incorrect source offsets for incomplete macro definition
patch from Mike Kucera
This commit is contained in:
parent
6a2f91110e
commit
408a2358b9
2 changed files with 16 additions and 5 deletions
|
@ -309,7 +309,7 @@ public class DOMLocationInclusionTests extends AST2FileBasePluginTest {
|
|||
c_file_code.indexOf("X"), 1); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
assertSoleFileLocation(
|
||||
macroDefinitions[1],
|
||||
"blarg.h", h_file_code.indexOf("#define _BLARG_H_"), "#define _BLARG_H_\r".length()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"blarg.h", h_file_code.indexOf("#define _BLARG_H_"), "#define _BLARG_H_".length()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
assertSoleFileLocation(
|
||||
macroDefinitions[1].getName(),
|
||||
"blarg.h", h_file_code.indexOf("e _BLARG_H_") + 2, "_BLARG_H_".length()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
@ -390,7 +390,7 @@ public class DOMLocationInclusionTests extends AST2FileBasePluginTest {
|
|||
c_file_code.indexOf("X"), 1); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
assertSoleFileLocation(
|
||||
macroDefinitions[1],
|
||||
"blarg.h", h_file_code.indexOf("#define _BLARG_H_"), "#define _BLARG_H_\r".length()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"blarg.h", h_file_code.indexOf("#define _BLARG_H_"), "#define _BLARG_H_".length()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
assertSoleFileLocation(
|
||||
macroDefinitions[1].getName(),
|
||||
"blarg.h", h_file_code.indexOf("e _BLARG_H_") + 2, "_BLARG_H_".length()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
|
|
@ -2153,10 +2153,21 @@ abstract class BaseScanner implements IScanner {
|
|||
}
|
||||
|
||||
// Capture the replacement text
|
||||
skipOverWhiteSpace();
|
||||
int textstart = bufferPos[bufferStackPos] + 1;
|
||||
int textend = textstart - 1;
|
||||
|
||||
// Set the offsets to the current position in case there
|
||||
// is no replacement sequence (bug #184804)
|
||||
int textend = bufferPos[bufferStackPos];
|
||||
int textstart = textend + 1;
|
||||
|
||||
int varArgDefinitionInd = -1;
|
||||
skipOverWhiteSpace();
|
||||
|
||||
// if there is a replacement sequence then adjust the offsets accordingly
|
||||
if(bufferPos[bufferStackPos] + 1 < limit
|
||||
&& buffer[bufferPos[bufferStackPos] + 1] != '\n') {
|
||||
textend = bufferPos[bufferStackPos];
|
||||
textstart = textend + 1;
|
||||
}
|
||||
|
||||
boolean encounteredComment = false;
|
||||
boolean usesVarArgInDefinition = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue