[clang-tidy] Fix use-after-free in UseNullptrCheck.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245524 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
83feacd2f4
Коммит
0f9f86e56a
|
@ -12,7 +12,6 @@
|
|||
#include "clang/AST/RecursiveASTVisitor.h"
|
||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
|
||||
using namespace clang;
|
||||
using namespace clang::ast_matchers;
|
||||
|
@ -441,14 +440,13 @@ private:
|
|||
};
|
||||
|
||||
UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext *Context)
|
||||
: ClangTidyCheck(Name, Context) {
|
||||
StringRef MacrosStr = Options.get("NullMacros", "NULL");
|
||||
MacrosStr.split(NullMacros, ",");
|
||||
: ClangTidyCheck(Name, Context),
|
||||
NullMacrosStr(Options.get("NullMacros", "NULL")) {
|
||||
StringRef(NullMacrosStr).split(NullMacros, ",");
|
||||
}
|
||||
|
||||
void UseNullptrCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
|
||||
Options.store(Opts, "NullMacros",
|
||||
llvm::join(NullMacros.begin(), NullMacros.end(), ","));
|
||||
Options.store(Opts, "NullMacros", NullMacrosStr);
|
||||
}
|
||||
|
||||
void UseNullptrCheck::registerMatchers(MatchFinder *Finder) {
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
|
||||
private:
|
||||
const std::string NullMacrosStr;
|
||||
SmallVector<StringRef, 1> NullMacros;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче