-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[NFC][LLVM] Code cleanup in RegionPrinter #166622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
jurahul
commented
Nov 5, 2025
- Fix indendation in header file.
- Use namespace qualifiers for defining DOTGraphTraits.
- Fix indendation in header file. - Use namespace qualifiers for defining DOTGraphTraits.
|
@llvm/pr-subscribers-llvm-analysis Author: Rahul Joshi (jurahul) Changes
Full diff: https://github.com/llvm/llvm-project/pull/166622.diff 2 Files Affected:
diff --git a/llvm/include/llvm/Analysis/RegionPrinter.h b/llvm/include/llvm/Analysis/RegionPrinter.h
index 3a1d11d8fd4bc..1d4ba0fd4ebc6 100644
--- a/llvm/include/llvm/Analysis/RegionPrinter.h
+++ b/llvm/include/llvm/Analysis/RegionPrinter.h
@@ -18,64 +18,64 @@
#include "llvm/Support/DOTGraphTraits.h"
namespace llvm {
- class FunctionPass;
- class Function;
- class RegionInfo;
- class RegionNode;
+class FunctionPass;
+class Function;
+class RegionInfo;
+class RegionNode;
- LLVM_ABI FunctionPass *createRegionViewerPass();
- LLVM_ABI FunctionPass *createRegionOnlyViewerPass();
- LLVM_ABI FunctionPass *createRegionPrinterPass();
- LLVM_ABI FunctionPass *createRegionOnlyPrinterPass();
+LLVM_ABI FunctionPass *createRegionViewerPass();
+LLVM_ABI FunctionPass *createRegionOnlyViewerPass();
+LLVM_ABI FunctionPass *createRegionPrinterPass();
+LLVM_ABI FunctionPass *createRegionOnlyPrinterPass();
- template <>
- struct DOTGraphTraits<RegionNode *> : public DefaultDOTGraphTraits {
- DOTGraphTraits(bool isSimple = false) : DefaultDOTGraphTraits(isSimple) {}
+template <> struct DOTGraphTraits<RegionNode *> : public DefaultDOTGraphTraits {
+ DOTGraphTraits(bool isSimple = false) : DefaultDOTGraphTraits(isSimple) {}
- LLVM_ABI std::string getNodeLabel(RegionNode *Node, RegionNode *Graph);
- };
+ LLVM_ABI std::string getNodeLabel(RegionNode *Node, RegionNode *Graph);
+};
#ifndef NDEBUG
- /// Open a viewer to display the GraphViz vizualization of the analysis
- /// result.
- ///
- /// Practical to call in the debugger.
- /// Includes the instructions in each BasicBlock.
- ///
- /// @param RI The analysis to display.
- void viewRegion(llvm::RegionInfo *RI);
+/// Open a viewer to display the GraphViz vizualization of the analysis
+/// result.
+///
+/// Practical to call in the debugger.
+/// Includes the instructions in each BasicBlock.
+///
+/// @param RI The analysis to display.
+void viewRegion(llvm::RegionInfo *RI);
- /// Analyze the regions of a function and open its GraphViz
- /// visualization in a viewer.
- ///
- /// Useful to call in the debugger.
- /// Includes the instructions in each BasicBlock.
- /// The result of a new analysis may differ from the RegionInfo the pass
- /// manager currently holds.
- ///
- /// @param F Function to analyze.
- void viewRegion(const llvm::Function *F);
+/// Analyze the regions of a function and open its GraphViz
+/// visualization in a viewer.
+///
+/// Useful to call in the debugger.
+/// Includes the instructions in each BasicBlock.
+/// The result of a new analysis may differ from the RegionInfo the pass
+/// manager currently holds.
+///
+/// @param F Function to analyze.
+void viewRegion(const llvm::Function *F);
- /// Open a viewer to display the GraphViz vizualization of the analysis
- /// result.
- ///
- /// Useful to call in the debugger.
- /// Shows only the BasicBlock names without their instructions.
- ///
- /// @param RI The analysis to display.
- void viewRegionOnly(llvm::RegionInfo *RI);
+/// Open a viewer to display the GraphViz vizualization of the analysis
+/// result.
+///
+/// Useful to call in the debugger.
+/// Shows only the BasicBlock names without their instructions.
+///
+/// @param RI The analysis to display.
+void viewRegionOnly(llvm::RegionInfo *RI);
- /// Analyze the regions of a function and open its GraphViz
- /// visualization in a viewer.
- ///
- /// Useful to call in the debugger.
- /// Shows only the BasicBlock names without their instructions.
- /// The result of a new analysis may differ from the RegionInfo the pass
- /// manager currently holds.
- ///
- /// @param F Function to analyze.
- void viewRegionOnly(const llvm::Function *F);
-#endif
-} // End llvm namespace
+/// Analyze the regions of a function and open its GraphViz
+/// visualization in a viewer.
+///
+/// Useful to call in the debugger.
+/// Shows only the BasicBlock names without their instructions.
+/// The result of a new analysis may differ from the RegionInfo the pass
+/// manager currently holds.
+///
+/// @param F Function to analyze.
+void viewRegionOnly(const llvm::Function *F);
+#endif // NDEBUG
-#endif
+} // namespace llvm
+
+#endif // LLVM_ANALYSIS_REGIONPRINTER_H
diff --git a/llvm/lib/Analysis/RegionPrinter.cpp b/llvm/lib/Analysis/RegionPrinter.cpp
index a83af4ebb430e..39080f51f012e 100644
--- a/llvm/lib/Analysis/RegionPrinter.cpp
+++ b/llvm/lib/Analysis/RegionPrinter.cpp
@@ -29,10 +29,9 @@ onlySimpleRegions("only-simple-regions",
cl::Hidden,
cl::init(false));
-namespace llvm {
-
-std::string DOTGraphTraits<RegionNode *>::getNodeLabel(RegionNode *Node,
- RegionNode *Graph) {
+std::string
+llvm::DOTGraphTraits<RegionNode *>::getNodeLabel(RegionNode *Node,
+ RegionNode *Graph) {
if (!Node->isSubRegion()) {
BasicBlock *BB = Node->getNodeAs<BasicBlock>();
@@ -46,7 +45,8 @@ std::string DOTGraphTraits<RegionNode *>::getNodeLabel(RegionNode *Node,
}
template <>
-struct DOTGraphTraits<RegionInfo *> : public DOTGraphTraits<RegionNode *> {
+struct DOTGraphTraits<RegionInfo *>
+ : public llvm::DOTGraphTraits<RegionNode *> {
DOTGraphTraits (bool isSimple = false)
: DOTGraphTraits<RegionNode*>(isSimple) {}
@@ -125,7 +125,6 @@ struct DOTGraphTraits<RegionInfo *> : public DOTGraphTraits<RegionNode *> {
printRegionCluster(*G->getTopLevelRegion(), GW, 4);
}
};
-} // end namespace llvm
namespace {
|
kazutakahirata
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
|
Not sure how that passed the tests, but this caused a build error for me which I fixed directly on main. |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/39523 Here is the relevant piece of the build log for the reference |
Yeah, I am not sure as well, but thanks for fixing it. |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/33/builds/26068 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/28345 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/27136 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/204/builds/27157 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/27996 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/27856 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/217/builds/2019 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/92/builds/26977 Here is the relevant piece of the build log for the reference |
- Fix indendation in header file. - Use namespace qualifiers for defining DOTGraphTraits.
Fixes: 2a2d749 ("[NFC][LLVM] Code cleanup in RegionPrinter (llvm#166622)") commit-id:552ef7cb