]> granicus.if.org Git - clang/commitdiff
NestedMacroInstantiations -> NestedMacroExpansions
authorChandler Carruth <chandlerc@gmail.com>
Thu, 14 Jul 2011 09:02:10 +0000 (09:02 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 14 Jul 2011 09:02:10 +0000 (09:02 +0000)
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

include/clang-c/Index.h
include/clang/Frontend/ASTUnit.h
include/clang/Frontend/PreprocessorOptions.h
lib/Frontend/ASTUnit.cpp
lib/Frontend/CompilerInstance.cpp
tools/c-index-test/c-index-test.c
tools/libclang/CIndex.cpp

index 858b2ce4fc81a9774b4c56fbfb10abdbfcbaa19b..b9197b86e78af8e9c59f94d5df0e109789bc2bcf 100644 (file)
@@ -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
 };
 
 /**
index b475880fb8e069c50044c7d2e3cb2c97bc8205dc..58a60a1f9d872b8f59acb6b7d51064e987c6f2a7 100644 (file)
@@ -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.
index 5ab4ed51d4fa5050291b85b66cd19b6759723b77..8856805534bd82d370a6cb16148eca70a9c83b40 100644 (file)
@@ -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),
index ad476455ebc91051d1766a8b5c3747fe404888d1..5b0a52c65b8463eb99eb7cdb06efb59731b253a3 100644 (file)
@@ -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>
index cb91c89e46cafef7004c04bc988718c34a2f6cdd..c58e3af5089b3ea79c650bb482eb9b816ba790f7 100644 (file)
@@ -229,7 +229,7 @@ CompilerInstance::createPreprocessor(Diagnostic &Diags,
 
   if (PPOpts.DetailedRecord)
     PP->createPreprocessingRecord(
-                       PPOpts.DetailedRecordIncludesNestedMacroInstantiations);
+                       PPOpts.DetailedRecordIncludesNestedMacroExpansions);
   
   InitializePreprocessor(*PP, PPOpts, HSOpts, FEOpts);
 
index e574b872ae2d381a8431b7022844e7b0f62a067a..6e0aaac73cc37fb9f003df2069205c84463c501b 100644 (file)
@@ -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;
 }
index 02ef6f82c2a042ced83bbf869ec6d6674ae17ac7..c78584a3a72a6b2d13d99e55fe2cd17f76f909d5 100644 (file)
@@ -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.