[cfe-dev] checking for virtual members

John Thompson john.thompson.jtsoftware at gmail.com
Mon Nov 1 17:05:23 PDT 2010


I need a way easily check to make sure a function has no virtual functions,
or other stuff that would inject extra stuff into an object or structure, as
part of the validation for the vecreturn attribute.  How do I do it?

Checking the CXXRecordDecl::PlainOldData flag with isPOD doesn't work,
because the the strict definition of POD goes too far for this case.
Basically, I need a case like the following (to be build with clang -cc1
-fsyntax-only -faltivec -triple=powerpc file.cpp) to work:

class Scalar
{
public:
 Scalar();
 ~Scalar();
private:
 vector float m_value;
} __attribute__((vecreturn));
The following code in HandleVecReturnAttr produces the error because the
class is not strictly POD:

  if (isa<CXXRecordDecl>(record)) {
    if (!cast<CXXRecordDecl>(record)->isPOD()) {
  S.Diag(Attr.getLoc(), diag::err_attribute_vecreturn_only_pod_record);
  return;
    }
  }

Thanks.

-John

-- 
John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101101/46c0fd10/attachment.html>


More information about the cfe-dev mailing list