[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
Thu May 18 11:26:29 PDT 2023


Manna updated this revision to Diff 523468.
Manna edited the summary of this revision.
Manna added a comment.

I have updated patch.


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,6 +4055,7 @@
     return;
   }
 
+  StringRef IntrinsicClass = II->getName();
   if (IntrinsicClass == "vector")
     Actions.DeclareRISCVVBuiltins = true;
   else if (IntrinsicClass == "sifive_vector")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150895.523468.patch
Type: text/x-patch
Size: 711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230518/55dfee3f/attachment-0001.bin>


More information about the cfe-commits mailing list