2013-07-08 20:17:37 +08:00
|
|
|
//===-- UseNullptr/NullptrActions.h - Matcher callback ----------*- C++ -*-===//
|
2013-01-23 02:31:49 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
2013-07-08 20:17:37 +08:00
|
|
|
/// \file
|
|
|
|
/// \brief This file contains the declaration of the NullptrFixer class which
|
|
|
|
/// is used as a ASTMatcher callback.
|
2013-01-23 02:31:49 +08:00
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
2013-07-08 20:17:37 +08:00
|
|
|
|
2013-09-05 03:13:50 +08:00
|
|
|
#ifndef CLANG_MODERNIZE_NULLPTR_ACTIONS_H
|
|
|
|
#define CLANG_MODERNIZE_NULLPTR_ACTIONS_H
|
2013-01-23 02:31:49 +08:00
|
|
|
|
2013-04-05 04:19:58 +08:00
|
|
|
#include "Core/Transform.h"
|
2013-01-23 02:31:49 +08:00
|
|
|
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
|
|
|
#include "clang/Tooling/Refactoring.h"
|
|
|
|
|
2013-04-02 04:09:29 +08:00
|
|
|
// The type for user-defined macro names that behave like NULL
|
|
|
|
typedef llvm::SmallVector<llvm::StringRef, 1> UserMacroNames;
|
|
|
|
|
2013-01-23 02:31:49 +08:00
|
|
|
/// \brief The callback to be used for nullptr migration matchers.
|
|
|
|
///
|
|
|
|
class NullptrFixer : public clang::ast_matchers::MatchFinder::MatchCallback {
|
|
|
|
public:
|
2013-10-18 01:57:36 +08:00
|
|
|
NullptrFixer(unsigned &AcceptedChanges,
|
|
|
|
llvm::ArrayRef<llvm::StringRef> UserMacros, Transform &Owner);
|
2013-01-23 02:31:49 +08:00
|
|
|
|
|
|
|
/// \brief Entry point to the callback called when matches are made.
|
2015-04-11 15:59:33 +08:00
|
|
|
void
|
|
|
|
run(const clang::ast_matchers::MatchFinder::MatchResult &Result) override;
|
2013-01-23 02:31:49 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned &AcceptedChanges;
|
2013-04-02 04:09:29 +08:00
|
|
|
UserMacroNames UserNullMacros;
|
2013-09-03 21:16:02 +08:00
|
|
|
Transform &Owner;
|
2013-01-23 02:31:49 +08:00
|
|
|
};
|
|
|
|
|
2013-09-05 03:13:50 +08:00
|
|
|
#endif // CLANG_MODERNIZE_NULLPTR_ACTIONS_H
|