r352631 - [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

Roman Lebedev via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 30 07:48:51 PST 2019


On Wed, Jan 30, 2019 at 6:46 PM Aaron Ballman <aaron at aaronballman.com> wrote:
>
> On Wed, Jan 30, 2019 at 10:41 AM Roman Lebedev via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
> >
> > Author: lebedevri
> > Date: Wed Jan 30 07:41:20 2019
> > New Revision: 352631
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=352631&view=rev
> > Log:
> > [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit
> >
> > Summary:
> > Was trying to understand how complicated it would be to write
> > a clang-tidy `openmp-exception-escape`-ish check once D57100 lands.
> >
> > Just so it happens, all the data is already there,
> > it is just conveniently omitted from AST dump.
> >
> > Reviewers: aaron.ballman, steveire, ABataev
> >
> > Reviewed By: ABataev
> >
> > Subscribers: ABataev, guansong, cfe-commits
> >
> > Tags: #openmp, #clang
> >
> > Differential Revision: https://reviews.llvm.org/D57452
> >
> > Modified:
> >     cfe/trunk/lib/AST/ASTDumper.cpp
> >     cfe/trunk/test/AST/dump.cpp
> >
> > Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352631&r1=352630&r2=352631&view=diff
> > ==============================================================================
> > --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> > +++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Jan 30 07:41:20 2019
> > @@ -727,6 +727,8 @@ void ASTDumper::VisitPragmaDetectMismatc
> >  }
> >
> >  void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
> > +  if (D->isNothrow())
> > +    OS << " nothrow";
>
> These changes should be to the TextNodeDumper, not the ASTDumper.
TextNodeDumper does not have a function that handles CapturedDecl.
Was there some RFC about this on cfe-dev i missed?
If not, might be a good idea to publicly state this..

> ~Aaron
Roman.

> >    dumpStmt(D->getBody());
> >  }
> >
> >
> > Modified: cfe/trunk/test/AST/dump.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/dump.cpp?rev=352631&r1=352630&r2=352631&view=diff
> > ==============================================================================
> > --- cfe/trunk/test/AST/dump.cpp (original)
> > +++ cfe/trunk/test/AST/dump.cpp Wed Jan 30 07:41:20 2019
> > @@ -61,7 +61,7 @@ struct S {
> >  // CHECK-NEXT: |       | `-ImplicitCastExpr {{.+}} <col:78> 'int' <LValueToRValue>
> >  // CHECK-NEXT: |       |   `-DeclRefExpr {{.+}} <col:78> 'int' lvalue OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
> >  // CHECK-NEXT: |       `-CapturedStmt {{.+}} <line:[[@LINE-15]]:5, line:[[@LINE-14]]:9>
> > -// CHECK-NEXT: |         |-CapturedDecl {{.+}} <<invalid sloc>> <invalid sloc>
> > +// CHECK-NEXT: |         |-CapturedDecl {{.+}} <<invalid sloc>> <invalid sloc> nothrow
> >  // CHECK-NEXT: |         | |-ForStmt {{.+}} <line:[[@LINE-17]]:5, line:[[@LINE-16]]:9>
> >  // CHECK:      |         | | `-UnaryOperator {{.+}} <line:[[@LINE-17]]:7, col:9> 'int' lvalue prefix '++'
> >  // CHECK-NEXT: |         | |   `-DeclRefExpr {{.+}} <col:9> 'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &'
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list