diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-02 08:08:39 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-02 08:08:39 +0000 |
commit | 716f0b3e2e36f362b64a2ce0a40a9ad915103255 (patch) | |
tree | 2991e194250a39dd3a6016af8a91dce1afa92f96 /include/clang/Frontend/PreprocessorOptions.h | |
parent | 0bd6feb9e9d40fc889fd47e899985125a43dfed8 (diff) |
Introduce a new clang-cc option
-remap-file=from;to
which takes the file "from" and transparently replaces its contents
with the contents of the file "to" from the source manager's
perspective. This is the moral equivalent of
cp from saved
cp to from
<call clang>
cp saved from
rm saved
without all of the pesky file copying.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90307 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/PreprocessorOptions.h')
-rw-r--r-- | include/clang/Frontend/PreprocessorOptions.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/clang/Frontend/PreprocessorOptions.h b/include/clang/Frontend/PreprocessorOptions.h index f0c1d3c2c3..c43a1feb8c 100644 --- a/include/clang/Frontend/PreprocessorOptions.h +++ b/include/clang/Frontend/PreprocessorOptions.h @@ -13,6 +13,7 @@ #include "llvm/ADT/StringRef.h" #include <cassert> #include <string> +#include <utility> #include <vector> namespace clang { @@ -41,6 +42,21 @@ public: /// If given, a PTH cache file to use for speeding up header parsing. std::string TokenCache; + /// \brief The set of file remappings, which take existing files on + /// the system (the first part of each pair) and gives them the + /// contents of other files on the system (the second part of each + /// pair). + std::vector<std::pair<std::string, std::string> > RemappedFiles; + + typedef std::vector<std::pair<std::string, std::string> >::const_iterator + remapped_file_iterator; + remapped_file_iterator remapped_file_begin() const { + return RemappedFiles.begin(); + } + remapped_file_iterator remapped_file_end() const { + return RemappedFiles.end(); + } + public: PreprocessorOptions() : UsePredefines(true) {} @@ -50,6 +66,9 @@ public: void addMacroUndef(llvm::StringRef Name) { Macros.push_back(std::make_pair(Name, true)); } + void addRemappedFile(llvm::StringRef From, llvm::StringRef To) { + RemappedFiles.push_back(std::make_pair(From, To)); + } }; } // end namespace clang |