]> granicus.if.org Git - clang/commitdiff
[AST] CommentLexer - Remove (optional) Invalid parameter from getSpelling.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 18 Sep 2019 12:11:16 +0000 (12:11 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 18 Sep 2019 12:11:16 +0000 (12:11 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372217 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/CommentLexer.h
lib/AST/CommentLexer.cpp

index 9ddbb7d31d99e5e0c7cc157aad9730323dd8457e..138fdaca0ff612e30cf1319581332a1a32a4e591 100644 (file)
@@ -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
index 19485f6018c02c8b588d7e921df8de672c2ac1c1..c1ea3eab075e272f17055c2d3aea40c970a69c39 100644 (file)
@@ -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());