[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list=<arg1, arg2, ...> to match gcc options.

Hal Finkel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 1 07:29:21 PDT 2017


hfinkel added a comment.

In https://reviews.llvm.org/D37624#885311, @choikwa wrote:

> In https://reviews.llvm.org/D37624#885308, @hfinkel wrote:
>
> > In https://reviews.llvm.org/D37624#885295, @choikwa wrote:
> >
> > > In https://reviews.llvm.org/D37624#885290, @hfinkel wrote:
> > >
> > > > In https://reviews.llvm.org/D37624#885288, @choikwa wrote:
> > > >
> > > > > - add comment to CPP test to explain usage
> > > >
> > > >
> > > > Thanks. Please also add some tests showing matching overloaded functions, functions with template parameters, etc.
> > > >
> > > > Do we need to strip whitespace before trying to match the demangled names?
> > >
> > >
> > > Some cursory testing with g++ shows that only the 'test5' of 'test5(float, int, int*)' is matched. 'test5(' or 'test5 (' is not matched. It seems weird that arguments are not matched.
> > >
> > > g++ man page shows
> > >
> > >   "The function name to be matched is its user-visible name, such as "vector<int> blah(const vector<int> &)", not the internal mangled name"
> > >
> > > but it doesn't seem to be including parameters.
> >
> >
> > Interesting. Can you tell what GCC is doing w.r.t. namespace names, class names, etc. and template parameters?
> >
> > > Also uncovered a bug where sub argument list containing comma needs to be surrounded by single quote, but clang seems to ignores single quote.
> > >  I'll try to dig around ArgList implementation to see if it can return argument surrounded by single-quote as a whole.
>
>
> Given A::B::C<D>(T a), only 'C<D>' is meaningful in g++'s matcher. Adding anything else escapes the match [  'B::C', 'C<D>('  ].
>  It seems like g++ will also not match single quotes as a whole, ie. int fooboo() is matched by 'foo,boo'.


Can you get more information on what GCC actually implemented and why? It's not clear to me that ignoring the namespaces is the most-useful way to do this. I don't want to emulate GCC bugs, but maybe there's a good reason why their implementation works this way.


https://reviews.llvm.org/D37624





More information about the cfe-commits mailing list