Skip to content

Commit 4b8b7f2

Browse files
committed
[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. llvm-svn: 372217
1 parent 1541dd4 commit 4b8b7f2

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

clang/include/clang/AST/CommentLexer.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,7 @@ class Lexer {
352352

353353
void lex(Token &T);
354354

355-
StringRef getSpelling(const Token &Tok, const SourceManager &SourceMgr,
356-
bool *Invalid = nullptr) const;
355+
StringRef getSpelling(const Token &Tok, const SourceManager &SourceMgr) const;
357356
};
358357

359358
} // end namespace comments

clang/lib/AST/CommentLexer.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -850,17 +850,14 @@ void Lexer::lex(Token &T) {
850850
}
851851

852852
StringRef Lexer::getSpelling(const Token &Tok,
853-
const SourceManager &SourceMgr,
854-
bool *Invalid) const {
853+
const SourceManager &SourceMgr) const {
855854
SourceLocation Loc = Tok.getLocation();
856855
std::pair<FileID, unsigned> LocInfo = SourceMgr.getDecomposedLoc(Loc);
857856

858857
bool InvalidTemp = false;
859858
StringRef File = SourceMgr.getBufferData(LocInfo.first, &InvalidTemp);
860-
if (InvalidTemp) {
861-
*Invalid = true;
859+
if (InvalidTemp)
862860
return StringRef();
863-
}
864861

865862
const char *Begin = File.data() + LocInfo.second;
866863
return StringRef(Begin, Tok.getLength());

0 commit comments

Comments
 (0)