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

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


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";
   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 &'




More information about the cfe-commits mailing list