summaryrefslogtreecommitdiffstats
path: root/include/clang
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-06-05 18:10:11 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-06-05 18:10:11 +0000
commit1a6f43b655762d6b70594e47013ad8f14a12480d (patch)
tree7896058bd19ac7d824a1e20992fc6a9e8adb3b9d /include/clang
parentffdad0d2b5776a6741ca9d26401e7f72c99949b3 (diff)
Rather than rejecting attempts to run preprocessor-only actions on AST files,
replay the steps taken to create the AST file with the preprocessor-only action installed to produce preprocessed output. This can be used to produce the preprocessed text for an existing .pch or .pcm file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Basic/LangOptions.h1
-rw-r--r--include/clang/Basic/SourceManager.h4
-rw-r--r--include/clang/Frontend/ASTUnit.h7
-rw-r--r--include/clang/Frontend/FrontendAction.h4
4 files changed, 11 insertions, 5 deletions
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h
index 2513de70e7..8488515d2b 100644
--- a/include/clang/Basic/LangOptions.h
+++ b/include/clang/Basic/LangOptions.h
@@ -58,6 +58,7 @@ public:
SOB_Trapping // -ftrapv
};
+ // FIXME: Unify with TUKind.
enum CompilingModuleKind {
CMK_None, ///< Not compiling a module interface at all.
CMK_ModuleMap, ///< Compiling a module from a module map.
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index eda8029340..5e01f64167 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -722,6 +722,10 @@ public:
void clearIDTables();
+ /// Initialize this source manager suitably to replay the compilation
+ /// described by \p Old. Requires that \p Old outlive \p *this.
+ void initializeForReplay(const SourceManager &Old);
+
DiagnosticsEngine &getDiagnostics() const { return Diag; }
FileManager &getFileManager() const { return FileMgr; }
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index fb0a5e8acd..a2a1796cd3 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -51,6 +51,7 @@ class DiagnosticsEngine;
class FileEntry;
class FileManager;
class HeaderSearch;
+class InputKind;
class MemoryBufferCache;
class Preprocessor;
class PCHContainerOperations;
@@ -305,9 +306,6 @@ private:
/// (likely to change while trying to use them).
bool UserFilesAreVolatile : 1;
- /// \brief The language options used when we load an AST file.
- LangOptions ASTFileLangOpts;
-
static void ConfigureDiags(IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
ASTUnit &AST, bool CaptureDiagnostics);
@@ -702,6 +700,9 @@ public:
/// \brief Determine what kind of translation unit this AST represents.
TranslationUnitKind getTranslationUnitKind() const { return TUKind; }
+ /// \brief Determine the input kind this AST unit represents.
+ InputKind getInputKind() const;
+
/// \brief A mapping from a file name to the memory buffer that stores the
/// remapped contents of that file.
typedef std::pair<std::string, llvm::MemoryBuffer *> RemappedFile;
diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h
index 8d690a448f..07dfa5e6b7 100644
--- a/include/clang/Frontend/FrontendAction.h
+++ b/include/clang/Frontend/FrontendAction.h
@@ -176,10 +176,10 @@ public:
virtual TranslationUnitKind getTranslationUnitKind() { return TU_Complete; }
/// \brief Does this action support use with PCH?
- virtual bool hasPCHSupport() const { return !usesPreprocessorOnly(); }
+ virtual bool hasPCHSupport() const { return true; }
/// \brief Does this action support use with AST files?
- virtual bool hasASTFileSupport() const { return !usesPreprocessorOnly(); }
+ virtual bool hasASTFileSupport() const { return true; }
/// \brief Does this action support use with IR files?
virtual bool hasIRSupport() const { return false; }