[llvm] Draft: LLVMContext API to print single SyncScope ID (PR #109484)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 14:56:48 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 24b6b82487f15dd9d6cbe8a716dd13a6808a2528 1eb371dc4447ccb6f34eddc18479cf1338e7553c --extensions h,cpp -- llvm/include/llvm/IR/LLVMContext.h llvm/lib/IR/LLVMContext.cpp llvm/lib/IR/LLVMContextImpl.cpp llvm/lib/IR/LLVMContextImpl.h llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp llvm/lib/Target/NVPTX/NVPTX.h llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.h llvm/lib/Target/NVPTX/NVPTXReplaceImageHandles.cpp llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp llvm/lib/Target/NVPTX/NVPTXSubtarget.h llvm/lib/Target/NVPTX/NVPTXUtilities.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/IR/LLVMContext.h b/llvm/include/llvm/IR/LLVMContext.h
index 19f6a91392..8d60fb74a8 100644
--- a/llvm/include/llvm/IR/LLVMContext.h
+++ b/llvm/include/llvm/IR/LLVMContext.h
@@ -133,7 +133,7 @@ public:
   /// getSyncScopeName - Returns the name of a SyncScope::ID
   /// registered with LLVMContext, if any.
   std::optional<StringRef> getSyncScopeName(SyncScope::ID Id) const;
-  
+
   /// Define the GC for a function
   void setGC(const Function &Fn, std::string GCName);
 
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index 424a04ba96..f2c965a45d 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -244,9 +244,11 @@ void LLVMContextImpl::getSyncScopeNames(
     SSNs[SSE.second] = SSE.first();
 }
 
-std::optional<StringRef> LLVMContextImpl::getSyncScopeName(SyncScope::ID Id) const {
+std::optional<StringRef>
+LLVMContextImpl::getSyncScopeName(SyncScope::ID Id) const {
   for (const auto &SSE : SSC) {
-    if (SSE.second != Id) continue;
+    if (SSE.second != Id)
+      continue;
     return SSE.first();
   }
   return std::nullopt;
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index a80fb39ce2..971091f304 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -1668,7 +1668,7 @@ public:
   /// getSyncScopeName - Returns the name of a SyncScope::ID
   /// registered with LLVMContext, if any.
   std::optional<StringRef> getSyncScopeName(SyncScope::ID Id) const;
-  
+
   /// Maintain the GC name for each function.
   ///
   /// This saves allocating an additional word in Function for programs which
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
index 3c9ca18710..7ce4c2e9da 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
@@ -4191,9 +4191,9 @@ NVPTX::Scope NVPTXScopes::operator[](SyncScope::ID ID) const {
 
   auto S = Scopes.find(ID);
   if (S == Scopes.end())
-    report_fatal_error(
-        formatv("Could not find scope ID={} with name \"{}\".", int(ID),
-		CTX->getSyncScopeName(ID).value_or("unknown")));
+    report_fatal_error(formatv("Could not find scope ID={} with name \"{}\".",
+                               int(ID),
+                               CTX->getSyncScopeName(ID).value_or("unknown")));
 
   return S->second;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/109484


More information about the llvm-commits mailing list