[cfe-commits] r165281 - in /cfe/trunk: include/clang-c/Index.h tools/c-index-test/c-index-test.c tools/libclang/IndexingContext.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Oct 4 17:22:41 PDT 2012


Author: akirtzidis
Date: Thu Oct  4 19:22:40 2012
New Revision: 165281

URL: http://llvm.org/viewvc/llvm-project?rev=165281&view=rev
Log:
[libclang] Now that we have a CXModule object, pass it to the
importedASTFile indexing callback.

Modified:
    cfe/trunk/include/clang-c/Index.h
    cfe/trunk/tools/c-index-test/c-index-test.c
    cfe/trunk/tools/libclang/IndexingContext.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=165281&r1=165280&r2=165281&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Thu Oct  4 19:22:40 2012
@@ -4992,24 +4992,18 @@
    */
   CXFile file;
   /**
-   * \brief Location where the file is imported. Applicable only for modules.
+   * \brief The imported module or NULL if the AST file is a PCH.
    */
-  CXIdxLoc loc;
+  CXModule module;
   /**
-   * \brief Non-zero if the AST file is a module otherwise it's a PCH.
+   * \brief Location where the file is imported. Applicable only for modules.
    */
-  int isModule;
+  CXIdxLoc loc;
   /**
    * \brief Non-zero if an inclusion directive was automatically turned into
-   * a module import.
+   * a module import. Applicable only for modules.
    */
   int isImplicit;
-  /**
-   * \brief The actual name of the module or submodule being imported.
-   * The syntax is a sequence of identifiers separated by dots, e.g "std.vector"
-   * Applicable only for modules.
-   */
-  const char *moduleName;
 
 } CXIdxImportedASTFileInfo;
 

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=165281&r1=165280&r2=165281&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Thu Oct  4 19:22:40 2012
@@ -2376,11 +2376,14 @@
 
   printf("[importedASTFile]: ");
   printCXIndexFile((CXIdxClientFile)info->file);
-  printf(" | loc: ");
-  printCXIndexLoc(info->loc, client_data);
-  printf(" | name: \"%s\"", info->moduleName);
-  printf(" | isModule: %d | isImplicit: %d\n",
-         info->isModule, info->isImplicit);
+  if (info->module) {
+    CXString name = clang_Module_getFullName(info->module);
+    printf(" | loc: ");
+    printCXIndexLoc(info->loc, client_data);
+    printf(" | name: \"%s\"", clang_getCString(name));
+    printf(" | isImplicit: %d\n", info->isImplicit);
+    clang_disposeString(name);
+  }
 
   return (CXIdxClientFile)info->file;
 }

Modified: cfe/trunk/tools/libclang/IndexingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.cpp?rev=165281&r1=165280&r2=165281&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.cpp (original)
+++ cfe/trunk/tools/libclang/IndexingContext.cpp Thu Oct  4 19:22:40 2012
@@ -264,10 +264,9 @@
 
   CXIdxImportedASTFileInfo Info = {
                                     (CXFile)Mod->getASTFile(),
+                                    Mod,
                                     getIndexLoc(ImportD->getLocation()),
-                                    /*isModule=*/true,
-                                    ImportD->isImplicit(),
-                                    ModuleName.c_str(),
+                                    ImportD->isImplicit()
                                   };
   CXIdxClientASTFile astFile = CB.importedASTFile(ClientData, &Info);
   (void)astFile;
@@ -279,10 +278,9 @@
 
   CXIdxImportedASTFileInfo Info = {
                                     (CXFile)File,
+                                    /*module=*/NULL,
                                     getIndexLoc(SourceLocation()),
-                                    /*isModule=*/false,
-                                    /*isImplicit=*/false,
-                                    /*moduleName=*/NULL
+                                    /*isImplicit=*/false
                                   };
   CXIdxClientASTFile astFile = CB.importedASTFile(ClientData, &Info);
   (void)astFile;





More information about the cfe-commits mailing list