mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Fix for [Bug 183825] [Binary Parser] does not parse
This commit is contained in:
parent
4be0fe893c
commit
1c180b9fac
2 changed files with 69 additions and 9 deletions
|
@ -897,4 +897,24 @@ public class CDataUtil {
|
||||||
public static void setInteger(ICStorageElement el, String attr, int value){
|
public static void setInteger(ICStorageElement el, String attr, int value){
|
||||||
el.setAttribute(attr, new Integer(value).toString());
|
el.setAttribute(attr, new Integer(value).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ICExclusionPatternPathEntry addRemoveExclusionsToEntry(ICExclusionPatternPathEntry entry, IPath[] paths, boolean add) throws IllegalArgumentException{
|
||||||
|
if(paths == null || paths.length == 0)
|
||||||
|
return entry;
|
||||||
|
|
||||||
|
Set set = mergeRemovingDups(entry.getExclusionPatterns(), paths, add);
|
||||||
|
IPath exclusions[] = (IPath[])set.toArray(new IPath[set.size()]);
|
||||||
|
|
||||||
|
return (ICExclusionPatternPathEntry)createEntry(entry.getKind(), entry.getName(), null, exclusions, entry.getFlags());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Set mergeRemovingDups(Object o1[], Object o2[], boolean add){
|
||||||
|
LinkedHashSet set = new LinkedHashSet();
|
||||||
|
set.addAll(Arrays.asList(o1));
|
||||||
|
if(add)
|
||||||
|
set.addAll(Arrays.asList(o2));
|
||||||
|
else
|
||||||
|
set.removeAll(Arrays.asList(o2));
|
||||||
|
return set;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -943,6 +943,7 @@ public class PathEntryTranslator {
|
||||||
public static class PathEntryCollector {
|
public static class PathEntryCollector {
|
||||||
private PathSettingsContainer fStorage;
|
private PathSettingsContainer fStorage;
|
||||||
private KindBasedStore fStore;
|
private KindBasedStore fStore;
|
||||||
|
private KindBasedStore fNameKeyMapStore; //utility map, does not contain all entries, only those added explicitly
|
||||||
private LinkedHashMap fRefProjMap;
|
private LinkedHashMap fRefProjMap;
|
||||||
private IProject fProject;
|
private IProject fProject;
|
||||||
// private ICConfigurationDescription fCfg;
|
// private ICConfigurationDescription fCfg;
|
||||||
|
@ -951,6 +952,7 @@ public class PathEntryTranslator {
|
||||||
fStorage = PathSettingsContainer.createRootContainer();
|
fStorage = PathSettingsContainer.createRootContainer();
|
||||||
fStorage.setValue(this);
|
fStorage.setValue(this);
|
||||||
fStore = new KindBasedStore(false);
|
fStore = new KindBasedStore(false);
|
||||||
|
fNameKeyMapStore = new KindBasedStore(false);
|
||||||
// fCfg = cfg;
|
// fCfg = cfg;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
}
|
}
|
||||||
|
@ -958,14 +960,26 @@ public class PathEntryTranslator {
|
||||||
private PathEntryCollector(PathSettingsContainer container, KindBasedStore store, IProject project/*, ICConfigurationDescription cfg*/){
|
private PathEntryCollector(PathSettingsContainer container, KindBasedStore store, IProject project/*, ICConfigurationDescription cfg*/){
|
||||||
fStorage = container;
|
fStorage = container;
|
||||||
fStore = store;
|
fStore = store;
|
||||||
|
fNameKeyMapStore = new KindBasedStore(false);
|
||||||
// fCfg = cfg;
|
// fCfg = cfg;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSourceOutputEntries(int kind, ICExclusionPatternPathEntry entries[]){
|
public void setSourceOutputEntries(int kind, ICExclusionPatternPathEntry entries[]){
|
||||||
Map map = getEntriesMap(kind, true);
|
Map map = getEntriesMap(kind, true);
|
||||||
|
Map nameKeyMap = getEntriesNameKeyMap(kind, true);
|
||||||
for(int i = 0; i < entries.length; i++){
|
for(int i = 0; i < entries.length; i++){
|
||||||
map.put(entries[i], new PathEntryComposer(entries[i], fProject/*, fCfg*/));
|
ICExclusionPatternPathEntry entry = entries[i];
|
||||||
|
EntryNameKey nameKey = new EntryNameKey(entry);
|
||||||
|
PathEntryComposer old = (PathEntryComposer)nameKeyMap.get(nameKey);
|
||||||
|
if(old != null){
|
||||||
|
entry = CDataUtil.addRemoveExclusionsToEntry(entry,
|
||||||
|
((ICExclusionPatternPathEntry)old.fLangEntry).getExclusionPatterns(),
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
PathEntryComposer newComposer = new PathEntryComposer(entry, fProject/*, fCfg*/);
|
||||||
|
map.put(entry, newComposer);
|
||||||
|
nameKeyMap.put(nameKey, newComposer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,6 +1068,15 @@ public class PathEntryTranslator {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private LinkedHashMap getEntriesNameKeyMap(int kind, boolean create){
|
||||||
|
LinkedHashMap map = (LinkedHashMap)fNameKeyMapStore.get(kind);
|
||||||
|
if(map == null && create){
|
||||||
|
map = new LinkedHashMap();
|
||||||
|
fNameKeyMapStore.put(kind, map);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
private void addFilter(int kind, IPath path, Set entriesSet){
|
private void addFilter(int kind, IPath path, Set entriesSet){
|
||||||
if(entriesSet.size() == 0)
|
if(entriesSet.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -2283,12 +2306,33 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static CConfigurationData getCfgData(ICConfigurationDescription cfgDes){
|
||||||
|
return cfgDes instanceof CConfigurationDescriptionCache ?
|
||||||
|
(CConfigurationData)cfgDes : ((IInternalCCfgInfo)cfgDes).getConfigurationData(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addOutputEntries(PathEntryCollector cr, CConfigurationData data){
|
||||||
|
CBuildData bData = data.getBuildData();
|
||||||
|
if(bData != null){
|
||||||
|
ICOutputEntry oEntries[] = bData.getOutputDirectories();
|
||||||
|
if(oEntries != null && oEntries.length != 0){
|
||||||
|
cr.setSourceOutputEntries(ICSettingEntry.OUTPUT_PATH, oEntries);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static PathEntryCollector collectEntries(IProject project, ICConfigurationDescription des){
|
public static PathEntryCollector collectEntries(IProject project, ICConfigurationDescription des){
|
||||||
CConfigurationData data = des instanceof CConfigurationDescriptionCache ?
|
CConfigurationData data = getCfgData(des);
|
||||||
(CConfigurationData)des : ((IInternalCCfgInfo)des).getConfigurationData(false);
|
|
||||||
|
|
||||||
ReferenceSettingsInfo refInfo = new ReferenceSettingsInfo(des);
|
ReferenceSettingsInfo refInfo = new ReferenceSettingsInfo(des);
|
||||||
|
ICConfigurationDescription[] allCfgs = des.isPreferenceConfiguration() ?
|
||||||
|
new ICConfigurationDescription[]{des}
|
||||||
|
: des.getProjectDescription().getConfigurations();
|
||||||
|
|
||||||
|
CConfigurationData[] allDatas = new CConfigurationData[allCfgs.length];
|
||||||
|
for(int i = 0; i < allCfgs.length; i++){
|
||||||
|
allDatas[i] = getCfgData(allCfgs[i]);
|
||||||
|
}
|
||||||
// return collectEntries(project, data, info);
|
// return collectEntries(project, data, info);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
@ -2300,12 +2344,8 @@ public class PathEntryTranslator {
|
||||||
if(sEntries != null && sEntries.length != 0){
|
if(sEntries != null && sEntries.length != 0){
|
||||||
cr.setSourceOutputEntries(ICSettingEntry.SOURCE_PATH, sEntries);
|
cr.setSourceOutputEntries(ICSettingEntry.SOURCE_PATH, sEntries);
|
||||||
}
|
}
|
||||||
CBuildData bData = data.getBuildData();
|
for(int i = 0; i < allDatas.length; i++){
|
||||||
if(bData != null){
|
addOutputEntries(cr, allDatas[i]);
|
||||||
ICOutputEntry oEntries[] = bData.getOutputDirectories();
|
|
||||||
if(oEntries != null && oEntries.length != 0){
|
|
||||||
cr.setSourceOutputEntries(ICSettingEntry.OUTPUT_PATH, oEntries);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
final HashSet exportedSettings = new HashSet();
|
final HashSet exportedSettings = new HashSet();
|
||||||
if(refInfo != null){
|
if(refInfo != null){
|
||||||
|
|
Loading…
Add table
Reference in a new issue