[PATCH] cpp11-migrate: Add EnableHeaderModification flag
Edwin Vane
edwin.vane at intel.com
Thu Jun 6 13:25:28 PDT 2013
Real reviewer fixes
Hi tareqsiraj, arielbernal,
http://llvm-reviews.chandlerc.com/D932
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D932?vs=2305&id=2306#toc
Files:
cpp11-migrate/Core/Transform.h
cpp11-migrate/tool/Cpp11Migrate.cpp
Index: cpp11-migrate/Core/Transform.h
===================================================================
--- cpp11-migrate/Core/Transform.h
+++ cpp11-migrate/Core/Transform.h
@@ -111,6 +111,15 @@
/// \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;
};
Index: cpp11-migrate/tool/Cpp11Migrate.cpp
===================================================================
--- cpp11-migrate/tool/Cpp11Migrate.cpp
+++ cpp11-migrate/tool/Cpp11Migrate.cpp
@@ -79,6 +79,15 @@
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 @@
// 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()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D932.3.patch
Type: text/x-patch
Size: 2260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130606/992c0f9c/attachment.bin>
More information about the cfe-commits
mailing list