浏览代码

* write empty section if no info about devirtualisable classes
* don't crash when looking up info about devirtualisable methods in case
the section was empty

git-svn-id: trunk@12346 -

Jonas Maebe 16 年之前
父节点
当前提交
d357fb8936
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      compiler/optvirt.pas

+ 7 - 1
compiler/optvirt.pas

@@ -991,10 +991,10 @@ unit optvirt;
         classdevirtinfo: tclassdevirtinfo;
         first: boolean;
       begin
+        writer.startsection(DEVIRT_SECTION_NAME);
         { if there are no optimised virtual methods, we have stored no info }
         if not assigned(funits) then
           exit;
-        writer.startsection(DEVIRT_SECTION_NAME);
         documentformat(writer);
         for unitcount:=0 to funits.count-1 do
           begin
@@ -1033,6 +1033,12 @@ unit optvirt;
         vmtentry: longint;
         realobjdef: tobjectdef;
       begin
+         { if we don't have any devirtualisation info, exit }
+         if not assigned(funits) then
+           begin
+             result:=false;
+             exit
+           end;
          { class methods are in the regular vmt, so we can handle classrefs
            the same way as plain objectdefs
          }