diff options
author | Michael Gottesman <mgottesman@apple.com> | 2013-07-22 21:03:56 +0000 |
---|---|---|
committer | Michael Gottesman <mgottesman@apple.com> | 2013-07-22 21:03:56 +0000 |
commit | 29e449f22280b8c15619e5b3e9df30f1ae9dfb0a (patch) | |
tree | 83250c1587ab42fc65774d7be76c2b6e10dd6a8a /clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp | |
parent | 476f38a0c28f3cf94535b9eed2e2b2929f075c91 (diff) | |
download | bcm5719-llvm-29e449f22280b8c15619e5b3e9df30f1ae9dfb0a.tar.gz bcm5719-llvm-29e449f22280b8c15619e5b3e9df30f1ae9dfb0a.zip |
Revert "cp11-migrate: Integration with LibFormat"
This reverts commit r186866.
This breaks the build and the original author Guillaume Papin
<guillaume.papin@epitech.eu> asked me to revert so he could look at it more with
revane.
llvm-svn: 186873
Diffstat (limited to 'clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp')
-rw-r--r-- | clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp | 69 |
1 files changed, 3 insertions, 66 deletions
diff --git a/clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp b/clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp index b5b6a410ab0..66839fdb1a9 100644 --- a/clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp +++ b/clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp @@ -20,7 +20,6 @@ #include "Core/SyntaxCheck.h" #include "Core/Transform.h" #include "Core/Transforms.h" -#include "Core/Reformatting.h" #include "LoopConvert/LoopConvert.h" #include "UseNullptr/UseNullptr.h" #include "UseAuto/UseAuto.h" @@ -29,7 +28,6 @@ #include "clang/Frontend/FrontendActions.h" #include "clang/Tooling/CommonOptionsParser.h" #include "clang/Tooling/Tooling.h" -#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Signals.h" namespace cl = llvm::cl; @@ -45,9 +43,9 @@ static cl::extrahelp MoreHelp( " cpp11-migrate -use-auto path/to/file.cpp -- -Ipath/to/include/\n" "\n" "Convert for loops to the new ranged-based for loops on all files in a " - "subtree\nand reformat the code automatically using the LLVM style:\n\n" + "subtree:\n\n" " find path/in/subtree -name '*.cpp' -exec \\\n" - " cpp11-migrate -p build/path -format-style=LLVM -loop-convert {} ';'\n" + " cpp11-migrate -p build/path -loop-convert {} ';'\n" "\n" "Make use of both nullptr and the override specifier, using git ls-files:\n" "\n" @@ -72,14 +70,6 @@ static cl::opt<bool> FinalSyntaxCheck( cl::desc("Check for correct syntax after applying transformations"), cl::init(false)); -static cl::opt<std::string> FormatStyleOpt( - "format-style", - cl::desc("Coding style to use on the replacements, either a builtin style\n" - "or a YAML config file (see: clang-format -dump-config).\n" - "Currently supports 4 builtins style:\n" - " LLVM, Google, Chromium, Mozilla.\n"), - cl::value_desc("string")); - static cl::opt<bool> SummaryMode("summary", cl::desc("Print transform summary"), cl::init(false)); @@ -118,40 +108,6 @@ static cl::opt<bool, /*ExternalStorage=*/true> EnableHeaderModifications( cl::location(GlobalOptions.EnableHeaderModifications), cl::init(false)); -/// \brief Creates the Reformatter if the format style option is provided, -/// return a null pointer otherwise. -/// -/// \param ProgName The name of the program, \c argv[0], used to print errors. -/// \param Error If the \c -format-style is provided but with wrong parameters -/// this is parameter is set to \c true, left untouched otherwise. An error -/// message is printed with an explanation. -static Reformatter *handleFormatStyle(const char *ProgName, bool &Error) { - if (FormatStyleOpt.getNumOccurrences() > 0) { - format::FormatStyle Style; - if (!format::getPredefinedStyle(FormatStyleOpt, &Style)) { - llvm::StringRef ConfigFilePath = FormatStyleOpt; - llvm::OwningPtr<llvm::MemoryBuffer> Text; - llvm::error_code ec; - - ec = llvm::MemoryBuffer::getFile(ConfigFilePath, Text); - if (!ec) - ec = parseConfiguration(Text->getBuffer(), &Style); - - if (ec) { - llvm::errs() << ProgName << ": invalid format style " << FormatStyleOpt - << ": " << ec.message() << "\n"; - Error = true; - return 0; - } - } - - // force mode to C++11 - Style.Standard = clang::format::FormatStyle::LS_Cpp11; - return new Reformatter(Style); - } - return 0; -} - int main(int argc, const char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(); Transforms TransformManager; @@ -181,13 +137,6 @@ int main(int argc, const char **argv) { // against the default value when the command line option is not specified. GlobalOptions.EnableTiming = (TimingDirectoryName != NoTiming); - // Check the reformatting style option - bool BadStyle = false; - llvm::OwningPtr<Reformatter> ChangesReformatter( - handleFormatStyle(argv[0], BadStyle)); - if (BadStyle) - return 1; - // Populate the ModifiableHeaders structure if header modifications are // enabled. if (GlobalOptions.EnableHeaderModifications) { @@ -204,10 +153,7 @@ int main(int argc, const char **argv) { return 1; } - // if reformatting is enabled we wants to track file changes so that it's - // possible to reformat them. - bool TrackReplacements = static_cast<bool>(ChangesReformatter); - FileOverrides FileStates(TrackReplacements); + FileOverrides FileStates; SourcePerfData PerfData; // Apply transforms. @@ -237,15 +183,6 @@ int main(int argc, const char **argv) { } } - // Reformat changes if a reformatter is provided. - if (ChangesReformatter) - for (FileOverrides::const_iterator I = FileStates.begin(), - E = FileStates.end(); - I != E; ++I) { - SourceOverrides &Overrides = *I->second; - ChangesReformatter->reformatChanges(Overrides); - } - if (FinalSyntaxCheck) if (!doSyntaxCheck(OptionsParser.getCompilations(), OptionsParser.getSourcePathList(), FileStates)) |