summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
authorEvgeny Mankov <evgeny.mankov@gmail.com>2019-08-27 22:15:32 +0000
committerEvgeny Mankov <evgeny.mankov@gmail.com>2019-08-27 22:15:32 +0000
commit2ed2e62498b7cccf951b7c671498625cecd2a862 (patch)
tree55eec008498bc42eae38b77d850d0c7e8a042a48 /clang/include
parent1fac68b0dc19b03fd2c5e9856f0f2c5a11691348 (diff)
downloadbcm5719-llvm-2ed2e62498b7cccf951b7c671498625cecd2a862.tar.gz
bcm5719-llvm-2ed2e62498b7cccf951b7c671498625cecd2a862.zip
[preprocessor] Add an opportunity to retain excluded conditional blocks
It is handy for clang tooling, for instance, in source to source transformation. Reviewers: vpykhtin (Valery Pykhtin), erichkeane (Erich Keane) Subscribers: rsmith (Richard Smith), akyrtzi (Argyrios Kyrtzidis) Tags: #clang Differential Revision: https://reviews.llvm.org/D66597 llvm-svn: 370123
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang-c/Index.h7
-rw-r--r--clang/include/clang/Frontend/ASTUnit.h1
-rw-r--r--clang/include/clang/Lex/PreprocessorOptions.h4
3 files changed, 11 insertions, 1 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 74badac740b..bdce233ce8b 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -1356,7 +1356,12 @@ enum CXTranslationUnit_Flags {
* the case where these warnings are not of interest, as for an IDE for
* example, which typically shows only the diagnostics in the main file.
*/
- CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000
+ CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000,
+
+ /**
+ * Tells the preprocessor not to skip excluded conditional blocks.
+ */
+ CXTranslationUnit_RetainExcludedConditionalBlocks = 0x8000,
};
/**
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h
index 08cc91946eb..a36655150d4 100644
--- a/clang/include/clang/Frontend/ASTUnit.h
+++ b/clang/include/clang/Frontend/ASTUnit.h
@@ -832,6 +832,7 @@ public:
SkipFunctionBodiesScope::None,
bool SingleFileParse = false, bool UserFilesAreVolatile = false,
bool ForSerialization = false,
+ bool RetainExcludedConditionalBlocks = false,
llvm::Optional<StringRef> ModuleFormat = llvm::None,
std::unique_ptr<ASTUnit> *ErrAST = nullptr,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
diff --git a/clang/include/clang/Lex/PreprocessorOptions.h b/clang/include/clang/Lex/PreprocessorOptions.h
index 1480548c7fb..8824f0a51d0 100644
--- a/clang/include/clang/Lex/PreprocessorOptions.h
+++ b/clang/include/clang/Lex/PreprocessorOptions.h
@@ -142,6 +142,9 @@ public:
/// compiler invocation and its buffers will be reused.
bool RetainRemappedFileBuffers = false;
+ /// When enabled, excluded conditional blocks retain in the main file.
+ bool RetainExcludedConditionalBlocks = false;
+
/// The Objective-C++ ARC standard library that we should support,
/// by providing appropriate definitions to retrofit the standard library
/// with support for lifetime-qualified pointers.
@@ -201,6 +204,7 @@ public:
RetainRemappedFileBuffers = true;
PrecompiledPreambleBytes.first = 0;
PrecompiledPreambleBytes.second = false;
+ RetainExcludedConditionalBlocks = false;
}
};
OpenPOWER on IntegriCloud