[cfe-dev] Best way to know if a method declaration is defined in the source
Mustakimur Rahman Khandaker via cfe-dev
cfe-dev at lists.llvm.org
Thu Jun 14 09:42:37 PDT 2018
I am not sure if the following procedure is correct for this purpose, I will like if someone ensure if it is correct to do so.
const CXXMethodDecl *MD = cast<CXXMethodDecl>(CGF.CurGD.getDecl());
if (isa<CXXConstructorDecl>(MD)) {
auto *classDecl = MD->getParent();
if (!classDecl->isCXX11StandardLayout()) {
// constructor of user-defined class
}
}
Mustakimur Rahman Khandaker
Graduate Research Assistant
Department of Computer Science
Florida State University
mrk15e at my.fsu.edu (https://link.getmailspring.com/link/1528994293.local-bb1dfe4b-25c1-v1.2.2-96fb3a99@getmailspring.com/0?redirect=mailto%3Amustakcsecuet%40gmail.com&recipient=Y2ZlLWRldkBsaXN0cy5sbHZtLm9yZw%3D%3D)
http://www.dreamlandcoder.com/ (https://link.getmailspring.com/link/1528994293.local-bb1dfe4b-25c1-v1.2.2-96fb3a99@getmailspring.com/1?redirect=http%3A%2F%2Fwww.dreamlandcoder.com%2F&recipient=Y2ZlLWRldkBsaXN0cy5sbHZtLm9yZw%3D%3D)
On Jun 14 2018, at 10:26 am, paul.robinson at sony.com wrote:
>
> So, you want to exclude methods defined in system headers? I think there is a way to detect whether a source location is considered to be in a system header; if you grep through clang/include/clang/* for 'SystemHeader' you should find it.
> --paulr
>
> From: Mustakimur Rahman Khandaker [mailto:mrk15e at my.fsu.edu]
> Sent: Thursday, June 14, 2018 10:04 AM
> To: Robinson, Paul
> Cc: cfe-dev at lists.llvm.org
> Subject: Re: [cfe-dev] Best way to know if a method declaration is defined in the source
>
>
>
>
>
> What about if I want to include implicitly defined constructor and destructor with other user-defined method for a class that is defined in the source? Like I don't want to have ios_base constructor but I want Employee constructor that is either implicitly or explicitly defined because the class is user-defined.
>
>
>
> Mustakimur Rahman Khandaker
>
>
>
> Graduate Research Assistant
> Department of Computer Science
> Florida State University
>
>
>
>
>
> mrk15e at my.fsu.edu (https://link.getmailspring.com/link/1528994293.local-bb1dfe4b-25c1-v1.2.2-96fb3a99@getmailspring.com/2?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1528984836.local-a442f1ab-2f19-v1.2.2-96fb3a99%40getmailspring.com%2F0%3Fredirect%3Dmailto%253Amustakcsecuet%2540gmail.com%26recipient%3DcGF1bC5yb2JpbnNvbkBzb255LmNvbQ%253D%253D&recipient=Y2ZlLWRldkBsaXN0cy5sbHZtLm9yZw%3D%3D)
>
>
>
> http://www.dreamlandcoder.com/ (https://link.getmailspring.com/link/1528994293.local-bb1dfe4b-25c1-v1.2.2-96fb3a99@getmailspring.com/3?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1528984836.local-a442f1ab-2f19-v1.2.2-96fb3a99%40getmailspring.com%2F1%3Fredirect%3Dhttp%253A%252F%252Fwww.dreamlandcoder.com%252F%26recipient%3DcGF1bC5yb2JpbnNvbkBzb255LmNvbQ%253D%253D&recipient=Y2ZlLWRldkBsaXN0cy5sbHZtLm9yZw%3D%3D)
>
>
>
>
>
>
>
>
>
> On Jun 14 2018, at 9:58 am, paul.robinson at sony.com wrote:
>
> >
> >
> > You probably want the `isUserProvided()` predicate, which is false for things like implicitly defined constructors and destructors.
> >
> >
> > --paulr
> >
> >
> >
> > From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of Mustakimur Rahman Khandaker via cfe-dev
> > Sent: Thursday, June 14, 2018 9:36 AM
> >
> > To: cfe-dev at lists.llvm.org
> >
> > Subject: [cfe-dev] Best way to know if a method declaration is defined in the source
> >
> >
> >
> >
> >
> >
> >
> >
> > Hi
> >
> >
> >
> >
> > I am working on clang codegen module and I would like to know how anyone can identify a CXXMethodDecl is defined in the compiled source. In the codegen, I have encountered number of methods thats are not part of my test source code, so if I try to modify them in codegen, they have broken down. Is there any flag or other way using sourcelocation to discard those method declaration from modification.
> >
> >
> >
> >
> >
> > Mustakimur Rahman Khandaker
> >
> >
> >
> > Graduate Research Assistant
> > Department of Computer Science
> > Florida State University
> >
> >
> >
> >
> >
> > mrk15e at my.fsu.edu (https://link.getmailspring.com/link/1528994293.local-bb1dfe4b-25c1-v1.2.2-96fb3a99@getmailspring.com/4?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1528984836.local-a442f1ab-2f19-v1.2.2-96fb3a99%40getmailspring.com%2F2%3Fredirect%3Dhttps%253A%252F%252Flink.getmailspring.com%252Flink%252F1528982998.local-dae38628-7a1f-v1.2.2-96fb3a99%2540getmailspring.com%252F0%253Fredirect%253Dmailto%25253Amustakcsecuet%252540gmail.com%2526recipient%253DY2ZlLWRldkBsaXN0cy5sbHZtLm9yZw%25253D%25253D%26recipient%3DcGF1bC5yb2JpbnNvbkBzb255LmNvbQ%253D%253D&recipient=Y2ZlLWRldkBsaXN0cy5sbHZtLm9yZw%3D%3D)
> >
> >
> >
> > http://www.dreamlandcoder.com/ (https://link.getmailspring.com/link/1528994293.local-bb1dfe4b-25c1-v1.2.2-96fb3a99@getmailspring.com/5?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1528984836.local-a442f1ab-2f19-v1.2.2-96fb3a99%40getmailspring.com%2F3%3Fredirect%3Dhttps%253A%252F%252Flink.getmailspring.com%252Flink%252F1528982998.local-dae38628-7a1f-v1.2.2-96fb3a99%2540getmailspring.com%252F1%253Fredirect%253Dhttp%25253A%25252F%25252Fwww.dreamlandcoder.com%25252F%2526recipient%253DY2ZlLWRldkBsaXN0cy5sbHZtLm9yZw%25253D%25253D%26recipient%3DcGF1bC5yb2JpbnNvbkBzb255LmNvbQ%253D%253D&recipient=Y2ZlLWRldkBsaXN0cy5sbHZtLm9yZw%3D%3D)
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180614/d50ddfa2/attachment.html>
More information about the cfe-dev
mailing list