Author: rksimon
Date: Wed Sep 18 05:11:16 2019
New Revision: 372217

URL: http://llvm.org/viewvc/llvm-project?rev=372217&view=rev
Log:
[AST] CommentLexer - Remove (optional) Invalid parameter from getSpelling.

The static analyzer noticed that we were dereferencing it even when the default 
null value was being used. Further investigation showed that we never 
explicitly set the parameter so I've just removed it entirely.

Modified:
    cfe/trunk/include/clang/AST/CommentLexer.h
    cfe/trunk/lib/AST/CommentLexer.cpp

Modified: cfe/trunk/include/clang/AST/CommentLexer.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentLexer.h?rev=372217&r1=372216&r2=372217&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CommentLexer.h (original)
+++ cfe/trunk/include/clang/AST/CommentLexer.h Wed Sep 18 05:11:16 2019
@@ -352,8 +352,7 @@ public:
 
   void lex(Token &T);
 
-  StringRef getSpelling(const Token &Tok, const SourceManager &SourceMgr,
-                        bool *Invalid = nullptr) const;
+  StringRef getSpelling(const Token &Tok, const SourceManager &SourceMgr) 
const;
 };
 
 } // end namespace comments

Modified: cfe/trunk/lib/AST/CommentLexer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentLexer.cpp?rev=372217&r1=372216&r2=372217&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentLexer.cpp (original)
+++ cfe/trunk/lib/AST/CommentLexer.cpp Wed Sep 18 05:11:16 2019
@@ -850,17 +850,14 @@ again:
 }
 
 StringRef Lexer::getSpelling(const Token &Tok,
-                             const SourceManager &SourceMgr,
-                             bool *Invalid) const {
+                             const SourceManager &SourceMgr) const {
   SourceLocation Loc = Tok.getLocation();
   std::pair<FileID, unsigned> LocInfo = SourceMgr.getDecomposedLoc(Loc);
 
   bool InvalidTemp = false;
   StringRef File = SourceMgr.getBufferData(LocInfo.first, &InvalidTemp);
-  if (InvalidTemp) {
-    *Invalid = true;
+  if (InvalidTemp)
     return StringRef();
-  }
 
   const char *Begin = File.data() + LocInfo.second;
   return StringRef(Begin, Tok.getLength());


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to