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. llvm-svn: 135141
This commit is contained in:
parent
9e4704ab07
commit
de81fc8557
|
@ -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
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -229,7 +229,7 @@ CompilerInstance::createPreprocessor(Diagnostic &Diags,
|
|||
|
||||
if (PPOpts.DetailedRecord)
|
||||
PP->createPreprocessingRecord(
|
||||
PPOpts.DetailedRecordIncludesNestedMacroInstantiations);
|
||||
PPOpts.DetailedRecordIncludesNestedMacroExpansions);
|
||||
|
||||
InitializePreprocessor(*PP, PPOpts, HSOpts, FEOpts);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue