[PATCH] D56708: NFC: Implement OMPClause dump in terms of visitors
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 15 12:35:26 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL351236: NFC: Implement OMPClause dump in terms of visitors (authored by steveire, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D56708?vs=181749&id=181856#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56708/new/
https://reviews.llvm.org/D56708
Files:
cfe/trunk/include/clang/AST/TextNodeDumper.h
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/TextNodeDumper.cpp
Index: cfe/trunk/lib/AST/TextNodeDumper.cpp
===================================================================
--- cfe/trunk/lib/AST/TextNodeDumper.cpp
+++ cfe/trunk/lib/AST/TextNodeDumper.cpp
@@ -272,6 +272,24 @@
}
}
+void TextNodeDumper::Visit(const OMPClause *C) {
+ if (!C) {
+ ColorScope Color(OS, ShowColors, NullColor);
+ OS << "<<<NULL>>> OMPClause";
+ return;
+ }
+ {
+ ColorScope Color(OS, ShowColors, AttrColor);
+ StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
+ OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
+ << ClauseName.drop_front() << "Clause";
+ }
+ dumpPointer(C);
+ dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
+ if (C->isImplicit())
+ OS << " <implicit>";
+}
+
void TextNodeDumper::dumpPointer(const void *Ptr) {
ColorScope Color(OS, ShowColors, AddressColor);
OS << ' ' << Ptr;
Index: cfe/trunk/lib/AST/ASTDumper.cpp
===================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp
+++ cfe/trunk/lib/AST/ASTDumper.cpp
@@ -292,6 +292,7 @@
void VisitCapturedStmt(const CapturedStmt *Node);
// OpenMP
+ void Visit(const OMPClause *C);
void VisitOMPExecutableDirective(const OMPExecutableDirective *Node);
// Exprs
@@ -1448,29 +1449,18 @@
// OpenMP dumping methods.
//===----------------------------------------------------------------------===//
+void ASTDumper::Visit(const OMPClause *C) {
+ dumpChild([=] {
+ NodeDumper.Visit(C);
+ for (auto *S : C->children())
+ dumpStmt(S);
+ });
+}
+
void ASTDumper::VisitOMPExecutableDirective(
const OMPExecutableDirective *Node) {
- for (auto *C : Node->clauses()) {
- dumpChild([=] {
- if (!C) {
- ColorScope Color(OS, ShowColors, NullColor);
- OS << "<<<NULL>>> OMPClause";
- return;
- }
- {
- ColorScope Color(OS, ShowColors, AttrColor);
- StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
- OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
- << ClauseName.drop_front() << "Clause";
- }
- NodeDumper.dumpPointer(C);
- NodeDumper.dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
- if (C->isImplicit())
- OS << " <implicit>";
- for (auto *S : C->children())
- dumpStmt(S);
- });
- }
+ for (const auto *C : Node->clauses())
+ Visit(C);
}
//===----------------------------------------------------------------------===//
Index: cfe/trunk/include/clang/AST/TextNodeDumper.h
===================================================================
--- cfe/trunk/include/clang/AST/TextNodeDumper.h
+++ cfe/trunk/include/clang/AST/TextNodeDumper.h
@@ -169,6 +169,8 @@
void Visit(const CXXCtorInitializer *Init);
+ void Visit(const OMPClause *C);
+
void dumpPointer(const void *Ptr);
void dumpLocation(SourceLocation Loc);
void dumpSourceRange(SourceRange R);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56708.181856.patch
Type: text/x-patch
Size: 2981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190115/da9a9715/attachment.bin>
More information about the cfe-commits
mailing list