[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:50:24 PDT 2023


Manna updated this revision to Diff 523481.

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,9 @@
     return;
   }
 
+  PP.Lex(Tok);
+  II = Tok.getIdentifierInfo();
+  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.523481.patch
Type: text/x-patch
Size: 760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230518/b5a84e19/attachment.bin>


More information about the cfe-commits mailing list