Skip to content

Commit e6e3c1c

Browse files
jurahulvinay-deshmukh
authored andcommitted
[NFC][LLVM] Code cleanup in RegionPrinter (llvm#166622)
- Fix indendation in header file. - Use namespace qualifiers for defining DOTGraphTraits.
1 parent b8ede38 commit e6e3c1c

File tree

2 files changed

+57
-58
lines changed

2 files changed

+57
-58
lines changed

llvm/include/llvm/Analysis/RegionPrinter.h

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -18,64 +18,64 @@
1818
#include "llvm/Support/DOTGraphTraits.h"
1919

2020
namespace llvm {
21-
class FunctionPass;
22-
class Function;
23-
class RegionInfo;
24-
class RegionNode;
21+
class FunctionPass;
22+
class Function;
23+
class RegionInfo;
24+
class RegionNode;
2525

26-
LLVM_ABI FunctionPass *createRegionViewerPass();
27-
LLVM_ABI FunctionPass *createRegionOnlyViewerPass();
28-
LLVM_ABI FunctionPass *createRegionPrinterPass();
29-
LLVM_ABI FunctionPass *createRegionOnlyPrinterPass();
26+
LLVM_ABI FunctionPass *createRegionViewerPass();
27+
LLVM_ABI FunctionPass *createRegionOnlyViewerPass();
28+
LLVM_ABI FunctionPass *createRegionPrinterPass();
29+
LLVM_ABI FunctionPass *createRegionOnlyPrinterPass();
3030

31-
template <>
32-
struct DOTGraphTraits<RegionNode *> : public DefaultDOTGraphTraits {
33-
DOTGraphTraits(bool isSimple = false) : DefaultDOTGraphTraits(isSimple) {}
31+
template <> struct DOTGraphTraits<RegionNode *> : public DefaultDOTGraphTraits {
32+
DOTGraphTraits(bool isSimple = false) : DefaultDOTGraphTraits(isSimple) {}
3433

35-
LLVM_ABI std::string getNodeLabel(RegionNode *Node, RegionNode *Graph);
36-
};
34+
LLVM_ABI std::string getNodeLabel(RegionNode *Node, RegionNode *Graph);
35+
};
3736

3837
#ifndef NDEBUG
39-
/// Open a viewer to display the GraphViz vizualization of the analysis
40-
/// result.
41-
///
42-
/// Practical to call in the debugger.
43-
/// Includes the instructions in each BasicBlock.
44-
///
45-
/// @param RI The analysis to display.
46-
void viewRegion(llvm::RegionInfo *RI);
38+
/// Open a viewer to display the GraphViz vizualization of the analysis
39+
/// result.
40+
///
41+
/// Practical to call in the debugger.
42+
/// Includes the instructions in each BasicBlock.
43+
///
44+
/// @param RI The analysis to display.
45+
void viewRegion(llvm::RegionInfo *RI);
4746

48-
/// Analyze the regions of a function and open its GraphViz
49-
/// visualization in a viewer.
50-
///
51-
/// Useful to call in the debugger.
52-
/// Includes the instructions in each BasicBlock.
53-
/// The result of a new analysis may differ from the RegionInfo the pass
54-
/// manager currently holds.
55-
///
56-
/// @param F Function to analyze.
57-
void viewRegion(const llvm::Function *F);
47+
/// Analyze the regions of a function and open its GraphViz
48+
/// visualization in a viewer.
49+
///
50+
/// Useful to call in the debugger.
51+
/// Includes the instructions in each BasicBlock.
52+
/// The result of a new analysis may differ from the RegionInfo the pass
53+
/// manager currently holds.
54+
///
55+
/// @param F Function to analyze.
56+
void viewRegion(const llvm::Function *F);
5857

59-
/// Open a viewer to display the GraphViz vizualization of the analysis
60-
/// result.
61-
///
62-
/// Useful to call in the debugger.
63-
/// Shows only the BasicBlock names without their instructions.
64-
///
65-
/// @param RI The analysis to display.
66-
void viewRegionOnly(llvm::RegionInfo *RI);
58+
/// Open a viewer to display the GraphViz vizualization of the analysis
59+
/// result.
60+
///
61+
/// Useful to call in the debugger.
62+
/// Shows only the BasicBlock names without their instructions.
63+
///
64+
/// @param RI The analysis to display.
65+
void viewRegionOnly(llvm::RegionInfo *RI);
6766

68-
/// Analyze the regions of a function and open its GraphViz
69-
/// visualization in a viewer.
70-
///
71-
/// Useful to call in the debugger.
72-
/// Shows only the BasicBlock names without their instructions.
73-
/// The result of a new analysis may differ from the RegionInfo the pass
74-
/// manager currently holds.
75-
///
76-
/// @param F Function to analyze.
77-
void viewRegionOnly(const llvm::Function *F);
78-
#endif
79-
} // End llvm namespace
67+
/// Analyze the regions of a function and open its GraphViz
68+
/// visualization in a viewer.
69+
///
70+
/// Useful to call in the debugger.
71+
/// Shows only the BasicBlock names without their instructions.
72+
/// The result of a new analysis may differ from the RegionInfo the pass
73+
/// manager currently holds.
74+
///
75+
/// @param F Function to analyze.
76+
void viewRegionOnly(const llvm::Function *F);
77+
#endif // NDEBUG
8078

81-
#endif
79+
} // namespace llvm
80+
81+
#endif // LLVM_ANALYSIS_REGIONPRINTER_H

llvm/lib/Analysis/RegionPrinter.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ onlySimpleRegions("only-simple-regions",
2929
cl::Hidden,
3030
cl::init(false));
3131

32-
namespace llvm {
33-
34-
std::string DOTGraphTraits<RegionNode *>::getNodeLabel(RegionNode *Node,
35-
RegionNode *Graph) {
32+
std::string
33+
llvm::DOTGraphTraits<RegionNode *>::getNodeLabel(RegionNode *Node,
34+
RegionNode *Graph) {
3635
if (!Node->isSubRegion()) {
3736
BasicBlock *BB = Node->getNodeAs<BasicBlock>();
3837

@@ -46,7 +45,8 @@ std::string DOTGraphTraits<RegionNode *>::getNodeLabel(RegionNode *Node,
4645
}
4746

4847
template <>
49-
struct DOTGraphTraits<RegionInfo *> : public DOTGraphTraits<RegionNode *> {
48+
struct DOTGraphTraits<RegionInfo *>
49+
: public llvm::DOTGraphTraits<RegionNode *> {
5050

5151
DOTGraphTraits (bool isSimple = false)
5252
: DOTGraphTraits<RegionNode*>(isSimple) {}
@@ -125,7 +125,6 @@ struct DOTGraphTraits<RegionInfo *> : public DOTGraphTraits<RegionNode *> {
125125
printRegionCluster(*G->getTopLevelRegion(), GW, 4);
126126
}
127127
};
128-
} // end namespace llvm
129128

130129
namespace {
131130

0 commit comments

Comments
 (0)