[PATCH] AST Dump: print the Inherited flag on attributes

Aaron Ballman aaron.ballman at gmail.com
Fri May 30 20:27:26 PDT 2014


LGTM!

~Aaron

On Fri, May 30, 2014 at 6:59 PM, Hans Wennborg <hans at chromium.org> wrote:
> Hi aaron.ballman,
>
> Also move the attribute-specific dumping to after dumping this and
> the Implicit flag.
>
> http://reviews.llvm.org/D3971
>
> Files:
>   lib/AST/ASTDumper.cpp
>   test/Misc/ast-dump-attr.cpp
>
> Index: lib/AST/ASTDumper.cpp
> ===================================================================
> --- lib/AST/ASTDumper.cpp
> +++ lib/AST/ASTDumper.cpp
> @@ -629,9 +629,11 @@
>    }
>    dumpPointer(A);
>    dumpSourceRange(A->getRange());
> -#include "clang/AST/AttrDump.inc"
> +  if (A->isInherited())
> +    OS << " Inherited";
>    if (A->isImplicit())
>      OS << " Implicit";
> +#include "clang/AST/AttrDump.inc"
>  }
>
>  static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
> Index: test/Misc/ast-dump-attr.cpp
> ===================================================================
> --- test/Misc/ast-dump-attr.cpp
> +++ test/Misc/ast-dump-attr.cpp
> @@ -108,7 +108,13 @@
>  extern "C" int printf(const char *format, ...);
>  // CHECK: FunctionDecl{{.*}}printf
>  // CHECK-NEXT: ParmVarDecl{{.*}}format{{.*}}'const char *'
> -// CHECK-NEXT: FormatAttr{{.*}}printf 1 2 Implicit
> +// CHECK-NEXT: FormatAttr{{.*}}Implicit printf 1 2
> +
> +alignas(8) extern int x;
> +extern int x;
> +// CHECK: VarDecl{{.*}} x 'int'
> +// CHECK: VarDecl{{.*}} x 'int'
> +// CHECK-NEXT: AlignedAttr{{.*}} Inherited
>  }
>
>  int __attribute__((cdecl)) TestOne(void), TestTwo(void);



More information about the cfe-commits mailing list