aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-07-14 09:02:10 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-07-14 09:02:10 +0000
commitba7537febdf1bc1cc617e1f1746f2644feba6274 (patch)
tree4b82c8fc60290708030914856cc6987a212996f0
parent9b2a0ac970a077bdc0bf08c6c682f80ad733c892 (diff)
NestedMacroInstantiations -> NestedMacroExpansions
This is switches all the interfaces points (and most of the commenst / local variables I saw on my way through) regarding the NestedMacroInstantiations bit. The libclang enums corresponding to this state were renamed, but a legacy enum was added with the old name, and the same value to keep existing clients working. I've added a documentation blurb for it, but let me know if there is a canonical way to document legacy elemenst of the libclang interface. No functionality changed here, even in tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135141 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang-c/Index.h12
-rw-r--r--include/clang/Frontend/ASTUnit.h8
-rw-r--r--include/clang/Frontend/PreprocessorOptions.h6
-rw-r--r--lib/Frontend/ASTUnit.cpp14
-rw-r--r--lib/Frontend/CompilerInstance.cpp2
-rw-r--r--tools/c-index-test/c-index-test.c2
-rw-r--r--tools/libclang/CIndex.cpp10
7 files changed, 32 insertions, 22 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 858b2ce4fc..b9197b86e7 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -840,7 +840,17 @@ enum CXTranslationUnit_Flags {
* a large amount of storage to due preprocessor metaprogramming. Moreover,
* its fairly rare that this information is useful for libclang clients.
*/
- CXTranslationUnit_NestedMacroInstantiations = 0x40
+ CXTranslationUnit_NestedMacroExpansions = 0x40,
+
+ /**
+ * \brief Legacy name to indicate that the "detailed" preprocessing record,
+ * if requested, should contain nested macro instantiations.
+ *
+ * \see CXTranslationUnit_NestedMacroExpansions for the current name for this
+ * value, and its semantics. This is just an alias.
+ */
+ CXTranslationUnit_NestedMacroInstantiations =
+ CXTranslationUnit_NestedMacroExpansions
};
/**
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index b475880fb8..58a60a1f9d 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -249,9 +249,9 @@ private:
/// \brief Whether we should be caching code-completion results.
bool ShouldCacheCodeCompletionResults;
- /// \brief Whether we want to include nested macro instantiations in the
+ /// \brief Whether we want to include nested macro expansions in the
/// detailed preprocessing record.
- bool NestedMacroInstantiations;
+ bool NestedMacroExpansions;
static void ConfigureDiags(llvm::IntrusiveRefCntPtr<Diagnostic> &Diags,
const char **ArgBegin, const char **ArgEnd,
@@ -612,7 +612,7 @@ public:
bool PrecompilePreamble = false,
bool CompleteTranslationUnit = true,
bool CacheCodeCompletionResults = false,
- bool NestedMacroInstantiations = true);
+ bool NestedMacroExpansions = true);
/// LoadFromCommandLine - Create an ASTUnit from a vector of command line
/// arguments, which must specify exactly one source file.
@@ -642,7 +642,7 @@ public:
bool CacheCodeCompletionResults = false,
bool CXXPrecompilePreamble = false,
bool CXXChainedPCH = false,
- bool NestedMacroInstantiations = true);
+ bool NestedMacroExpansions = true);
/// \brief Reparse the source files using the same command-line options that
/// were originally used to produce this translation unit.
diff --git a/include/clang/Frontend/PreprocessorOptions.h b/include/clang/Frontend/PreprocessorOptions.h
index 5ab4ed51d4..8856805534 100644
--- a/include/clang/Frontend/PreprocessorOptions.h
+++ b/include/clang/Frontend/PreprocessorOptions.h
@@ -51,8 +51,8 @@ public:
/// instantiations.
/// \brief Whether the detailed preprocessing record includes nested macro
- /// instantiations.
- unsigned DetailedRecordIncludesNestedMacroInstantiations : 1;
+ /// expansions.
+ unsigned DetailedRecordIncludesNestedMacroExpansions : 1;
/// The implicit PCH included at the start of the translation unit, or empty.
std::string ImplicitPCHInclude;
@@ -154,7 +154,7 @@ public:
public:
PreprocessorOptions() : UsePredefines(true), DetailedRecord(false),
- DetailedRecordIncludesNestedMacroInstantiations(true),
+ DetailedRecordIncludesNestedMacroExpansions(true),
DisablePCHValidation(false), DisableStatCache(false),
DumpDeserializedPCHDecls(false),
PrecompiledPreambleBytes(0, true),
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index ad476455eb..5b0a52c65b 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -102,7 +102,7 @@ ASTUnit::ASTUnit(bool _MainFileIsAST)
ConcurrencyCheckValue(CheckUnlocked),
PreambleRebuildCounter(0), SavedMainFileBuffer(0), PreambleBuffer(0),
ShouldCacheCodeCompletionResults(false),
- NestedMacroInstantiations(true),
+ NestedMacroExpansions(true),
CompletionCacheTopLevelHashValue(0),
PreambleTopLevelHashValue(0),
CurrentTopLevelHashValue(0),
@@ -934,8 +934,8 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) {
// If the main file has been overridden due to the use of a preamble,
// make that override happen and introduce the preamble.
PreprocessorOptions &PreprocessorOpts = Clang->getPreprocessorOpts();
- PreprocessorOpts.DetailedRecordIncludesNestedMacroInstantiations
- = NestedMacroInstantiations;
+ PreprocessorOpts.DetailedRecordIncludesNestedMacroExpansions
+ = NestedMacroExpansions;
std::string PriorImplicitPCHInclude;
if (OverrideMainBuffer) {
PreprocessorOpts.addRemappedFile(OriginalSourceFile, OverrideMainBuffer);
@@ -1725,7 +1725,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI,
bool PrecompilePreamble,
bool CompleteTranslationUnit,
bool CacheCodeCompletionResults,
- bool NestedMacroInstantiations) {
+ bool NestedMacroExpansions) {
// Create the AST unit.
llvm::OwningPtr<ASTUnit> AST;
AST.reset(new ASTUnit(false));
@@ -1736,7 +1736,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI,
AST->CompleteTranslationUnit = CompleteTranslationUnit;
AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
AST->Invocation = CI;
- AST->NestedMacroInstantiations = NestedMacroInstantiations;
+ AST->NestedMacroExpansions = NestedMacroExpansions;
// Recover resources if we crash before exiting this method.
llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit>
@@ -1762,7 +1762,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin,
bool CacheCodeCompletionResults,
bool CXXPrecompilePreamble,
bool CXXChainedPCH,
- bool NestedMacroInstantiations) {
+ bool NestedMacroExpansions) {
if (!Diags.getPtr()) {
// No diagnostics engine was provided, so create our own diagnostics object
// with the default options.
@@ -1829,7 +1829,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin,
AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();
AST->StoredDiagnostics.swap(StoredDiagnostics);
AST->Invocation = CI;
- AST->NestedMacroInstantiations = NestedMacroInstantiations;
+ AST->NestedMacroExpansions = NestedMacroExpansions;
// Recover resources if we crash before exiting this method.
llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit>
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index cb91c89e46..c58e3af508 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -229,7 +229,7 @@ CompilerInstance::createPreprocessor(Diagnostic &Diags,
if (PPOpts.DetailedRecord)
PP->createPreprocessingRecord(
- PPOpts.DetailedRecordIncludesNestedMacroInstantiations);
+ PPOpts.DetailedRecordIncludesNestedMacroExpansions);
InitializePreprocessor(*PP, PPOpts, HSOpts, FEOpts);
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index e574b872ae..6e0aaac73c 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -38,7 +38,7 @@ static unsigned getDefaultParsingOptions() {
if (getenv("CINDEXTEST_COMPLETION_CACHING"))
options |= CXTranslationUnit_CacheCompletionResults;
if (getenv("CINDEXTEST_NESTED_MACROS"))
- options |= CXTranslationUnit_NestedMacroInstantiations;
+ options |= CXTranslationUnit_NestedMacroExpansions;
return options;
}
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 02ef6f82c2..c78584a3a7 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -2391,7 +2391,7 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx,
unsigned num_unsaved_files,
struct CXUnsavedFile *unsaved_files) {
unsigned Options = CXTranslationUnit_DetailedPreprocessingRecord |
- CXTranslationUnit_NestedMacroInstantiations;
+ CXTranslationUnit_NestedMacroExpansions;
return clang_parseTranslationUnit(CIdx, source_filename,
command_line_args, num_command_line_args,
unsaved_files, num_unsaved_files,
@@ -2496,12 +2496,12 @@ static void clang_parseTranslationUnit_Impl(void *UserData) {
Args->push_back(source_filename);
// Do we need the detailed preprocessing record?
- bool NestedMacroInstantiations = false;
+ bool NestedMacroExpansions = false;
if (options & CXTranslationUnit_DetailedPreprocessingRecord) {
Args->push_back("-Xclang");
Args->push_back("-detailed-preprocessing-record");
- NestedMacroInstantiations
- = (options & CXTranslationUnit_NestedMacroInstantiations);
+ NestedMacroExpansions
+ = (options & CXTranslationUnit_NestedMacroExpansions);
}
unsigned NumErrors = Diags->getClient()->getNumErrors();
@@ -2521,7 +2521,7 @@ static void clang_parseTranslationUnit_Impl(void *UserData) {
CacheCodeCompetionResults,
CXXPrecompilePreamble,
CXXChainedPCH,
- NestedMacroInstantiations));
+ NestedMacroExpansions));
if (NumErrors != Diags->getClient()->getNumErrors()) {
// Make sure to check that 'Unit' is non-NULL.