Fragments and assertions reference LineInfo items instead of having separate

embedded FilePos items.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4915 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-01-24 22:39:07 +00:00
parent 06e3152035
commit 6ddf79fc30
9 changed files with 137 additions and 113 deletions

View File

@@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1998-2010, Ullrich von Bassewitz */
/* (C) 1998-2011, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
@@ -211,7 +211,6 @@ Section* ReadSection (FILE* F, ObjData* O)
unsigned FragCount;
Segment* S;
Section* Sec;
LineInfo* LI;
/* Read the segment data */
(void) Read32 (F); /* File size of data */
@@ -240,12 +239,9 @@ Section* ReadSection (FILE* F, ObjData* O)
}
/* Start reading fragments from the file and insert them into the section . */
LI = 0;
while (FragCount--) {
Fragment* Frag;
FilePos Pos;
unsigned LineInfoIndex;
/* Read the fragment type */
unsigned char Type = Read8 (F);
@@ -280,43 +276,11 @@ Section* ReadSection (FILE* F, ObjData* O)
return 0;
}
/* Read the file position of the fragment */
ReadFilePos (F, &Pos);
/* Read the line infos into the list of the fragment */
ReadLineInfoList (F, O, &Frag->LineInfos);
/* Generate a LineInfo for this fragment. First check if this fragment
* was generated by the same line than that before. If not, generate
* a new LineInfo.
*/
if (LI == 0 || LI->Pos.Line != Pos.Line || LI->Pos.Col != Pos.Col ||
LI->Pos.Name != Pos.Name) {
/* We don't have a previous line info or this one is different */
LI = NewLineInfo (O, &Pos);
CollAppend (&O->LineInfos, LI);
}
AddLineInfo (Frag, LI);
/* Read additional line info and resolve it */
LineInfoIndex = ReadVar (F);
if (LineInfoIndex) {
--LineInfoIndex;
/* The line info index was written by the assembler and must
* therefore be part of the line infos read from the object file.
* To make sure this is true, don't compare against the count
* of line infos in the collection (which grows) but against the
* count initialized when reading from the file.
*/
if (LineInfoIndex >= O->LineInfoCount) {
Internal ("In module `%s', file `%s', line %lu: Invalid line "
"info with index %u (max count %u)",
GetObjFileName (O),
GetFragmentSourceName (Frag),
GetFragmentSourceLine (Frag),
LineInfoIndex,
O->LineInfoCount);
}
/* Add line info to the fragment */
AddLineInfo (Frag, CollAt (&O->LineInfos, LineInfoIndex));
}
/* Resolve the back pointers */
FragResolveLineInfos (Frag);
/* Remember the module we had this fragment from */
Frag->Obj = O;