[llvm] b2809b4 - [Coverity] Fix unchecked return value, NFC

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Sun May 14 06:17:44 PDT 2023


Author: Phoebe Wang
Date: 2023-05-14T21:17:30+08:00
New Revision: b2809b4811bd681ca9869e8ba37f40f52f4ee835

URL: https://github.com/llvm/llvm-project/commit/b2809b4811bd681ca9869e8ba37f40f52f4ee835
DIFF: https://github.com/llvm/llvm-project/commit/b2809b4811bd681ca9869e8ba37f40f52f4ee835.diff

LOG: [Coverity] Fix unchecked return value, NFC

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCParser/AsmLexer.h
    llvm/lib/MC/MCParser/AsmLexer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCParser/AsmLexer.h b/llvm/include/llvm/MC/MCParser/AsmLexer.h
index e187a28f267db..735b0c114f2aa 100644
--- a/llvm/include/llvm/MC/MCParser/AsmLexer.h
+++ b/llvm/include/llvm/MC/MCParser/AsmLexer.h
@@ -55,7 +55,7 @@ class AsmLexer : public MCAsmLexer {
 private:
   bool isAtStartOfComment(const char *Ptr);
   bool isAtStatementSeparator(const char *Ptr);
-  int getNextChar();
+  [[nodiscard]] int getNextChar();
   int peekNextChar();
   AsmToken ReturnError(const char *Loc, const std::string &Msg);
 

diff  --git a/llvm/lib/MC/MCParser/AsmLexer.cpp b/llvm/lib/MC/MCParser/AsmLexer.cpp
index 19300e3885bbc..1b20b2b6eb283 100644
--- a/llvm/lib/MC/MCParser/AsmLexer.cpp
+++ b/llvm/lib/MC/MCParser/AsmLexer.cpp
@@ -578,7 +578,7 @@ AsmToken AsmLexer::LexSingleQuote() {
       } else if (peekNextChar() == '\'') {
         // In MASM single-quote strings, doubled single-quotes mean an escaped
         // single quote, so should be lexed in.
-        getNextChar();
+        (void)getNextChar();
         CurChar = getNextChar();
       } else {
         break;
@@ -635,7 +635,7 @@ AsmToken AsmLexer::LexQuote() {
       } else if (peekNextChar() == '"') {
         // In MASM double-quoted strings, doubled double-quotes mean an escaped
         // double quote, so should be lexed in.
-        getNextChar();
+        (void)getNextChar();
         CurChar = getNextChar();
       } else {
         break;


        


More information about the llvm-commits mailing list