[cfe-dev] Why is an out-of-line ctor isInlined?

Xu Zhongxing xu_zhong_xing at 163.com
Sun Dec 25 19:07:09 PST 2011


For the following code,

class A {
   int x;
public:
     A(int);
     ~A();
};

void f() {
   A a(1);
}

FunctionDecl::isInlined() returns true for A's ctor A(int), because it 
is a CXXMethodDecl and it is not out-of-line.
This is the implementation of isOutOfLine()

virtual bool isOutOfLine() const {
     return getLexicalDeclContext() != getDeclContext();
}

I suspect the logic is not correct for a CXXMethodDecl.




More information about the cfe-dev mailing list