mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Partial fix for bug 72535 - [Parser] Parser (and indexer) hangs on mutual inclusion
This commit is contained in:
parent
e0f8a9bbeb
commit
9dbce05b79
1 changed files with 24 additions and 0 deletions
|
@ -216,6 +216,30 @@ public class Scanner2 implements IScanner, IScannerData {
|
|||
}
|
||||
|
||||
private void pushContext(char[] buffer, Object data) {
|
||||
if( data instanceof InclusionData )
|
||||
{
|
||||
boolean isCircular = false;
|
||||
for( int i = 0; i < bufferStackPos; ++i )
|
||||
{
|
||||
if( bufferData[i] instanceof CodeReader &&
|
||||
CharArrayUtils.equals( ((CodeReader)bufferData[i]).filename, ((InclusionData)data).reader.filename ) )
|
||||
{
|
||||
isCircular = true;
|
||||
break;
|
||||
}
|
||||
else if( bufferData[i] instanceof InclusionData &&
|
||||
CharArrayUtils.equals( ((InclusionData)bufferData[i]).reader.filename, ((InclusionData)data).reader.filename ) )
|
||||
{
|
||||
isCircular = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( isCircular )
|
||||
{
|
||||
handleProblem( IProblem.PREPROCESSOR_CIRCULAR_INCLUSION, ((InclusionData)data).inclusion.getStartingOffset(), ((InclusionData)data).inclusion.getFilename() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
pushContext(buffer);
|
||||
bufferData[bufferStackPos] = data;
|
||||
if( data instanceof InclusionData )
|
||||
|
|
Loading…
Add table
Reference in a new issue