On Mar 5, 2013, at 5:12 , Anton Yartsev <[email protected]> wrote:
> Attached is the new patch with unix.MismatchedDeallocator and
> cplusplus.NewDelete splitted from unix.Malloc plus comments addressed and
> several other improvements.
Awesome. At this point I think this is basically ready to go in. Anna?
(We need to update SATestBuild.py and lib/Frontend/CompilerInvocation.cpp to
enable the "cplusplus" package again.)
> + delete p; // expected-warning{{Memory allocated by operator new[] should
> be deallocated by operator delete[], not operator delete}}
Bikeshedding again on the warning text: do we really need the word "operator"
in there? Maybe just putting quotes around the operator name would be good
enough:
"Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete'".
That's this part of printAllocDeallocName (which may have been suggested by me):
> + if (const CXXNewExpr *NE = dyn_cast<CXXNewExpr>(E)) {
> + os << *NE->getOperatorNew();
> + return true;
> + }
> +
> + if (const CXXDeleteExpr *DE = dyn_cast<CXXDeleteExpr>(E)) {
> + os << *DE->getOperatorDelete();
> + return true;
> + }
It looks like there's a function getOperatorSpelling that will get the name
without the word "operator". (It makes sense to leave in the "operator" when it
appears in an explicit call expr, just not a normal expression or the
"expected" case.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits