aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-03-08 23:35:24 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-03-08 23:35:24 +0000
commit299a4a967b02c9f0d0d94ad8560e3ced893f9116 (patch)
tree977a7dbe9a61fe1329a0e7c014442ec963b3aa18 /include/clang
parentcf333339615da345c2ed6e873d94a501810d9f3f (diff)
Add 'OverridenFilesKeepOriginalName' field in SourceManager which if true the SourceManager
should report the original file name for contents of files that were overriden by other files, otherwise it should report the name of the new file. Default is true. Also add similar field in PreprocessorOptions and pass similar parameter in ASTUnit::LoadFromCommandLine. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127289 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Basic/SourceManager.h10
-rw-r--r--include/clang/Frontend/ASTUnit.h1
-rw-r--r--include/clang/Frontend/PreprocessorOptions.h5
3 files changed, 16 insertions, 0 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index dea0884042..799ee3438f 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -392,6 +392,10 @@ class SourceManager {
/// non-null, FileEntry pointers.
llvm::DenseMap<const FileEntry*, SrcMgr::ContentCache*> FileInfos;
+ /// \brief True if the ContentCache for files that are overriden by other
+ /// files, should report the original file name. Defaults to true.
+ bool OverridenFilesKeepOriginalName;
+
/// \brief Files that have been overriden with the contents from another file.
llvm::DenseMap<const FileEntry *, const FileEntry *> OverriddenFiles;
@@ -453,6 +457,12 @@ public:
FileManager &getFileManager() const { return FileMgr; }
+ /// \brief Set true if the SourceManager should report the original file name
+ /// for contents of files that were overriden by other files.Defaults to true.
+ void setOverridenFilesKeepOriginalName(bool value) {
+ OverridenFilesKeepOriginalName = value;
+ }
+
//===--------------------------------------------------------------------===//
// MainFileID creation and querying methods.
//===--------------------------------------------------------------------===//
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index e73d7fb687..3138d7db46 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -611,6 +611,7 @@ public:
bool CaptureDiagnostics = false,
RemappedFile *RemappedFiles = 0,
unsigned NumRemappedFiles = 0,
+ bool RemappedFilesKeepOriginalName = true,
bool PrecompilePreamble = false,
bool CompleteTranslationUnit = true,
bool CacheCodeCompletionResults = false,
diff --git a/include/clang/Frontend/PreprocessorOptions.h b/include/clang/Frontend/PreprocessorOptions.h
index 0d52e53ea1..078b22e719 100644
--- a/include/clang/Frontend/PreprocessorOptions.h
+++ b/include/clang/Frontend/PreprocessorOptions.h
@@ -73,6 +73,10 @@ public:
/// If given, a PTH cache file to use for speeding up header parsing.
std::string TokenCache;
+ /// \brief True if the SourceManager should report the original file name for
+ /// contents of files that were remapped to other files. Defaults to true.
+ bool RemappedFilesKeepOriginalName;
+
/// \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
@@ -132,6 +136,7 @@ public:
DisablePCHValidation(false), DisableStatCache(false),
DumpDeserializedPCHDecls(false),
PrecompiledPreambleBytes(0, true),
+ RemappedFilesKeepOriginalName(true),
RetainRemappedFileBuffers(false) { }
void addMacroDef(llvm::StringRef Name) {