[PATCH] D14592: Qt (version 4 or 5) signal/method checker

Evgeniy Dushistov via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 16:38:13 PST 2015


On Wed, Nov 11, 2015 at 11:58:34PM +0000, Jonathan Roelofs wrote:
> jroelofs added a subscriber: jroelofs.
> 
> ================
> Comment at: lib/StaticAnalyzer/Checkers/QtSignalSlotChecker.cpp:114
> @@ +113,3 @@
> +                         printMethodNameWithPramaTypes(Out, C, FName, M, false);
> +                         const std::string NS = qtNormalizeSignature(Out.str());
> +                         if (NS == MethodWithParamsNorm)
> ----------------
> Why are you throwing away all the work that the parser did to build up the type signature as a QualType, pretty-printing it, and the re-parsing it by hand? ISTM it would be much better if qtNormalizeSignature had this type signature: `QualType qtNormalizeSignature(QualType)`.
> 
> 

First of all this code compare two things:
1)QualType from clang,
2)string  that I get from
connect(obj1, "1f(unsgined int)", obj2, "2g(uint)");
                ^                          ^
		here                       and here

so to simplify things I need compare QualType and data from
StringLiteral.

The second thing, that should be menntioned,that
"Qt normalization" and converting output to string
(this normalization used by Qt when it compare at runtime
that signal match slot)

not match exactly to already existing in clang 
print type functionality:
- it remove spaces every where, where possible
- it print "uint" instead of "unsigned int"


so I glad to have inteface like this
`QualType qtNormalizeSignature(QualType)`
but to use such interface I need convert StringLiteral conent
to function signature, in other words run parser inside parser,
plus I have to hach PrintType from AST to make possible
print function signature in `Qt` way.

-- 
/Evgeniy


More information about the cfe-commits mailing list