[llvm] [LLVM][IR] Add location tracking to LLVM IR parser (PR #155797)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 02:16:19 PDT 2025


Albert =?utf-8?q?Havliček?= <ahavlicek at azul.com>,
Albert =?utf-8?q?Havliček?= <ahavlicek at azul.com>,
Albert =?utf-8?q?Havliček?= <ahavlicek at azul.com>,Bertik23
 <39457484+Bertik23 at users.noreply.github.com>,
Albert =?utf-8?q?Havliček?= <ahavlicek at azul.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/155797 at github.com>


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 origin/main HEAD --extensions h,cpp -- llvm/include/llvm/AsmParser/AsmParserContext.h llvm/lib/AsmParser/AsmParserContext.cpp llvm/include/llvm/AsmParser/LLLexer.h llvm/include/llvm/AsmParser/LLParser.h llvm/include/llvm/AsmParser/Parser.h llvm/include/llvm/IR/Value.h llvm/include/llvm/IRReader/IRReader.h llvm/lib/AsmParser/LLLexer.cpp llvm/lib/AsmParser/LLParser.cpp llvm/lib/AsmParser/Parser.cpp llvm/lib/IRReader/IRReader.cpp llvm/unittests/AsmParser/AsmParserTest.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/include/llvm/AsmParser/AsmParserContext.h b/llvm/include/llvm/AsmParser/AsmParserContext.h
index bc4d93ef7..78ea32ac7 100644
--- a/llvm/include/llvm/AsmParser/AsmParserContext.h
+++ b/llvm/include/llvm/AsmParser/AsmParserContext.h
@@ -24,7 +24,7 @@ namespace llvm {
 /// When available, it can answer queries about what is at a given
 /// file location, as well as where in a file a given IR construct
 /// is.
-/// 
+///
 /// This information is optionally emitted by the LLParser while
 /// it reads LLVM textual IR.
 class AsmParserContext {
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp
index cd9d5b37d..be5b2b9bc 100644
--- a/llvm/lib/AsmParser/LLLexer.cpp
+++ b/llvm/lib/AsmParser/LLLexer.cpp
@@ -180,7 +180,7 @@ int LLLexer::getNextChar() {
   if (CurPtr == CurBuf.end())
     return EOF;
   // Increment line number if this is the first character after a newline
-  if (CurPtr > CurBuf.begin() && *(CurPtr-1) == '\n'){
+  if (CurPtr > CurBuf.begin() && *(CurPtr - 1) == '\n') {
     CurLineNum++;
     CurColNum = 0;
   } else

``````````

</details>


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


More information about the llvm-commits mailing list