1 //===- ThreadSafetyTraverse.h -----------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines a framework for doing generic traversals and rewriting
11 // operations over the Thread Safety TIL.
13 // UNDER CONSTRUCTION. USE AT YOUR OWN RISK.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYTRAVERSE_H
18 #define LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYTRAVERSE_H
20 #include "clang/AST/Decl.h"
21 #include "clang/Analysis/Analyses/ThreadSafetyTIL.h"
22 #include "clang/Analysis/Analyses/ThreadSafetyUtil.h"
23 #include "clang/Basic/LLVM.h"
24 #include "llvm/ADT/StringRef.h"
25 #include "llvm/Support/Casting.h"
30 namespace threadSafety {
33 // Defines an interface used to traverse SExprs. Traversals have been made as
34 // generic as possible, and are intended to handle any kind of pass over the
35 // AST, e.g. visitors, copying, non-destructive rewriting, destructive
36 // (in-place) rewriting, hashing, typing, etc.
38 // Traversals implement the functional notion of a "fold" operation on SExprs.
39 // Each SExpr class provides a traverse method, which does the following:
41 // // compute a result r_i for each subexpression e_i
42 // for (i = 1..n) r_i = v.traverse(e_i);
43 // // combine results into a result for e, where X is the class of e
44 // return v.reduceX(*e, r_1, .. r_n).
46 // A visitor can control the traversal by overriding the following methods:
48 // return v.traverseByCase(e), which returns v.traverseX(e)
49 // * v.traverseX(e): (X is the class of e)
50 // return e->traverse(v).
51 // * v.reduceX(*e, r_1, .. r_n):
52 // compute a result for a node of type X
54 // The reduceX methods control the kind of traversal (visitor, copy, etc.).
55 // They are defined in derived classes.
57 // Class R defines the basic interface types (R_SExpr).
58 template <class Self, class R>
61 Self *self() { return static_cast<Self *>(this); }
63 // Traverse an expression -- returning a result of type R_SExpr.
64 // Override this method to do something for every expression, regardless
65 // of which kind it is.
66 // E is a reference, so this can be use for in-place updates.
67 // The type T must be a subclass of SExpr.
69 typename R::R_SExpr traverse(T* &E, typename R::R_Ctx Ctx) {
70 return traverseSExpr(E, Ctx);
73 // Override this method to do something for every expression.
74 // Does not allow in-place updates.
75 typename R::R_SExpr traverseSExpr(SExpr *E, typename R::R_Ctx Ctx) {
76 return traverseByCase(E, Ctx);
79 // Helper method to call traverseX(e) on the appropriate type.
80 typename R::R_SExpr traverseByCase(SExpr *E, typename R::R_Ctx Ctx) {
81 switch (E->opcode()) {
82 #define TIL_OPCODE_DEF(X) \
84 return self()->traverse##X(cast<X>(E), Ctx);
85 #include "ThreadSafetyOps.def"
88 return self()->reduceNull();
91 // Traverse e, by static dispatch on the type "X" of e.
92 // Override these methods to do something for a particular kind of term.
93 #define TIL_OPCODE_DEF(X) \
94 typename R::R_SExpr traverse##X(X *e, typename R::R_Ctx Ctx) { \
95 return e->traverse(*self(), Ctx); \
97 #include "ThreadSafetyOps.def"
101 // Base class for simple reducers that don't much care about the context.
102 class SimpleReducerBase {
105 // Ordinary subexpressions.
108 // Declarations (e.g. function bodies).
111 // Expressions that require lazy evaluation.
118 // R_Ctx defines a "context" for the traversal, which encodes information
119 // about where a term appears. This can be used to encoding the
120 // "current continuation" for CPS transforms, or other information.
121 using R_Ctx = TraversalKind;
123 // Create context for an ordinary subexpression.
124 R_Ctx subExprCtx(R_Ctx Ctx) { return TRV_Normal; }
126 // Create context for a subexpression that occurs in a declaration position
127 // (e.g. function body).
128 R_Ctx declCtx(R_Ctx Ctx) { return TRV_Decl; }
130 // Create context for a subexpression that occurs in a position that
131 // should be reduced lazily. (e.g. code body).
132 R_Ctx lazyCtx(R_Ctx Ctx) { return TRV_Lazy; }
134 // Create context for a subexpression that occurs in a type position.
135 R_Ctx typeCtx(R_Ctx Ctx) { return TRV_Type; }
138 // Base class for traversals that rewrite an SExpr to another SExpr.
139 class CopyReducerBase : public SimpleReducerBase {
141 // R_SExpr is the result type for a traversal.
142 // A copy or non-destructive rewrite returns a newly allocated term.
143 using R_SExpr = SExpr *;
144 using R_BasicBlock = BasicBlock *;
146 // Container is a minimal interface used to store results when traversing
147 // SExprs of variable arity, such as Phi, Goto, and SCFG.
148 template <class T> class Container {
150 // Allocate a new container with a capacity for n elements.
151 Container(CopyReducerBase &S, unsigned N) : Elems(S.Arena, N) {}
153 // Push a new element onto the container.
154 void push_back(T E) { Elems.push_back(E); }
156 SimpleArray<T> Elems;
159 CopyReducerBase(MemRegionRef A) : Arena(A) {}
165 // Base class for visit traversals.
166 class VisitReducerBase : public SimpleReducerBase {
168 // A visitor returns a bool, representing success or failure.
169 using R_SExpr = bool;
170 using R_BasicBlock = bool;
172 // A visitor "container" is a single bool, which accumulates success.
173 template <class T> class Container {
177 Container(VisitReducerBase &S, unsigned N) {}
179 void push_back(bool E) { Success = Success && E; }
183 // Implements a traversal that visits each subexpression, and returns either
185 template <class Self>
186 class VisitReducer : public Traversal<Self, VisitReducerBase>,
187 public VisitReducerBase {
189 VisitReducer() = default;
192 R_SExpr reduceNull() { return true; }
193 R_SExpr reduceUndefined(Undefined &Orig) { return true; }
194 R_SExpr reduceWildcard(Wildcard &Orig) { return true; }
196 R_SExpr reduceLiteral(Literal &Orig) { return true; }
198 R_SExpr reduceLiteralT(LiteralT<T> &Orig) { return true; }
199 R_SExpr reduceLiteralPtr(Literal &Orig) { return true; }
201 R_SExpr reduceFunction(Function &Orig, Variable *Nvd, R_SExpr E0) {
205 R_SExpr reduceSFunction(SFunction &Orig, Variable *Nvd, R_SExpr E0) {
209 R_SExpr reduceCode(Code &Orig, R_SExpr E0, R_SExpr E1) {
213 R_SExpr reduceField(Field &Orig, R_SExpr E0, R_SExpr E1) {
217 R_SExpr reduceApply(Apply &Orig, R_SExpr E0, R_SExpr E1) {
221 R_SExpr reduceSApply(SApply &Orig, R_SExpr E0, R_SExpr E1) {
225 R_SExpr reduceProject(Project &Orig, R_SExpr E0) { return E0; }
226 R_SExpr reduceCall(Call &Orig, R_SExpr E0) { return E0; }
227 R_SExpr reduceAlloc(Alloc &Orig, R_SExpr E0) { return E0; }
228 R_SExpr reduceLoad(Load &Orig, R_SExpr E0) { return E0; }
229 R_SExpr reduceStore(Store &Orig, R_SExpr E0, R_SExpr E1) { return E0 && E1; }
231 R_SExpr reduceArrayIndex(Store &Orig, R_SExpr E0, R_SExpr E1) {
235 R_SExpr reduceArrayAdd(Store &Orig, R_SExpr E0, R_SExpr E1) {
239 R_SExpr reduceUnaryOp(UnaryOp &Orig, R_SExpr E0) { return E0; }
241 R_SExpr reduceBinaryOp(BinaryOp &Orig, R_SExpr E0, R_SExpr E1) {
245 R_SExpr reduceCast(Cast &Orig, R_SExpr E0) { return E0; }
247 R_SExpr reduceSCFG(SCFG &Orig, Container<BasicBlock *> Bbs) {
251 R_BasicBlock reduceBasicBlock(BasicBlock &Orig, Container<R_SExpr> &As,
252 Container<R_SExpr> &Is, R_SExpr T) {
253 return (As.Success && Is.Success && T);
256 R_SExpr reducePhi(Phi &Orig, Container<R_SExpr> &As) {
260 R_SExpr reduceGoto(Goto &Orig, BasicBlock *B) {
264 R_SExpr reduceBranch(Branch &O, R_SExpr C, BasicBlock *B0, BasicBlock *B1) {
268 R_SExpr reduceReturn(Return &O, R_SExpr E) {
272 R_SExpr reduceIdentifier(Identifier &Orig) {
276 R_SExpr reduceIfThenElse(IfThenElse &Orig, R_SExpr C, R_SExpr T, R_SExpr E) {
280 R_SExpr reduceLet(Let &Orig, Variable *Nvd, R_SExpr B) {
284 Variable *enterScope(Variable &Orig, R_SExpr E0) { return &Orig; }
285 void exitScope(const Variable &Orig) {}
286 void enterCFG(SCFG &Cfg) {}
287 void exitCFG(SCFG &Cfg) {}
288 void enterBasicBlock(BasicBlock &BB) {}
289 void exitBasicBlock(BasicBlock &BB) {}
291 Variable *reduceVariableRef(Variable *Ovd) { return Ovd; }
292 BasicBlock *reduceBasicBlockRef(BasicBlock *Obb) { return Obb; }
295 bool traverse(SExpr *E, TraversalKind K = TRV_Normal) {
296 Success = Success && this->traverseByCase(E);
300 static bool visit(SExpr *E) {
302 return Visitor.traverse(E, TRV_Normal);
309 // Basic class for comparison operations over expressions.
310 template <typename Self>
313 Self *self() { return reinterpret_cast<Self *>(this); }
316 bool compareByCase(const SExpr *E1, const SExpr* E2) {
317 switch (E1->opcode()) {
318 #define TIL_OPCODE_DEF(X) \
320 return cast<X>(E1)->compare(cast<X>(E2), *self());
321 #include "ThreadSafetyOps.def"
322 #undef TIL_OPCODE_DEF
328 class EqualsComparator : public Comparator<EqualsComparator> {
330 // Result type for the comparison, e.g. bool for simple equality,
331 // or int for lexigraphic comparison (-1, 0, 1). Must have one value which
335 CType trueResult() { return true; }
336 bool notTrue(CType ct) { return !ct; }
338 bool compareIntegers(unsigned i, unsigned j) { return i == j; }
339 bool compareStrings (StringRef s, StringRef r) { return s == r; }
340 bool comparePointers(const void* P, const void* Q) { return P == Q; }
342 bool compare(const SExpr *E1, const SExpr* E2) {
343 if (E1->opcode() != E2->opcode())
345 return compareByCase(E1, E2);
348 // TODO -- handle alpha-renaming of variables
349 void enterScope(const Variable *V1, const Variable *V2) {}
352 bool compareVariableRefs(const Variable *V1, const Variable *V2) {
356 static bool compareExprs(const SExpr *E1, const SExpr* E2) {
358 return Eq.compare(E1, E2);
362 class MatchComparator : public Comparator<MatchComparator> {
364 // Result type for the comparison, e.g. bool for simple equality,
365 // or int for lexigraphic comparison (-1, 0, 1). Must have one value which
369 CType trueResult() { return true; }
370 bool notTrue(CType ct) { return !ct; }
372 bool compareIntegers(unsigned i, unsigned j) { return i == j; }
373 bool compareStrings (StringRef s, StringRef r) { return s == r; }
374 bool comparePointers(const void *P, const void *Q) { return P == Q; }
376 bool compare(const SExpr *E1, const SExpr *E2) {
377 // Wildcards match anything.
378 if (E1->opcode() == COP_Wildcard || E2->opcode() == COP_Wildcard)
380 // otherwise normal equality.
381 if (E1->opcode() != E2->opcode())
383 return compareByCase(E1, E2);
386 // TODO -- handle alpha-renaming of variables
387 void enterScope(const Variable* V1, const Variable* V2) {}
390 bool compareVariableRefs(const Variable* V1, const Variable* V2) {
394 static bool compareExprs(const SExpr *E1, const SExpr* E2) {
395 MatchComparator Matcher;
396 return Matcher.compare(E1, E2);
400 // inline std::ostream& operator<<(std::ostream& SS, StringRef R) {
401 // return SS.write(R.data(), R.size());
404 // Pretty printer for TIL expressions
405 template <typename Self, typename StreamType>
406 class PrettyPrinter {
408 // Print out additional information.
411 // Omit redundant decls.
414 // Print exprs in C-like syntax.
418 PrettyPrinter(bool V = false, bool C = true, bool CS = true)
419 : Verbose(V), Cleanup(C), CStyle(CS) {}
421 static void print(const SExpr *E, StreamType &SS) {
423 printer.printSExpr(E, SS, Prec_MAX);
427 Self *self() { return reinterpret_cast<Self *>(this); }
429 void newline(StreamType &SS) {
433 // TODO: further distinguish between binary operations.
434 static const unsigned Prec_Atom = 0;
435 static const unsigned Prec_Postfix = 1;
436 static const unsigned Prec_Unary = 2;
437 static const unsigned Prec_Binary = 3;
438 static const unsigned Prec_Other = 4;
439 static const unsigned Prec_Decl = 5;
440 static const unsigned Prec_MAX = 6;
442 // Return the precedence of a given node, for use in pretty printing.
443 unsigned precedence(const SExpr *E) {
444 switch (E->opcode()) {
445 case COP_Future: return Prec_Atom;
446 case COP_Undefined: return Prec_Atom;
447 case COP_Wildcard: return Prec_Atom;
449 case COP_Literal: return Prec_Atom;
450 case COP_LiteralPtr: return Prec_Atom;
451 case COP_Variable: return Prec_Atom;
452 case COP_Function: return Prec_Decl;
453 case COP_SFunction: return Prec_Decl;
454 case COP_Code: return Prec_Decl;
455 case COP_Field: return Prec_Decl;
457 case COP_Apply: return Prec_Postfix;
458 case COP_SApply: return Prec_Postfix;
459 case COP_Project: return Prec_Postfix;
461 case COP_Call: return Prec_Postfix;
462 case COP_Alloc: return Prec_Other;
463 case COP_Load: return Prec_Postfix;
464 case COP_Store: return Prec_Other;
465 case COP_ArrayIndex: return Prec_Postfix;
466 case COP_ArrayAdd: return Prec_Postfix;
468 case COP_UnaryOp: return Prec_Unary;
469 case COP_BinaryOp: return Prec_Binary;
470 case COP_Cast: return Prec_Atom;
472 case COP_SCFG: return Prec_Decl;
473 case COP_BasicBlock: return Prec_MAX;
474 case COP_Phi: return Prec_Atom;
475 case COP_Goto: return Prec_Atom;
476 case COP_Branch: return Prec_Atom;
477 case COP_Return: return Prec_Other;
479 case COP_Identifier: return Prec_Atom;
480 case COP_IfThenElse: return Prec_Other;
481 case COP_Let: return Prec_Decl;
486 void printBlockLabel(StreamType & SS, const BasicBlock *BB, int index) {
499 void printSExpr(const SExpr *E, StreamType &SS, unsigned P, bool Sub=true) {
501 self()->printNull(SS);
504 if (Sub && E->block() && E->opcode() != COP_Variable) {
505 SS << "_x" << E->id();
508 if (self()->precedence(E) > P) {
509 // Wrap expr in () if necessary.
511 self()->printSExpr(E, SS, Prec_MAX);
516 switch (E->opcode()) {
517 #define TIL_OPCODE_DEF(X) \
519 self()->print##X(cast<X>(E), SS); \
521 #include "ThreadSafetyOps.def"
522 #undef TIL_OPCODE_DEF
526 void printNull(StreamType &SS) {
530 void printFuture(const Future *E, StreamType &SS) {
531 self()->printSExpr(E->maybeGetResult(), SS, Prec_Atom);
534 void printUndefined(const Undefined *E, StreamType &SS) {
538 void printWildcard(const Wildcard *E, StreamType &SS) {
543 void printLiteralT(const LiteralT<T> *E, StreamType &SS) {
547 void printLiteralT(const LiteralT<uint8_t> *E, StreamType &SS) {
548 SS << "'" << E->value() << "'";
551 void printLiteral(const Literal *E, StreamType &SS) {
552 if (E->clangExpr()) {
553 SS << getSourceLiteralString(E->clangExpr());
557 ValueType VT = E->valueType();
559 case ValueType::BT_Void:
562 case ValueType::BT_Bool:
563 if (E->as<bool>().value())
568 case ValueType::BT_Int:
570 case ValueType::ST_8:
572 printLiteralT(&E->as<int8_t>(), SS);
574 printLiteralT(&E->as<uint8_t>(), SS);
576 case ValueType::ST_16:
578 printLiteralT(&E->as<int16_t>(), SS);
580 printLiteralT(&E->as<uint16_t>(), SS);
582 case ValueType::ST_32:
584 printLiteralT(&E->as<int32_t>(), SS);
586 printLiteralT(&E->as<uint32_t>(), SS);
588 case ValueType::ST_64:
590 printLiteralT(&E->as<int64_t>(), SS);
592 printLiteralT(&E->as<uint64_t>(), SS);
598 case ValueType::BT_Float:
600 case ValueType::ST_32:
601 printLiteralT(&E->as<float>(), SS);
603 case ValueType::ST_64:
604 printLiteralT(&E->as<double>(), SS);
610 case ValueType::BT_String:
612 printLiteralT(&E->as<StringRef>(), SS);
615 case ValueType::BT_Pointer:
618 case ValueType::BT_ValueRef:
626 void printLiteralPtr(const LiteralPtr *E, StreamType &SS) {
627 SS << E->clangDecl()->getNameAsString();
630 void printVariable(const Variable *V, StreamType &SS, bool IsVarDecl=false) {
631 if (CStyle && V->kind() == Variable::VK_SFun)
634 SS << V->name() << V->id();
637 void printFunction(const Function *E, StreamType &SS, unsigned sugared = 0) {
640 SS << "\\("; // Lambda
643 SS << "("; // Slot declarations
646 SS << ", "; // Curried functions
649 self()->printVariable(E->variableDecl(), SS, true);
651 self()->printSExpr(E->variableDecl()->definition(), SS, Prec_MAX);
653 const SExpr *B = E->body();
654 if (B && B->opcode() == COP_Function)
655 self()->printFunction(cast<Function>(B), SS, 2);
658 self()->printSExpr(B, SS, Prec_Decl);
662 void printSFunction(const SFunction *E, StreamType &SS) {
664 self()->printVariable(E->variableDecl(), SS, true);
666 self()->printSExpr(E->body(), SS, Prec_Decl);
669 void printCode(const Code *E, StreamType &SS) {
671 self()->printSExpr(E->returnType(), SS, Prec_Decl-1);
673 self()->printSExpr(E->body(), SS, Prec_Decl);
676 void printField(const Field *E, StreamType &SS) {
678 self()->printSExpr(E->range(), SS, Prec_Decl-1);
680 self()->printSExpr(E->body(), SS, Prec_Decl);
683 void printApply(const Apply *E, StreamType &SS, bool sugared = false) {
684 const SExpr *F = E->fun();
685 if (F->opcode() == COP_Apply) {
686 printApply(cast<Apply>(F), SS, true);
689 self()->printSExpr(F, SS, Prec_Postfix);
692 self()->printSExpr(E->arg(), SS, Prec_MAX);
697 void printSApply(const SApply *E, StreamType &SS) {
698 self()->printSExpr(E->sfun(), SS, Prec_Postfix);
699 if (E->isDelegation()) {
701 self()->printSExpr(E->arg(), SS, Prec_MAX);
706 void printProject(const Project *E, StreamType &SS) {
709 if (const auto *SAP = dyn_cast<SApply>(E->record())) {
710 if (const auto *V = dyn_cast<Variable>(SAP->sfun())) {
711 if (!SAP->isDelegation() && V->kind() == Variable::VK_SFun) {
717 if (isa<Wildcard>(E->record())) {
718 // handle existentials
720 SS << E->clangDecl()->getQualifiedNameAsString();
724 self()->printSExpr(E->record(), SS, Prec_Postfix);
725 if (CStyle && E->isArrow())
732 void printCall(const Call *E, StreamType &SS) {
733 const SExpr *T = E->target();
734 if (T->opcode() == COP_Apply) {
735 self()->printApply(cast<Apply>(T), SS, true);
739 self()->printSExpr(T, SS, Prec_Postfix);
744 void printAlloc(const Alloc *E, StreamType &SS) {
746 self()->printSExpr(E->dataType(), SS, Prec_Other-1);
749 void printLoad(const Load *E, StreamType &SS) {
750 self()->printSExpr(E->pointer(), SS, Prec_Postfix);
755 void printStore(const Store *E, StreamType &SS) {
756 self()->printSExpr(E->destination(), SS, Prec_Other-1);
758 self()->printSExpr(E->source(), SS, Prec_Other-1);
761 void printArrayIndex(const ArrayIndex *E, StreamType &SS) {
762 self()->printSExpr(E->array(), SS, Prec_Postfix);
764 self()->printSExpr(E->index(), SS, Prec_MAX);
768 void printArrayAdd(const ArrayAdd *E, StreamType &SS) {
769 self()->printSExpr(E->array(), SS, Prec_Postfix);
771 self()->printSExpr(E->index(), SS, Prec_Atom);
774 void printUnaryOp(const UnaryOp *E, StreamType &SS) {
775 SS << getUnaryOpcodeString(E->unaryOpcode());
776 self()->printSExpr(E->expr(), SS, Prec_Unary);
779 void printBinaryOp(const BinaryOp *E, StreamType &SS) {
780 self()->printSExpr(E->expr0(), SS, Prec_Binary-1);
781 SS << " " << getBinaryOpcodeString(E->binaryOpcode()) << " ";
782 self()->printSExpr(E->expr1(), SS, Prec_Binary-1);
785 void printCast(const Cast *E, StreamType &SS) {
788 switch (E->castOpcode()) {
809 self()->printSExpr(E->expr(), SS, Prec_Unary);
813 self()->printSExpr(E->expr(), SS, Prec_Unary);
816 void printSCFG(const SCFG *E, StreamType &SS) {
818 for (const auto *BBI : *E)
819 printBasicBlock(BBI, SS);
824 void printBBInstr(const SExpr *E, StreamType &SS) {
826 if (E->opcode() == COP_Variable) {
827 const auto *V = cast<Variable>(E);
828 SS << "let " << V->name() << V->id() << " = ";
832 else if (E->opcode() != COP_Store) {
833 SS << "let _x" << E->id() << " = ";
835 self()->printSExpr(E, SS, Prec_MAX, Sub);
840 void printBasicBlock(const BasicBlock *E, StreamType &SS) {
841 SS << "BB_" << E->blockID() << ":";
843 SS << " BB_" << E->parent()->blockID();
846 for (const auto *A : E->arguments())
849 for (const auto *I : E->instructions())
852 const SExpr *T = E->terminator();
854 self()->printSExpr(T, SS, Prec_MAX, false);
861 void printPhi(const Phi *E, StreamType &SS) {
863 if (E->status() == Phi::PH_SingleVal)
864 self()->printSExpr(E->values()[0], SS, Prec_MAX);
867 for (const auto *V : E->values()) {
870 self()->printSExpr(V, SS, Prec_MAX);
876 void printGoto(const Goto *E, StreamType &SS) {
878 printBlockLabel(SS, E->targetBlock(), E->index());
881 void printBranch(const Branch *E, StreamType &SS) {
883 self()->printSExpr(E->condition(), SS, Prec_MAX);
885 printBlockLabel(SS, E->thenBlock(), -1);
887 printBlockLabel(SS, E->elseBlock(), -1);
890 void printReturn(const Return *E, StreamType &SS) {
892 self()->printSExpr(E->returnValue(), SS, Prec_Other);
895 void printIdentifier(const Identifier *E, StreamType &SS) {
899 void printIfThenElse(const IfThenElse *E, StreamType &SS) {
901 printSExpr(E->condition(), SS, Prec_Unary);
903 printSExpr(E->thenExpr(), SS, Prec_Unary);
905 printSExpr(E->elseExpr(), SS, Prec_Unary);
909 printSExpr(E->condition(), SS, Prec_MAX);
911 printSExpr(E->thenExpr(), SS, Prec_Other);
913 printSExpr(E->elseExpr(), SS, Prec_Other);
916 void printLet(const Let *E, StreamType &SS) {
918 printVariable(E->variableDecl(), SS, true);
920 printSExpr(E->variableDecl()->definition(), SS, Prec_Decl-1);
922 printSExpr(E->body(), SS, Prec_Decl-1);
926 class StdPrinter : public PrettyPrinter<StdPrinter, std::ostream> {};
929 } // namespace threadSafety
932 #endif // LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYTRAVERSE_H