[PATCH] D57452: [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 30 07:32:22 PST 2019
lebedev.ri created this revision.
lebedev.ri added reviewers: aaron.ballman, steveire.
lebedev.ri added projects: OpenMP, clang.
Herald added a subscriber: guansong.
Was trying to understand how complicated it would be to write
a clang-tidy `openmp-exception-escape`-ish check once D57100 <https://reviews.llvm.org/D57100> lands.
Just so it happens, all the data is already there,
it is just conveniently omitted from AST dump.
Repository:
rC Clang
https://reviews.llvm.org/D57452
Files:
lib/AST/ASTDumper.cpp
test/AST/dump.cpp
Index: test/AST/dump.cpp
===================================================================
--- test/AST/dump.cpp
+++ test/AST/dump.cpp
@@ -61,7 +61,7 @@
// 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 &'
Index: lib/AST/ASTDumper.cpp
===================================================================
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -727,6 +727,8 @@
}
void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
+ if (D->isNothrow())
+ OS << " nothrow";
dumpStmt(D->getBody());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57452.184298.patch
Type: text/x-patch
Size: 1229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190130/2f7bc43f/attachment-0001.bin>
More information about the cfe-commits
mailing list