devirt.cc

Line Hotness Pass Source
1
class base
2
{
3
public:
4
  virtual void meth () = 0;
5
};
6
7
class subclass : public base
8
{
9
public:
10
  void meth () {}
11
};
12
13
static void test (base *ptr)
14
{
15
  //subclass obj;
16
  for (int i = 0; i < 10000; i++)
17
    ptr->meth ();
einline
              ^folding virtual function call to virtual void subclass::meth()
              
18
  //obj.meth ();
19
}
20
21
void call_test ()
22
{
23
  subclass obj;
24
  test (&obj);
einline
       ^inlining void test(base*) into void call_test()
       
25
}