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
This commit is contained in:
parent
0b90083168
commit
aae33677f5
|
@ -1,4 +1,4 @@
|
|||
//===-- AddOverride/AddOverride.cpp - add C++11 override -------*- C++ -*-===//
|
||||
//===-- AddOverride/AddOverride.cpp - add C++11 override ------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -16,11 +16,8 @@
|
|||
#include "AddOverride.h"
|
||||
#include "AddOverrideActions.h"
|
||||
#include "AddOverrideMatchers.h"
|
||||
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Frontend/FrontendActions.h"
|
||||
#include "clang/Rewrite/Core/Rewriter.h"
|
||||
#include "clang/Tooling/Refactoring.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
|
||||
using clang::ast_matchers::MatchFinder;
|
||||
using namespace clang::tooling;
|
||||
|
@ -36,11 +33,8 @@ int AddOverrideTransform::apply(FileOverrides &InputStates,
|
|||
const CompilationDatabase &Database,
|
||||
const std::vector<std::string> &SourcePaths) {
|
||||
ClangTool AddOverrideTool(Database, SourcePaths);
|
||||
|
||||
unsigned AcceptedChanges = 0;
|
||||
|
||||
MatchFinder Finder;
|
||||
|
||||
AddOverrideFixer Fixer(getReplacements(), AcceptedChanges, DetectMacros,
|
||||
/*Owner=*/ *this);
|
||||
Finder.addMatcher(makeCandidateForOverrideAttrMatcher(), &Fixer);
|
||||
|
@ -56,7 +50,6 @@ int AddOverrideTransform::apply(FileOverrides &InputStates,
|
|||
}
|
||||
|
||||
setAcceptedChanges(AcceptedChanges);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- AddOverride/AddOverride.h - add C++11 override ---------*- C++ -*-===//
|
||||
//===-- AddOverride/AddOverride.h - add C++11 override ----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -9,13 +9,14 @@
|
|||
///
|
||||
/// \file
|
||||
/// \brief This file provides the definition of the AddOverrideTransform
|
||||
/// class which is the main interface to the transform that tries to add
|
||||
/// the override keyword to declarations of member function that override
|
||||
/// virtual functions in a base class.
|
||||
/// class which is the main interface to the transform that tries to add the
|
||||
/// override keyword to declarations of member function that override virtual
|
||||
/// functions in a base class.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_ADD_OVERRIDE_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_ADD_OVERRIDE_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_ADD_OVERRIDE_H
|
||||
#define CPP11_MIGRATE_ADD_OVERRIDE_H
|
||||
|
||||
#include "Core/Transform.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
|
@ -41,4 +42,4 @@ private:
|
|||
AddOverrideFixer *Fixer;
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_ADD_OVERRIDE_H
|
||||
#endif // CPP11_MIGRATE_ADD_OVERRIDE_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- AddOverride/AddOverrideActions.cpp - add C++11 override-*- C++ -*-===//
|
||||
//===-- AddOverride/AddOverrideActions.cpp - add C++11 override -----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,9 +7,9 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the definition of the AddOverrideFixer class
|
||||
/// which is used as an ASTMatcher callback.
|
||||
/// \file
|
||||
/// \brief This file contains the definition of the AddOverrideFixer class
|
||||
/// which is used as an ASTMatcher callback.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- AddOverride/AddOverrideActions.h - add C++11 override --*- C++ -*-===//
|
||||
//===-- AddOverride/AddOverrideActions.h - add C++11 override ---*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,13 +7,14 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the declaration of the AddOverrideFixer class
|
||||
/// which is used as a ASTMatcher callback.
|
||||
/// \file
|
||||
/// \brief This file contains the declaration of the AddOverrideFixer class
|
||||
/// which is used as a ASTMatcher callback.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_ADD_OVERRIDE_ACTIONS_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_ADD_OVERRIDE_ACTIONS_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_ADD_OVERRIDE_ACTIONS_H
|
||||
#define CPP11_MIGRATE_ADD_OVERRIDE_ACTIONS_H
|
||||
|
||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||
#include "clang/Tooling/Refactoring.h"
|
||||
|
@ -43,4 +44,4 @@ private:
|
|||
const Transform &Owner;
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_ADD_OVERRIDE_ACTIONS_H
|
||||
#endif // CPP11_MIGRATE_ADD_OVERRIDE_ACTIONS_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- AddOverride/AddOverrideMatchers.cpp - C++11 override ---*- C++ -*-===//
|
||||
//===-- AddOverride/AddOverrideMatchers.cpp - C++11 override --------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,11 +7,12 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the definitions for matcher-generating functions
|
||||
/// and a custom AST_MATCHER for identifying casts of type CK_NullTo*.
|
||||
/// \file
|
||||
/// \brief This file contains the definitions for matcher-generating functions
|
||||
/// and a custom AST_MATCHER for identifying casts of type CK_NullTo*.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "AddOverrideMatchers.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- AddOverride/AddOverrideMatchers.h - add C++11 override -*- C++ -*-===//
|
||||
//===-- AddOverride/AddOverrideMatchers.h - add C++11 override --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,13 +7,14 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the declarations for matcher-generating functions
|
||||
/// and names for bound nodes found by AST matchers.
|
||||
/// \file
|
||||
/// \brief This file contains the declarations for matcher-generating functions
|
||||
/// and names for bound nodes found by AST matchers.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_ADD_OVERRIDE_MATCHERS_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_ADD_OVERRIDE_MATCHERS_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_ADD_OVERRIDE_MATCHERS_H
|
||||
#define CPP11_MIGRATE_ADD_OVERRIDE_MATCHERS_H
|
||||
|
||||
#include "clang/ASTMatchers/ASTMatchers.h"
|
||||
|
||||
|
@ -24,4 +25,4 @@ extern const char *MethodId;
|
|||
/// candidates for adding the override attribute.
|
||||
clang::ast_matchers::DeclarationMatcher makeCandidateForOverrideAttrMatcher();
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_ADD_OVERRIDE_MATCHERS_H
|
||||
#endif // CPP11_MIGRATE_ADD_OVERRIDE_MATCHERS_H
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
set(LLVM_LINK_COMPONENTS support)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_subdirectory(tool)
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
//===-- Core/FileOverrides.cpp --------------------------------------------===//
|
||||
//
|
||||
// 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 types and functionality for dealing with source
|
||||
/// and header file content overrides.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Core/FileOverrides.h"
|
||||
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
|
||||
void SourceOverrides::applyOverrides(clang::SourceManager &SM) const {
|
||||
|
|
|
@ -12,9 +12,12 @@
|
|||
/// and header file content overrides.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef CPP11_MIGRATE_FILE_OVERRIDES_H
|
||||
#define CPP11_MIGRATE_FILE_OVERRIDES_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
|
@ -26,7 +29,8 @@ class FileManager;
|
|||
|
||||
/// \brief Container for storing override information for a single headers.
|
||||
struct HeaderOverride {
|
||||
HeaderOverride(const char *FileName) : FileName(FileName) {}
|
||||
HeaderOverride() {}
|
||||
HeaderOverride(llvm::StringRef FileName) : FileName(FileName) {}
|
||||
|
||||
std::string FileName;
|
||||
std::string FileOverride;
|
||||
|
@ -37,7 +41,7 @@ typedef std::map<std::string, HeaderOverride> HeaderOverrides;
|
|||
|
||||
/// \brief Container storing the file content overrides for a source file.
|
||||
struct SourceOverrides {
|
||||
SourceOverrides(const std::string &MainFileName)
|
||||
SourceOverrides(llvm::StringRef MainFileName)
|
||||
: MainFileName(MainFileName) {}
|
||||
|
||||
/// \brief Convenience function for applying this source's overrides to
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- Core/IncludeExcludeInfo.cpp - IncludeExclude class impl -*- C++ -*-===//
|
||||
//===-- Core/IncludeExcludeInfo.cpp - IncludeExclude class impl -----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -8,7 +8,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file provides the implemention of the IncludeExcludeInfo class
|
||||
/// \brief This file provides the implementation of the IncludeExcludeInfo class
|
||||
/// to handle the include and exclude command line options.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
/// to handle the include and exclude command line options.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
|
||||
#define CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/system_error.h"
|
||||
|
@ -48,4 +49,4 @@ private:
|
|||
std::vector<std::string> ExcludeList;
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
|
||||
#endif // CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- cpp11-migrate/Cpp11Migrate.cpp - Main file C++11 migration tool ---===//
|
||||
//===-- Core/PerfSupport.cpp - Perf measurement helpers -------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- cpp11-migrate/PerfSupport.h - Perf measurement helpers --*- C++ -*-===//
|
||||
//===-- Core/PerfSupport.h - Perf measurement helpers -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -16,11 +16,12 @@
|
|||
#ifndef CPP11_MIGRATE_PERFSUPPORT_H
|
||||
#define CPP11_MIGRATE_PERFSUPPORT_H
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "Transform.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
/// \brief A single piece of performance data: a duration in milliseconds and a
|
||||
/// label for that duration.
|
||||
struct PerfItem {
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
//===-- Core/SyntaxCheck.cpp ----------------------------------------------===//
|
||||
//
|
||||
// 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 exposes functionaliy for doing a syntax-only check on
|
||||
/// files with overridden contents.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "SyntaxCheck.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Frontend/FrontendActions.h"
|
||||
|
|
|
@ -12,12 +12,14 @@
|
|||
/// files with overridden contents.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef CPP11_MIGRATE_SYNTAX_CHECK_H
|
||||
#define CPP11_MIGRATE_SYNTAX_CHECK_H
|
||||
|
||||
#include <vector>
|
||||
#include "Core/FileOverrides.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
// Forward Declarations
|
||||
namespace clang {
|
||||
namespace tooling {
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
//===-- Core/Transform.cpp - Transform Base Class Def'n -------------------===//
|
||||
//
|
||||
// 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 definition for the base Transform class from
|
||||
/// which all transforms must subclass.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Core/Transform.h"
|
||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||
#include "clang/Basic/LangOptions.h"
|
||||
|
@ -69,7 +84,7 @@ private:
|
|||
/// FileManager and a DiagnosticsEngine. Transform uses this class to create a
|
||||
/// new Rewriter and SourceManager for every translation unit it transforms. A
|
||||
/// DiagnosticsEngine doesn't need to be re-created so it's constructed once. A
|
||||
/// SourceManager and Rewriter and (re)created as required.
|
||||
/// SourceManager and Rewriter are (re)created as required.
|
||||
///
|
||||
/// FIXME: The DiagnosticsEngine should really come from somewhere more global.
|
||||
/// It shouldn't be re-created once for every transform.
|
||||
|
@ -140,13 +155,12 @@ void collectResults(clang::Rewriter &Rewrite, SourceOverrides &Overrides) {
|
|||
// in memory will always be necessary as the source goes down the transform
|
||||
// pipeline.
|
||||
|
||||
HeaderOverrides &Headers = Overrides.Headers;
|
||||
HeaderOverrides::iterator HeaderI = Headers.find(Entry->getName());
|
||||
if (HeaderI == Headers.end())
|
||||
HeaderI = Headers.insert(HeaderOverrides::value_type(
|
||||
Entry->getName(), Entry->getName())).first;
|
||||
// Create HeaderOverride if not already existing
|
||||
HeaderOverride &Header = Overrides.Headers[Entry->getName()];
|
||||
if (Header.FileName.empty())
|
||||
Header.FileName = Entry->getName();
|
||||
|
||||
HeaderI->second.FileOverride = ResultBuf;
|
||||
Header.FileOverride = ResultBuf;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +183,7 @@ bool Transform::isFileModifiable(const SourceManager &SM,
|
|||
const FileEntry *FE = SM.getFileEntryForID(SM.getFileID(Loc));
|
||||
if (!FE)
|
||||
return false;
|
||||
|
||||
|
||||
return GlobalOptions.ModifiableHeaders.isFileIncluded(FE->getName());
|
||||
}
|
||||
|
||||
|
@ -202,8 +216,7 @@ void Transform::handleEndSource() {
|
|||
|
||||
FileOverrides::iterator I = Overrides->find(CurrentSource);
|
||||
if (I == Overrides->end())
|
||||
I = Overrides
|
||||
->insert(FileOverrides::value_type(CurrentSource, CurrentSource)).first;
|
||||
I = Overrides->insert(std::make_pair(CurrentSource, CurrentSource)).first;
|
||||
|
||||
collectResults(RewriterOwner->getRewriter(), I->second);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- cpp11-migrate/Transform.h - Transform Base Class Def'n --*- C++ -*-===//
|
||||
//===-- Core/Transform.h - Transform Base Class Def'n -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -8,15 +8,14 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file provides the definition for the base Transform class from
|
||||
/// \brief This file provides the declaration for the base Transform class from
|
||||
/// which all transforms must subclass.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORM_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORM_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#ifndef CPP11_MIGRATE_TRANSFORM_H
|
||||
#define CPP11_MIGRATE_TRANSFORM_H
|
||||
|
||||
#include "Core/IncludeExcludeInfo.h"
|
||||
#include "Core/FileOverrides.h"
|
||||
#include "clang/Tooling/Refactoring.h"
|
||||
|
@ -24,6 +23,8 @@
|
|||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Timer.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/// \brief Description of the riskiness of actions that can be taken by
|
||||
/// transforms.
|
||||
|
@ -223,4 +224,4 @@ private:
|
|||
unsigned DeferredChanges;
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORM_H
|
||||
#endif // CPP11_MIGRATE_TRANSFORM_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- cpp11-migrate/Transforms.cpp - class Transforms Impl ----*- C++ -*-===//
|
||||
//===-- Core/Transforms.cpp - class Transforms Impl -----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- cpp11-migrate/Transforms.h - class Transforms Def'n -----*- C++ -*-===//
|
||||
//===-- Core/Transforms.h - class Transforms Def'n --------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -13,11 +13,13 @@
|
|||
/// transformations to the user and applying requested transforms.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORMS_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORMS_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_TRANSFORMS_H
|
||||
#define CPP11_MIGRATE_TRANSFORMS_H
|
||||
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
// Forward declarations
|
||||
|
@ -75,4 +77,4 @@ private:
|
|||
OptionVec Options;
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORMS_H
|
||||
#endif // CPP11_MIGRATE_TRANSFORMS_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- LoopConvert/LoopActions.cpp - C++11 For loop migration --*- C++ -*-===//
|
||||
//===-- LoopConvert/LoopActions.cpp - C++11 For loop migration ------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -12,6 +12,7 @@
|
|||
/// for loops.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "LoopActions.h"
|
||||
#include "LoopMatchers.h"
|
||||
#include "VariableNaming.h"
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
/// for loops.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_ACTIONS_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_ACTIONS_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_LOOP_ACTIONS_H
|
||||
#define CPP11_MIGRATE_LOOP_ACTIONS_H
|
||||
|
||||
#include "StmtAncestor.h"
|
||||
#include "Core/Transform.h"
|
||||
|
@ -103,4 +104,4 @@ class LoopFixer : public clang::ast_matchers::MatchFinder::MatchCallback {
|
|||
const clang::ForStmt *TheLoop);
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_ACTIONS_H
|
||||
#endif // CPP11_MIGRATE_LOOP_ACTIONS_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- LoopConvert/LoopConvert.cpp - C++11 for-loop migration --*- C++ -*-===//
|
||||
//===-- LoopConvert/LoopConvert.cpp - C++11 for-loop migration ------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -17,7 +17,6 @@
|
|||
#include "LoopActions.h"
|
||||
#include "LoopMatchers.h"
|
||||
#include "clang/Frontend/FrontendActions.h"
|
||||
#include "clang/Rewrite/Core/Rewriter.h"
|
||||
#include "clang/Tooling/Refactoring.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
|
||||
|
|
|
@ -9,12 +9,13 @@
|
|||
///
|
||||
/// \file
|
||||
/// \brief This file provides the definition of the LoopConvertTransform
|
||||
/// class which is the main interface to the loop-convert transform
|
||||
/// that tries to make use of range-based for loops where possible.
|
||||
/// class which is the main interface to the loop-convert transform that tries
|
||||
/// to make use of range-based for loops where possible.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_LOOP_CONVERT_H
|
||||
#define CPP11_MIGRATE_LOOP_CONVERT_H
|
||||
|
||||
#include "Core/Transform.h"
|
||||
#include "llvm/Support/Compiler.h" // For LLVM_OVERRIDE
|
||||
|
@ -32,4 +33,4 @@ public:
|
|||
const std::vector<std::string> &SourcePaths) LLVM_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H
|
||||
#endif // CPP11_MIGRATE_LOOP_CONVERT_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- LoopConvert/LoopMatchers.h - Matchers for for loops -----*- C++ -*-===//
|
||||
//===-- LoopConvert/LoopMatchers.cpp - Matchers for for loops -------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -12,6 +12,7 @@
|
|||
/// C++ for loops.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "LoopMatchers.h"
|
||||
|
||||
using namespace clang::ast_matchers;
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
/// convertible in the matcher callback.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_MATCHERS_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_MATCHERS_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_LOOP_MATCHERS_H
|
||||
#define CPP11_MIGRATE_LOOP_MATCHERS_H
|
||||
|
||||
#include "clang/ASTMatchers/ASTMatchers.h"
|
||||
|
||||
|
@ -38,4 +39,4 @@ clang::ast_matchers::StatementMatcher makeArrayLoopMatcher();
|
|||
clang::ast_matchers::StatementMatcher makeIteratorLoopMatcher();
|
||||
clang::ast_matchers::StatementMatcher makePseudoArrayLoopMatcher();
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_MATCHERS_H
|
||||
#endif // CPP11_MIGRATE_LOOP_MATCHERS_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- LoopConvert/StmtAncestor.cpp - AST property visitors ----*- C++ -*-===//
|
||||
//===-- LoopConvert/StmtAncestor.cpp - AST property visitors --------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -12,6 +12,7 @@
|
|||
/// used to build and check data structures used in loop migration.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "StmtAncestor.h"
|
||||
|
||||
using namespace clang;
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
/// used to build and check data structures used in loop migration.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_STMT_ANCESTOR_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_STMT_ANCESTOR_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_STMT_ANCESTOR_H
|
||||
#define CPP11_MIGRATE_STMT_ANCESTOR_H
|
||||
|
||||
#include "clang/AST/RecursiveASTVisitor.h"
|
||||
|
||||
|
@ -197,4 +198,4 @@ private:
|
|||
bool VisitTypeLoc(clang::TypeLoc TL);
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_STMT_ANCESTOR_H
|
||||
#endif // CPP11_MIGRATE_STMT_ANCESTOR_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- LoopConvert/VariableNaming.h - Gererate variable names --*- C++ -*-===//
|
||||
//===-- LoopConvert/VariableNaming.cpp - Gererate variable names ----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -13,6 +13,7 @@
|
|||
/// not conflict with existing ones.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "VariableNaming.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
/// not conflict with existing ones.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_VARIABLE_NAMING_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_VARIABLE_NAMING_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_VARIABLE_NAMING_H
|
||||
#define CPP11_MIGRATE_VARIABLE_NAMING_H
|
||||
|
||||
#include "StmtAncestor.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
|
@ -55,4 +56,4 @@ class VariableNamer {
|
|||
bool declarationExists(llvm::StringRef Symbol);
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_VARIABLE_NAMING_H
|
||||
#endif // CPP11_MIGRATE_VARIABLE_NAMING_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- ReplaceAutoPtr.cpp ---------- std::auto_ptr replacement -*- C++ -*-===//
|
||||
//===-- ReplaceAutoPtr.cpp ---------- std::auto_ptr replacement -----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -17,9 +17,6 @@
|
|||
#include "ReplaceAutoPtrActions.h"
|
||||
#include "ReplaceAutoPtrMatchers.h"
|
||||
|
||||
#include "clang/Tooling/Refactoring.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
|
||||
using namespace clang;
|
||||
using namespace clang::tooling;
|
||||
using namespace clang::ast_matchers;
|
||||
|
@ -29,9 +26,7 @@ ReplaceAutoPtrTransform::apply(FileOverrides &InputStates,
|
|||
const CompilationDatabase &Database,
|
||||
const std::vector<std::string> &SourcePaths) {
|
||||
ClangTool Tool(Database, SourcePaths);
|
||||
|
||||
unsigned AcceptedChanges = 0;
|
||||
|
||||
MatchFinder Finder;
|
||||
AutoPtrReplacer Replacer(getReplacements(), AcceptedChanges,
|
||||
/*Owner=*/*this);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
/// class.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef CPP11_MIGRATE_REPLACE_AUTO_PTR_H
|
||||
#define CPP11_MIGRATE_REPLACE_AUTO_PTR_H
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- ReplaceAutoPtrActions.cpp --- std::auto_ptr replacement -*- C++ -*-===//
|
||||
//===-- ReplaceAutoPtrActions.cpp --- std::auto_ptr replacement -----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -8,8 +8,8 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the definition of the ASTMatcher callback
|
||||
/// for the ReplaceAutoPtr transform.
|
||||
/// \brief This file contains the definition of the ASTMatcher callback for the
|
||||
/// ReplaceAutoPtr transform.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the declaration of the ASTMatcher callback
|
||||
/// for the ReplaceAutoPtr transform.
|
||||
/// \brief This file contains the declaration of the ASTMatcher callback for the
|
||||
/// ReplaceAutoPtr transform.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef CPP11_MIGRATE_REPLACE_AUTO_PTR_ACTIONS_H
|
||||
#define CPP11_MIGRATE_REPLACE_AUTO_PTR_ACTIONS_H
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- ReplaceAutoPtrMatchers.cpp - std::auto_ptr replacement -*- C++ -*--===//
|
||||
//===-- ReplaceAutoPtrMatchers.cpp -- std::auto_ptr replacement -----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- ReplaceAutoPtrMatchers.h --- std::auto_ptr replacement -*- C++ -*--===//
|
||||
//===-- ReplaceAutoPtrMatchers.h ---- std::auto_ptr replacement -*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -12,6 +12,7 @@
|
|||
/// and names for bound nodes found by AST matchers.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef CPP11_MIGRATE_REPLACE_AUTO_PTR_MATCHERS_H
|
||||
#define CPP11_MIGRATE_REPLACE_AUTO_PTR_MATCHERS_H
|
||||
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
/// situations.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_AUTO_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_AUTO_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_USE_AUTO_H
|
||||
#define CPP11_MIGRATE_USE_AUTO_H
|
||||
|
||||
#include "Core/Transform.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
|
@ -38,4 +39,4 @@ public:
|
|||
const std::vector<std::string> &SourcePaths) LLVM_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_AUTO_H
|
||||
#endif // CPP11_MIGRATE_USE_AUTO_H
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the implementation of callbacks for the UseAuto
|
||||
/// transform.
|
||||
/// \file
|
||||
/// \brief This file contains the implementation of callbacks for the UseAuto
|
||||
/// transform.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "UseAutoActions.h"
|
||||
#include "UseAutoMatchers.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- UseAuto/Actions.h - Matcher callback ---------------------*- C++ -*-==//
|
||||
//===-- UseAuto/Actions.h - Matcher callback --------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -12,8 +12,9 @@
|
|||
/// UseAuto transform.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_AUTO_ACTIONS_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_AUTO_ACTIONS_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_USE_AUTO_ACTIONS_H
|
||||
#define CPP11_MIGRATE_USE_AUTO_ACTIONS_H
|
||||
|
||||
#include "Core/Transform.h"
|
||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||
|
@ -56,4 +57,4 @@ private:
|
|||
const Transform &Owner;
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_AUTO_ACTIONS_H
|
||||
#endif // CPP11_MIGRATE_USE_AUTO_ACTIONS_H
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the implementation for matcher-generating
|
||||
/// functions and custom AST_MATCHERs.
|
||||
/// \file
|
||||
/// \brief This file contains the implementation for matcher-generating
|
||||
/// functions and custom AST_MATCHERs.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "UseAutoMatchers.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- UseAutoMatchers.h - Matchers for use-auto transform ----*- C++ -*--===//
|
||||
//===-- UseAutoMatchers.h - Matchers for use-auto transform -----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -12,8 +12,9 @@
|
|||
/// and names for bound nodes found by AST matchers.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_AUTO_MATCHERS_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_AUTO_MATCHERS_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_USE_AUTO_MATCHERS_H
|
||||
#define CPP11_MIGRATE_USE_AUTO_MATCHERS_H
|
||||
|
||||
#include "clang/ASTMatchers/ASTMatchers.h"
|
||||
|
||||
|
@ -30,4 +31,4 @@ clang::ast_matchers::StatementMatcher makeIteratorDeclMatcher();
|
|||
/// initialized by a C++ new expression.
|
||||
clang::ast_matchers::StatementMatcher makeDeclWithNewMatcher();
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_AUTO_MATCHERS_H
|
||||
#endif // CPP11_MIGRATE_USE_AUTO_MATCHERS_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- nullptr-convert/NullptrActions.cpp - Matcher callback -------------===//
|
||||
//===-- UseNullptr/NullptrActions.cpp - Matcher callback ------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,10 +7,10 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the definition of the NullptrFixer class which is
|
||||
/// used as an ASTMatcher callback. Also within this file is a helper AST
|
||||
/// visitor class used to identify sequences of explicit casts.
|
||||
/// \file
|
||||
/// \brief This file contains the definition of the NullptrFixer class which is
|
||||
/// used as an ASTMatcher callback. Also within this file is a helper AST
|
||||
/// visitor class used to identify sequences of explicit casts.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- nullptr-convert/NullptrActions.h - Matcher callback ------*- C++ -*-==//
|
||||
//===-- UseNullptr/NullptrActions.h - Matcher callback ----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,13 +7,14 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the declaration of the NullptrFixer class which
|
||||
/// is used as a ASTMatcher callback.
|
||||
/// \file
|
||||
/// \brief This file contains the declaration of the NullptrFixer class which
|
||||
/// is used as a ASTMatcher callback.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_NULLPTR_ACTIONS_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_NULLPTR_ACTIONS_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_NULLPTR_ACTIONS_H
|
||||
#define CPP11_MIGRATE_NULLPTR_ACTIONS_H
|
||||
|
||||
#include "Core/Transform.h"
|
||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||
|
@ -39,4 +40,4 @@ private:
|
|||
const Transform &Owner;
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_NULLPTR_ACTIONS_H
|
||||
#endif // CPP11_MIGRATE_NULLPTR_ACTIONS_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- nullptr-convert/Matchers.cpp - Matchers for null casts ------------===//
|
||||
//===-- UseNullptr/NullptrMatchers.cpp - Matchers for null casts ----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,11 +7,12 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the definitions for matcher-generating functions
|
||||
/// and a custom AST_MATCHER for identifying casts of type CK_NullTo*.
|
||||
/// \file
|
||||
/// \brief This file contains the definitions for matcher-generating functions
|
||||
/// and a custom AST_MATCHER for identifying casts of type CK_NullTo*.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "NullptrMatchers.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- nullptr-convert/Matchers.h - Matchers for null casts ---*- C++ -*--===//
|
||||
//===-- UseNullptr/NullptrMatchers.h - Matchers for null casts --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,13 +7,14 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file contains the declarations for matcher-generating functions
|
||||
/// and names for bound nodes found by AST matchers.
|
||||
/// \file
|
||||
/// \brief This file contains the declarations for matcher-generating functions
|
||||
/// and names for bound nodes found by AST matchers.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_NULLPTR_MATCHERS_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_NULLPTR_MATCHERS_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_USE_NULLPTR_MATCHERS_H
|
||||
#define CPP11_MIGRATE_USE_NULLPTR_MATCHERS_H
|
||||
|
||||
#include "clang/ASTMatchers/ASTMatchers.h"
|
||||
|
||||
|
@ -27,4 +28,4 @@ extern const char *CastSequence;
|
|||
/// can be replaced instead of just the inner-most implicit cast.
|
||||
clang::ast_matchers::StatementMatcher makeCastSequenceMatcher();
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_NULLPTR_MATCHERS_H
|
||||
#endif // CPP11_MIGRATE_USE_NULLPTR_MATCHERS_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- LoopConvert/LoopConvert.cpp - C++11 for-loop migration --*- C++ -*-===//
|
||||
//===-- UseNullptr/UseNullptr.cpp - C++11 nullptr migration ---------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -17,7 +17,6 @@
|
|||
#include "NullptrActions.h"
|
||||
#include "NullptrMatchers.h"
|
||||
#include "clang/Frontend/FrontendActions.h"
|
||||
#include "clang/Rewrite/Core/Rewriter.h"
|
||||
#include "clang/Tooling/Refactoring.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- LoopConvert/LoopConvert.h - C++11 for-loop migration ----*- C++ -*-===//
|
||||
//===-- UseNullptr/UseNullptr.h - C++11 nullptr migration -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -9,12 +9,13 @@
|
|||
///
|
||||
/// \file
|
||||
/// \brief This file provides the definition of the UseNullptrTransform
|
||||
/// class which is the main interface to the use-nullptr transform
|
||||
/// that tries to make use of nullptr where possible.
|
||||
/// class which is the main interface to the use-nullptr transform that tries to
|
||||
/// make use of nullptr where possible.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_NULLPTR_H
|
||||
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_NULLPTR_H
|
||||
|
||||
#ifndef CPP11_MIGRATE_USE_NULLPTR_H
|
||||
#define CPP11_MIGRATE_USE_NULLPTR_H
|
||||
|
||||
#include "Core/Transform.h"
|
||||
#include "llvm/Support/Compiler.h" // For LLVM_OVERRIDE
|
||||
|
@ -32,4 +33,4 @@ public:
|
|||
const std::vector<std::string> &SourcePaths) LLVM_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_USE_NULLPTR_H
|
||||
#endif // CPP11_MIGRATE_USE_NULLPTR_H
|
||||
|
|
|
@ -158,25 +158,24 @@ int main(int argc, const char **argv) {
|
|||
for (Transforms::const_iterator I = TransformManager.begin(),
|
||||
E = TransformManager.end();
|
||||
I != E; ++I) {
|
||||
if ((*I)->apply(FileStates, OptionsParser.getCompilations(),
|
||||
OptionsParser.getSourcePathList()) !=
|
||||
Transform *T = *I;
|
||||
|
||||
if (T->apply(FileStates, OptionsParser.getCompilations(),
|
||||
OptionsParser.getSourcePathList()) !=
|
||||
0) {
|
||||
// FIXME: Improve ClangTool to not abort if just one file fails.
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (GlobalOptions.EnableTiming)
|
||||
collectSourcePerfData(**I, PerfData);
|
||||
collectSourcePerfData(*T, PerfData);
|
||||
|
||||
if (SummaryMode) {
|
||||
llvm::outs() << "Transform: " << (*I)->getName()
|
||||
<< " - Accepted: "
|
||||
<< (*I)->getAcceptedChanges();
|
||||
if ((*I)->getChangesNotMade()) {
|
||||
llvm::outs() << " - Rejected: "
|
||||
<< (*I)->getRejectedChanges()
|
||||
<< " - Deferred: "
|
||||
<< (*I)->getDeferredChanges();
|
||||
llvm::outs() << "Transform: " << T->getName()
|
||||
<< " - Accepted: " << T->getAcceptedChanges();
|
||||
if (T->getChangesNotMade()) {
|
||||
llvm::outs() << " - Rejected: " << T->getRejectedChanges()
|
||||
<< " - Deferred: " << T->getDeferredChanges();
|
||||
}
|
||||
llvm::outs() << "\n";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue