* 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
};
/**
/// \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,
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.
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.
/// 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;
public:
PreprocessorOptions() : UsePredefines(true), DetailedRecord(false),
- DetailedRecordIncludesNestedMacroInstantiations(true),
+ DetailedRecordIncludesNestedMacroExpansions(true),
DisablePCHValidation(false), DisableStatCache(false),
DumpDeserializedPCHDecls(false),
PrecompiledPreambleBytes(0, true),
ConcurrencyCheckValue(CheckUnlocked),
PreambleRebuildCounter(0), SavedMainFileBuffer(0), PreambleBuffer(0),
ShouldCacheCodeCompletionResults(false),
- NestedMacroInstantiations(true),
+ NestedMacroExpansions(true),
CompletionCacheTopLevelHashValue(0),
PreambleTopLevelHashValue(0),
CurrentTopLevelHashValue(0),
// 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);
bool PrecompilePreamble,
bool CompleteTranslationUnit,
bool CacheCodeCompletionResults,
- bool NestedMacroInstantiations) {
+ bool NestedMacroExpansions) {
// Create the AST unit.
llvm::OwningPtr<ASTUnit> AST;
AST.reset(new ASTUnit(false));
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>
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.
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>
if (PPOpts.DetailedRecord)
PP->createPreprocessingRecord(
- PPOpts.DetailedRecordIncludesNestedMacroInstantiations);
+ PPOpts.DetailedRecordIncludesNestedMacroExpansions);
InitializePreprocessor(*PP, PPOpts, HSOpts, FEOpts);
if (getenv("CINDEXTEST_COMPLETION_CACHING"))
options |= CXTranslationUnit_CacheCompletionResults;
if (getenv("CINDEXTEST_NESTED_MACROS"))
- options |= CXTranslationUnit_NestedMacroInstantiations;
+ options |= CXTranslationUnit_NestedMacroExpansions;
return options;
}
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,
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();
CacheCodeCompetionResults,
CXXPrecompilePreamble,
CXXChainedPCH,
- NestedMacroInstantiations));
+ NestedMacroExpansions));
if (NumErrors != Diags->getClient()->getNumErrors()) {
// Make sure to check that 'Unit' is non-NULL.