* 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
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
//===-- Core/Transforms.cpp - class Transforms Impl -----------------------===//
|
|
//
|
|
// 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;
|
|
|
|
static cl::OptionCategory TransformCategory("Transforms");
|
|
|
|
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()),
|
|
cl::cat(TransformCategory)),
|
|
Creator));
|
|
}
|
|
|
|
void
|
|
Transforms::createSelectedTransforms(const TransformOptions &GlobalOptions) {
|
|
for (OptionVec::iterator I = Options.begin(),
|
|
E = Options.end(); I != E; ++I) {
|
|
if (*I->first) {
|
|
ChosenTransforms.push_back(I->second(GlobalOptions));
|
|
}
|
|
}
|
|
}
|