[ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 30 Jan 2019 15:41:20 +0000 (15:41 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 30 Jan 2019 15:41:20 +0000 (15:41 +0000)
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

llvm-svn: 352631

clang/lib/AST/ASTDumper.cpp
clang/test/AST/dump.cpp

index fd0870d..369a2f1 100644 (file)
@@ -727,6 +727,8 @@ void ASTDumper::VisitPragmaDetectMismatchDecl(
 }
 
 void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
+  if (D->isNothrow())
+    OS << " nothrow";
   dumpStmt(D->getBody());
 }
 
index b460e93..d9ddca6 100644 (file)
@@ -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 &'