[PATCH] D150895: [NFC][CLANG] Fix dereference issue before null check found by Coverity static analyzer tool

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 19 10:17:10 PDT 2023


This revision was automatically updated to reflect the committed changes.
Manna marked an inline comment as done.
Closed by commit rGbe37e3e25982: [NFC][CLANG] Fix dereference issue before null check found by Coverity static… (authored by Manna).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150895/new/

https://reviews.llvm.org/D150895

Files:
  clang/lib/Parse/ParsePragma.cpp


Index: clang/lib/Parse/ParsePragma.cpp
===================================================================
--- clang/lib/Parse/ParsePragma.cpp
+++ clang/lib/Parse/ParsePragma.cpp
@@ -4041,7 +4041,6 @@
 
   PP.Lex(Tok);
   II = Tok.getIdentifierInfo();
-  StringRef IntrinsicClass = II->getName();
   if (!II || !(II->isStr("vector") || II->isStr("sifive_vector"))) {
     PP.Diag(Tok.getLocation(), diag::warn_pragma_invalid_argument)
         << PP.getSpelling(Tok) << "riscv" << /*Expected=*/true
@@ -4056,8 +4055,8 @@
     return;
   }
 
-  if (IntrinsicClass == "vector")
+  if (II->isStr("vector"))
     Actions.DeclareRISCVVBuiltins = true;
-  else if (IntrinsicClass == "sifive_vector")
+  else if (II->isStr("sifive_vector"))
     Actions.DeclareRISCVVectorBuiltins = true;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150895.523838.patch
Type: text/x-patch
Size: 785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230519/7678e7e1/attachment.bin>


More information about the cfe-commits mailing list