Files
llvm-project/clang-tools-extra/cpp11-migrate/Core/Transforms.cpp
Edwin Vane 6b191b0195 Fix symbol dependency errors introduced with libmigrateCore
With cpp11-migrate core functionality moved to a separate library (for enabling
unit tests) this library contained code that referenced symbols that are still
in the main binary. On some platforms, the shared library build broke as a
result. This revision fixes the dependency problem and is safe for the eventual
lib-ification of the transforms as well.

llvm-svn: 178901
2013-04-05 19:18:13 +00:00

46 lines
1.4 KiB
C++

//===-- cpp11-migrate/Transforms.cpp - class Transforms Impl ----*- C++ -*-===//
//
// 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 for class Transforms.
///
//===----------------------------------------------------------------------===//
#include "Core/Transforms.h"
#include "Core/Transform.h"
namespace cl = llvm::cl;
Transforms::~Transforms() {
for (std::vector<Transform*>::iterator I = ChosenTransforms.begin(),
E = ChosenTransforms.end(); I != E; ++I) {
delete *I;
}
for (OptionVec::iterator I = Options.begin(),
E = Options.end(); I != E; ++I) {
delete I->first;
}
}
void Transforms::registerTransform(llvm::StringRef OptName,
llvm::StringRef Description,
TransformCreator Creator) {
Options.push_back(OptionVec::value_type(
new cl::opt<bool>(OptName.data(), cl::desc(Description.data())), Creator));
}
void Transforms::createSelectedTransforms() {
for (OptionVec::iterator I = Options.begin(),
E = Options.end(); I != E; ++I) {
if (*I->first) {
ChosenTransforms.push_back(I->second());
}
}
}