[llvm] [Mips] Fix clang integrated assembler generates incorrect relocations… (PR #83115)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 01:59:38 PST 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 f40ee6e83f263fc4240c5b8d31a7e0e148a28cf6 b7015a9b578b5dc81ac5100c389e71c977cb7a69 -- llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index f9f6704230..279216b7cb 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -2932,27 +2932,32 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
       if (HasParseRdata == false) {
         StringRef CurrentASMContent = StringRef(IDLoc.getPointer());
 
-        //Get local symbol name LocalSymbol from "la $number, localsymbolname\n ... "
+        // Get local symbol name LocalSymbol from "la $number, localsymbolname\n
+        // ... "
         size_t NewlineIndex = CurrentASMContent.find_first_of('\n');
         size_t CommaIndex = CurrentASMContent.find_first_of(',');
         size_t SymbolLength = NewlineIndex - CommaIndex - 2;
-        StringRef LocalSymbol =  CurrentASMContent.take_front(NewlineIndex).take_back(SymbolLength);
+        StringRef LocalSymbol =
+            CurrentASMContent.take_front(NewlineIndex).take_back(SymbolLength);
 
-        //Get and check if ".rdata" section exist.
-        size_t RdataIndex = CurrentASMContent.find( ".rdata");
+        // Get and check if ".rdata" section exist.
+        size_t RdataIndex = CurrentASMContent.find(".rdata");
         if (RdataIndex != StringRef::npos) {
           StringRef Rdata = CurrentASMContent.substr(RdataIndex);
 
-	  //Check if rdata section contain local symbol.
-	  if (1 == Rdata.contains(LocalSymbol)) {
-	    //Check if "LocalSymbol:" exist.
-	    size_t A = Rdata.find(LocalSymbol);
+          // Check if rdata section contain local symbol.
+          if (1 == Rdata.contains(LocalSymbol)) {
+            // Check if "LocalSymbol:" exist.
+            size_t A = Rdata.find(LocalSymbol);
             size_t B = Rdata.find(':', A);
-	    if (B - A == LocalSymbol.size()) {
+            if (B - A == LocalSymbol.size()) {
               IsLocalSym = true;
-              LLVM_DEBUG(dbgs() << DEBUG_TYPE << ": Has definition of local symbol "  << LocalSymbol << " after 'la' instruction" << "\n");
-	    }
-	  }
+              LLVM_DEBUG(dbgs()
+                         << DEBUG_TYPE << ": Has definition of local symbol "
+                         << LocalSymbol << " after 'la' instruction"
+                         << "\n");
+            }
+          }
         }
       }
     }

``````````

</details>


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


More information about the llvm-commits mailing list