[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
This commit is contained in:
parent
1541dd4841
commit
4b8b7f249c
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue