Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/ast/prettyprinter.h

Issue 1869433004: Fix printf formats (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address review comments. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm64/simulator-arm64.h ('k') | src/ast/prettyprinter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_AST_PRETTYPRINTER_H_ 5 #ifndef V8_AST_PRETTYPRINTER_H_
6 #define V8_AST_PRETTYPRINTER_H_ 6 #define V8_AST_PRETTYPRINTER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/base/compiler-specific.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 class CallPrinter : public AstVisitor { 15 class CallPrinter : public AstVisitor {
15 public: 16 public:
16 explicit CallPrinter(Isolate* isolate, bool is_builtin); 17 explicit CallPrinter(Isolate* isolate, bool is_builtin);
17 virtual ~CallPrinter(); 18 virtual ~CallPrinter();
18 19
19 // The following routine prints the node with position |position| into a 20 // The following routine prints the node with position |position| into a
20 // string. The result string is alive as long as the CallPrinter is alive. 21 // string. The result string is alive as long as the CallPrinter is alive.
21 const char* Print(FunctionLiteral* program, int position); 22 const char* Print(FunctionLiteral* program, int position);
22 23
23 void Print(const char* format, ...); 24 void PRINTF_FORMAT(2, 3) Print(const char* format, ...);
24 25
25 void Find(AstNode* node, bool print = false); 26 void Find(AstNode* node, bool print = false);
26 27
27 // Individual nodes 28 // Individual nodes
28 #define DECLARE_VISIT(type) void Visit##type(type* node) override; 29 #define DECLARE_VISIT(type) void Visit##type(type* node) override;
29 AST_NODE_LIST(DECLARE_VISIT) 30 AST_NODE_LIST(DECLARE_VISIT)
30 #undef DECLARE_VISIT 31 #undef DECLARE_VISIT
31 32
32 private: 33 private:
33 void Init(); 34 void Init();
(...skipping 21 matching lines...) Expand all
55 public: 56 public:
56 explicit PrettyPrinter(Isolate* isolate); 57 explicit PrettyPrinter(Isolate* isolate);
57 virtual ~PrettyPrinter(); 58 virtual ~PrettyPrinter();
58 59
59 // The following routines print a node into a string. 60 // The following routines print a node into a string.
60 // The result string is alive as long as the PrettyPrinter is alive. 61 // The result string is alive as long as the PrettyPrinter is alive.
61 const char* Print(AstNode* node); 62 const char* Print(AstNode* node);
62 const char* PrintExpression(FunctionLiteral* program); 63 const char* PrintExpression(FunctionLiteral* program);
63 const char* PrintProgram(FunctionLiteral* program); 64 const char* PrintProgram(FunctionLiteral* program);
64 65
65 void Print(const char* format, ...); 66 void PRINTF_FORMAT(2, 3) Print(const char* format, ...);
66 67
67 // Print a node to stdout. 68 // Print a node to stdout.
68 static void PrintOut(Isolate* isolate, AstNode* node); 69 static void PrintOut(Isolate* isolate, AstNode* node);
69 70
70 // Individual nodes 71 // Individual nodes
71 #define DECLARE_VISIT(type) void Visit##type(type* node) override; 72 #define DECLARE_VISIT(type) void Visit##type(type* node) override;
72 AST_NODE_LIST(DECLARE_VISIT) 73 AST_NODE_LIST(DECLARE_VISIT)
73 #undef DECLARE_VISIT 74 #undef DECLARE_VISIT
74 75
75 private: 76 private:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 135
135 int indent_; 136 int indent_;
136 }; 137 };
137 138
138 #endif // DEBUG 139 #endif // DEBUG
139 140
140 } // namespace internal 141 } // namespace internal
141 } // namespace v8 142 } // namespace v8
142 143
143 #endif // V8_AST_PRETTYPRINTER_H_ 144 #endif // V8_AST_PRETTYPRINTER_H_
OLDNEW
« no previous file with comments | « src/arm64/simulator-arm64.h ('k') | src/ast/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698