next steps to make symbol files work again

This commit is contained in:
Araq 2013-04-08 14:27:55 +02:00
commit 6d64a6e42c
2 changed files with 10 additions and 3 deletions

View file

@ -155,7 +155,8 @@ proc compileModule(fileIdx: int32, flags: TSymFlags): PSym =
growCache gMemCacheData, fileIdx growCache gMemCacheData, fileIdx
gMemCacheData[fileIdx].needsRecompile = Probing gMemCacheData[fileIdx].needsRecompile = Probing
result = newModule(fileIdx) result = newModule(fileIdx)
var rd = handleSymbolFile(result) #var rd = handleSymbolFile(result)
var rd: PRodReader
result.flags = result.flags + flags result.flags = result.flags + flags
if gCmd in {cmdCompileToC, cmdCompileToCpp, cmdCheck, cmdIdeTools}: if gCmd in {cmdCompileToC, cmdCompileToCpp, cmdCheck, cmdIdeTools}:
rd = handleSymbolFile(result) rd = handleSymbolFile(result)

View file

@ -729,8 +729,14 @@ proc findSomeWhere(id: int) =
echo "found id ", id, " in ", gMods[i].filename echo "found id ", id, " in ", gMods[i].filename
proc getReader(moduleId: int): PRodReader = proc getReader(moduleId: int): PRodReader =
InternalAssert moduleId >= 0 and moduleId < gMods.len # we can't index 'gMods' here as it's indexed by a *file index* which is not
result = gMods[moduleId].rd # the module ID! We could introduce a mapping ID->PRodReader but I'll leave
# this for later versions if benchmarking shows the linear search causes
# problems:
for i in 0 .. <gMods.len:
result = gMods[i].rd
if result != nil and result.moduleId == moduleId: return result
return nil
proc rrGetSym(r: PRodReader, id: int, info: TLineInfo): PSym = proc rrGetSym(r: PRodReader, id: int, info: TLineInfo): PSym =
result = PSym(IdTableGet(r.syms, id)) result = PSym(IdTableGet(r.syms, id))