diff options
author | Edwin Vane <edwin.vane@intel.com> | 2013-06-06 20:32:29 +0000 |
---|---|---|
committer | Edwin Vane <edwin.vane@intel.com> | 2013-06-06 20:32:29 +0000 |
commit | 622dacd669c382d1b9114f0b8f52ea93578b4876 (patch) | |
tree | a5ae34354a7944d3f9b63a8e6f85250c0c3cec5b /clang-tools-extra | |
parent | 32e3553f838ed05d21b6df2e02f88340c645b5a6 (diff) | |
download | bcm5719-llvm-622dacd669c382d1b9114f0b8f52ea93578b4876.tar.gz bcm5719-llvm-622dacd669c382d1b9114f0b8f52ea93578b4876.zip |
cpp11-migrate: Add EnableHeaderModification flag
First step toward supporting header modifications: adding a flag that turns on
such modifications. Eventually header modifications will be on by default but
until all the kinks can be worked out, they must be explicitly enabled.
llvm-svn: 183444
Diffstat (limited to 'clang-tools-extra')
-rw-r--r-- | clang-tools-extra/cpp11-migrate/Core/Transform.h | 9 | ||||
-rw-r--r-- | clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp | 18 |
2 files changed, 27 insertions, 0 deletions
diff --git a/clang-tools-extra/cpp11-migrate/Core/Transform.h b/clang-tools-extra/cpp11-migrate/Core/Transform.h index 264b59526a7..17ec6ce9120 100644 --- a/clang-tools-extra/cpp11-migrate/Core/Transform.h +++ b/clang-tools-extra/cpp11-migrate/Core/Transform.h @@ -111,6 +111,15 @@ struct TransformOptions { /// \brief Enable the use of performance timers. bool EnableTiming; + /// \brief Allow changes to headers included from the main source file. + /// Transform sub-classes should use ModifiableHeaders to determine which + /// headers are modifiable and which are not. + bool EnableHeaderModifications; + + /// \brief Contains information on which headers are safe to transform and + /// which aren't. + IncludeExcludeInfo ModifiableHeaders; + /// \brief Maximum allowed level of risk. RiskLevel MaxRiskLevel; }; diff --git a/clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp b/clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp index cd2e653fbc6..da9edb460af 100644 --- a/clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp +++ b/clang-tools-extra/cpp11-migrate/tool/Cpp11Migrate.cpp @@ -79,6 +79,15 @@ ExcludeFromFile("exclude-from", cl::Hidden, cl::value_desc("filename"), cl::desc("File containing a list of paths that can not be " "transforms")); +// Header modifications will probably be always on eventually. For now, they +// need to be explicitly enabled. +static cl::opt<bool, /*ExternalStorage=*/true> EnableHeaderModifications( + "headers", + cl::Hidden, // Experimental feature for now. + cl::desc("Enable modifications to headers"), + cl::location(GlobalOptions.EnableHeaderModifications), + cl::init(false)); + class EndSyntaxArgumentsAdjuster : public ArgumentsAdjuster { CommandLineArguments Adjust(const CommandLineArguments &Args) { CommandLineArguments AdjustedArgs = Args; @@ -113,6 +122,15 @@ int main(int argc, const char **argv) { // against the default value when the command line option is not specified. GlobalOptions.EnableTiming = (TimingDirectoryName != NoTiming); + // Populate the ModifiableHeaders structure if header modifications are + // enabled. + if (GlobalOptions.EnableHeaderModifications) { + GlobalOptions.ModifiableHeaders + .readListFromString(IncludePaths, ExcludePaths); + GlobalOptions.ModifiableHeaders + .readListFromFile(IncludeFromFile, ExcludeFromFile); + } + TransformManager.createSelectedTransforms(GlobalOptions); if (TransformManager.begin() == TransformManager.end()) { |