[cfe-dev] Patch for bug 7256

Douglas Gregor dgregor at apple.com
Mon Nov 8 18:52:02 PST 2010


Hi Ryan,

On Nov 7, 2010, at 12:42 PM, Ryan Gerleve wrote:

> Hello!
> This simple update adds the expected name of the destructor to
> the diagnostic when the user-provided name is incorrect (bug 7256:
> http://llvm.org/bugs/show_bug.cgi?id=7256).
> 
> This is only my second patch. Comments are appreciated!

It's a great start! Just one technical comment:

+      if(DC->getDeclKind() == Decl::CXXRecord) {
+        CXXRecordDecl* CXXRD(static_cast<CXXRecordDecl*>(DC));

This will fail for class template full and partial specializations, whose DeclKind refers to a subclass of CXXRecordDecl. It would be better to combine these two into

  if (CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(DC)) {

Also, it's generally better to send patches to cfe-commits. cfe-dev is mainly for discussion.

Finally, could you include a test case for Clang's test suite as part of your patch? Extending/updating existing checks would be fine.

	- Doug



More information about the cfe-dev mailing list