[cfe-commits] Patch for PR7409 - Reduce number of warnings for invalid typedefs

Douglas Gregor dgregor at apple.com
Fri May 6 17:15:32 PDT 2011


On May 6, 2011, at 2:48 PM, Richard Trieu wrote:

> Changed the error message back to the original form.
> 
> On Fri, May 6, 2011 at 12:58 PM, Richard Trieu <rtrieu at google.com> wrote:
> Patch for PR7409.  Remove multiple error on invalid typedefs.  Once the first error is emitted, suppress additional errors when using the invalid typedefs.  Also, change the handling of types inside instantiations to be more descriptive.
> 
> Patch attached and available in Code Review:
> http://codereview.appspot.com/4430069/


-      
-      SemaRef.Diag(TL.getBeginLoc(), diag::err_nested_name_spec_non_tag) 
-        << TL.getType() << SS.getRange();
+      // If the namespace is an invalid type def, don't emit an error because

s/namespace/nested-name-specifier?

+      // a previous error should have already been emitted.

will have already been emitted, we hope :)

+      TypedefTypeLoc* TTL = dyn_cast<TypedefTypeLoc>(&TL);
+      if (!TTL || !TTL->getTypedefNameDecl()->isInvalidDecl()) {
+        SemaRef.Diag(TL.getBeginLoc(), diag::err_nested_name_spec_non_tag) 
+          << TL.getType() << SS.getRange();
+      }
       return NestedNameSpecifierLoc();

Looks good, thanks!

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110506/2443afee/attachment.html>


More information about the cfe-commits mailing list