[clang-tools-extra] r183444 - cpp11-migrate: Add EnableHeaderModification flag
Edwin Vane
edwin.vane at intel.com
Thu Jun 6 13:32:29 PDT 2013
Author: revane
Date: Thu Jun 6 15:32:29 2013
New Revision: 183444
URL: http://llvm.org/viewvc/llvm-project?rev=183444&view=rev
Log:
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.
Modified:
clang-tools-extra/trunk/cpp11-migrate/Core/Transform.h
clang-tools-extra/trunk/cpp11-migrate/tool/Cpp11Migrate.cpp
Modified: clang-tools-extra/trunk/cpp11-migrate/Core/Transform.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/cpp11-migrate/Core/Transform.h?rev=183444&r1=183443&r2=183444&view=diff
==============================================================================
--- clang-tools-extra/trunk/cpp11-migrate/Core/Transform.h (original)
+++ clang-tools-extra/trunk/cpp11-migrate/Core/Transform.h Thu Jun 6 15:32:29 2013
@@ -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;
};
Modified: clang-tools-extra/trunk/cpp11-migrate/tool/Cpp11Migrate.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/cpp11-migrate/tool/Cpp11Migrate.cpp?rev=183444&r1=183443&r2=183444&view=diff
==============================================================================
--- clang-tools-extra/trunk/cpp11-migrate/tool/Cpp11Migrate.cpp (original)
+++ clang-tools-extra/trunk/cpp11-migrate/tool/Cpp11Migrate.cpp Thu Jun 6 15:32:29 2013
@@ -79,6 +79,15 @@ ExcludeFromFile("exclude-from", cl::Hidd
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()) {
More information about the cfe-commits
mailing list