Files
clang-p2996/clang-tools-extra/cpp11-migrate/UseNullptr/UseNullptr.cpp
Edwin Vane aae33677f5 cpp11-migrate: Tidying up
* Some file headers were missing for files in Core/
* Some headers were included but not necessary
* CMakeLists.txt was linking in LLVMSupport even though CMakeLists in subdirs
  were linking it in too.
* StringRefisation of constructors of types in FileOverrides.h
* Other misc cleanups

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 185811
2013-07-08 12:17:37 +00:00

51 lines
1.5 KiB
C++

//===-- UseNullptr/UseNullptr.cpp - C++11 nullptr migration ---------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief This file provides the implementation of the UseNullptrTransform
/// class.
///
//===----------------------------------------------------------------------===//
#include "UseNullptr.h"
#include "NullptrActions.h"
#include "NullptrMatchers.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Tooling/Refactoring.h"
#include "clang/Tooling/Tooling.h"
using clang::ast_matchers::MatchFinder;
using namespace clang::tooling;
using namespace clang;
int UseNullptrTransform::apply(FileOverrides &InputStates,
const CompilationDatabase &Database,
const std::vector<std::string> &SourcePaths) {
ClangTool UseNullptrTool(Database, SourcePaths);
unsigned AcceptedChanges = 0;
MatchFinder Finder;
NullptrFixer Fixer(getReplacements(), AcceptedChanges, Options().MaxRiskLevel,
/*Owner=*/ *this);
Finder.addMatcher(makeCastSequenceMatcher(), &Fixer);
setOverrides(InputStates);
if (int result = UseNullptrTool.run(createActionFactory(Finder))) {
llvm::errs() << "Error encountered during translation.\n";
return result;
}
setAcceptedChanges(AcceptedChanges);
return 0;
}