[cfe-commits] r47193 - in /cfe/trunk/include/clang/AST: Attr.h Decl.h

Chris Lattner clattner at apple.com
Fri Feb 15 16:04:20 PST 2008


On Feb 15, 2008, at 3:57 PM, Anders Carlsson wrote:
> Author: andersca
> Date: Fri Feb 15 17:57:38 2008
> New Revision: 47193
>
> +#include <assert.h>

Please use <cassert> instead.

> +  template<typename T> T *getAttr() {
> +    for (Attr *attr = getAttrs(); attr; attr = attr->getNext())
> +      if (isa<T>(attr))
> +        return cast<T>(attr);

Please use dyn_cast instead of isa+cast.

   if (T *V = dyn_cast<T>(attr))
     return V;

-Chris

>
> +
> +    return 0;
> +  }
> +
>   /// setInvalidDecl - Indicates the Decl had a semantic error. This
>   /// allows for graceful error recovery.
>   void setInvalidDecl() { InvalidDecl = 1; }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list