mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 367316: Relative includes when parsing in context.
This commit is contained in:
parent
10372e2841
commit
1b67403176
3 changed files with 23 additions and 3 deletions
|
@ -295,4 +295,14 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
|
||||||
}
|
}
|
||||||
return IIndexFile.EMPTY_FILE_ARRAY;
|
return IIndexFile.EMPTY_FILE_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContextPath() {
|
||||||
|
if (fContextToHeaderGap != null)
|
||||||
|
try {
|
||||||
|
return fPathResolver.getASTPath(fContextToHeaderGap[0].getLocation());
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,11 +297,14 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
fMacroExpander= new MacroExpander(this, fMacroDictionary, fLocationMap, fLexOptions);
|
fMacroExpander= new MacroExpander(this, fMacroDictionary, fLocationMap, fLexOptions);
|
||||||
fIncludeFileResolutionHeuristics= fFileContentProvider.getIncludeHeuristics();
|
fIncludeFileResolutionHeuristics= fFileContentProvider.getIncludeHeuristics();
|
||||||
|
|
||||||
final String filePath= fRootContent.getFileLocation();
|
String contextPath= fFileContentProvider.getContextPath();
|
||||||
configureIncludeSearchPath(new File(filePath).getParentFile(), info);
|
if (contextPath == null) {
|
||||||
|
contextPath= fRootContent.getFileLocation();
|
||||||
|
}
|
||||||
|
configureIncludeSearchPath(new File(contextPath).getParentFile(), info);
|
||||||
setupMacroDictionary(configuration, info, language);
|
setupMacroDictionary(configuration, info, language);
|
||||||
|
|
||||||
ILocationCtx ctx= fLocationMap.pushTranslationUnit(filePath, fRootContent.getSource());
|
ILocationCtx ctx= fLocationMap.pushTranslationUnit(fRootContent.getFileLocation(), fRootContent.getSource());
|
||||||
Lexer lexer = new Lexer(fRootContent.getSource(), fLexOptions, this, this);
|
Lexer lexer = new Lexer(fRootContent.getSource(), fLexOptions, this, this);
|
||||||
fRootContext= fCurrentContext= new ScannerContext(ctx, null, lexer);
|
fRootContext= fCurrentContext= new ScannerContext(ctx, null, lexer);
|
||||||
if (info instanceof IExtendedScannerInfo) {
|
if (info instanceof IExtendedScannerInfo) {
|
||||||
|
|
|
@ -135,4 +135,11 @@ public abstract class InternalFileContentProvider extends IncludeFileContentProv
|
||||||
list.add(sig);
|
list.add(sig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the path of the context of <code>null</code>, if there is no context.
|
||||||
|
*/
|
||||||
|
public String getContextPath() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue