[cfe-commits] r134916 - in /cfe/trunk: include/clang-c/ARCMigrate.h include/clang-c/Index.h tools/c-arcmt-test/c-arcmt-test.c tools/libclang/ARCMigrate.cpp tools/libclang/libclang.darwin.exports tools/libclang/libclang.exports

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Jul 11 13:15:00 PDT 2011


Author: akirtzidis
Date: Mon Jul 11 15:15:00 2011
New Revision: 134916

URL: http://llvm.org/viewvc/llvm-project?rev=134916&view=rev
Log:
[arcmt] Move the remapping functions to clang-c/Index.h and change 'arcmt_' prefix to 'clang_'.

Removed:
    cfe/trunk/include/clang-c/ARCMigrate.h
Modified:
    cfe/trunk/include/clang-c/Index.h
    cfe/trunk/tools/c-arcmt-test/c-arcmt-test.c
    cfe/trunk/tools/libclang/ARCMigrate.cpp
    cfe/trunk/tools/libclang/libclang.darwin.exports
    cfe/trunk/tools/libclang/libclang.exports

Removed: cfe/trunk/include/clang-c/ARCMigrate.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/ARCMigrate.h?rev=134915&view=auto
==============================================================================
--- cfe/trunk/include/clang-c/ARCMigrate.h (original)
+++ cfe/trunk/include/clang-c/ARCMigrate.h (removed)
@@ -1,79 +0,0 @@
-/*===-- clang-c/ARCMigrate.h - ARC Migration Public C Interface ---*- C -*-===*\
-|*                                                                            *|
-|*                     The LLVM Compiler Infrastructure                       *|
-|*                                                                            *|
-|* This file is distributed under the University of Illinois Open Source      *|
-|* License. See LICENSE.TXT for details.                                      *|
-|*                                                                            *|
-|*===----------------------------------------------------------------------===*|
-|*                                                                            *|
-|* This header provides a public interface to a Clang library for migrating   *|
-|* objective-c source files to ARC mode.                                      *|
-|*                                                                            *|
-\*===----------------------------------------------------------------------===*/
-
-#ifndef CLANG_C_ARCMIGRATE_H
-#define CLANG_C_ARCMIGRATE_H
-
-#include "clang-c/Index.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** \defgroup CARCMT libclang: C Interface to Clang ARC migration library
- *
- * The C Interface provides a small API that exposes facilities for translating
- * objective-c source files of a project to Automatic Reference Counting mode.
- *
- * To avoid namespace pollution, data types are prefixed with "CMT" and
- * functions are prefixed with "arcmt_".
- *
- * @{
- */
-
-/**
- * \brief A remapping of original source files and their translated files.
- */
-typedef void *CMTRemap;
-
-/**
- * \brief Retrieve a remapping.
- *
- * \param migrate_dir_path the path that clang used during the migration process.
- *
- * \returns the requested remapping. This remapping must be freed
- * via a call to \c arcmt_remap_dispose(). Can return NULL if an error occurred.
- */
-CINDEX_LINKAGE CMTRemap arcmt_getRemappings(const char *migrate_dir_path);
-
-/**
- * \brief Determine the number of remappings.
- */
-CINDEX_LINKAGE unsigned arcmt_remap_getNumFiles(CMTRemap);
-
-/**
- * \brief Get the original filename.
- */
-CINDEX_LINKAGE CXString arcmt_remap_getOriginalFile(CMTRemap, unsigned index);
-
-/**
- * \brief Get the filename that the original file was translated into.
- */
-CINDEX_LINKAGE
-CXString arcmt_remap_getTransformedFile(CMTRemap, unsigned index);
-
-/**
- * \brief Dispose the remapping.
- */
-CINDEX_LINKAGE void arcmt_remap_dispose(CMTRemap);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=134916&r1=134915&r2=134916&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Mon Jul 11 15:15:00 2011
@@ -3190,6 +3190,51 @@
  * @}
  */
 
+/** \defgroup CINDEX_REMAPPING Remapping functions
+ *
+ * @{
+ */
+
+/**
+ * \brief A remapping of original source files and their translated files.
+ */
+typedef void *CXRemapping;
+
+/**
+ * \brief Retrieve a remapping.
+ *
+ * \param path the path that contains metadata about remappings.
+ *
+ * \returns the requested remapping. This remapping must be freed
+ * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
+ */
+CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path);
+
+/**
+ * \brief Determine the number of remappings.
+ */
+CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
+
+/**
+ * \brief Get the original and the associated filename from the remapping.
+ * 
+ * \param original If non-NULL, will be set to the original filename.
+ *
+ * \param transformed If non-NULL, will be set to the filename that the original
+ * is associated with.
+ */
+CINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index,
+                                     CXString *original, CXString *transformed);
+
+/**
+ * \brief Dispose the remapping.
+ */
+CINDEX_LINKAGE void clang_remap_dispose(CXRemapping);
+
+/**
+ * @}
+ */
+
 /**
  * @}
  */

Modified: cfe/trunk/tools/c-arcmt-test/c-arcmt-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-arcmt-test/c-arcmt-test.c?rev=134916&r1=134915&r2=134916&view=diff
==============================================================================
--- cfe/trunk/tools/c-arcmt-test/c-arcmt-test.c (original)
+++ cfe/trunk/tools/c-arcmt-test/c-arcmt-test.c Mon Jul 11 15:15:00 2011
@@ -1,6 +1,6 @@
 /* c-arcmt-test.c */
 
-#include "clang-c/ARCMigrate.h"
+#include "clang-c/Index.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -10,19 +10,18 @@
 #endif
 
 static int print_remappings(const char *path) {
-  CMTRemap remap;
+  CXRemapping remap;
   unsigned i, N;
   CXString origFname;
   CXString transFname;
 
-  remap = arcmt_getRemappings(path);
+  remap = clang_getRemappings(path);
   if (!remap)
     return 1;
 
-  N = arcmt_remap_getNumFiles(remap);
+  N = clang_remap_getNumFiles(remap);
   for (i = 0; i != N; ++i) {
-    origFname = arcmt_remap_getOriginalFile(remap, i);
-    transFname = arcmt_remap_getTransformedFile(remap, i);
+    clang_remap_getFilenames(remap, i, &origFname, &transFname);
 
     fprintf(stdout, "%s\n", clang_getCString(origFname));
     fprintf(stdout, "%s\n", clang_getCString(transFname));
@@ -31,7 +30,7 @@
     clang_disposeString(transFname);
   }
 
-  arcmt_remap_dispose(remap);
+  clang_remap_dispose(remap);
   return 0;
 }
 

Modified: cfe/trunk/tools/libclang/ARCMigrate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/ARCMigrate.cpp?rev=134916&r1=134915&r2=134916&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/ARCMigrate.cpp (original)
+++ cfe/trunk/tools/libclang/ARCMigrate.cpp Mon Jul 11 15:15:00 2011
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang-c/ARCMigrate.h"
+#include "clang-c/Index.h"
 
 #include "CXString.h"
 #include "clang/ARCMigrate/ARCMT.h"
@@ -35,12 +35,12 @@
 
 extern "C" {
 
-CMTRemap arcmt_getRemappings(const char *migrate_dir_path) {
+CXRemapping clang_getRemappings(const char *migrate_dir_path) {
   bool Logging = ::getenv("LIBCLANG_LOGGING");
 
   if (!migrate_dir_path) {
     if (Logging)
-      llvm::errs() << "arcmt_getRemappings was called with NULL parameter\n";
+      llvm::errs() << "clang_getRemappings was called with NULL parameter\n";
     return 0;
   }
 
@@ -48,7 +48,7 @@
   llvm::sys::fs::exists(migrate_dir_path, exists);
   if (!exists) {
     if (Logging) {
-      llvm::errs() << "Error by arcmt_getRemappings(\"" << migrate_dir_path
+      llvm::errs() << "Error by clang_getRemappings(\"" << migrate_dir_path
                    << "\")\n";
       llvm::errs() << "\"" << migrate_dir_path << "\" does not exist\n";
     }
@@ -62,7 +62,7 @@
 
   if (err) {
     if (Logging) {
-      llvm::errs() << "Error by arcmt_getRemappings(\"" << migrate_dir_path
+      llvm::errs() << "Error by clang_getRemappings(\"" << migrate_dir_path
                    << "\")\n";
       for (TextDiagnosticBuffer::const_iterator
              I = diagBuffer.err_begin(), E = diagBuffer.err_end(); I != E; ++I)
@@ -74,22 +74,24 @@
   return remap.take();
 }
 
-unsigned arcmt_remap_getNumFiles(CMTRemap map) {
+unsigned clang_remap_getNumFiles(CXRemapping map) {
   return static_cast<Remap *>(map)->Vec.size();
   
 }
 
-CXString arcmt_remap_getOriginalFile(CMTRemap map, unsigned index) {
-  return cxstring::createCXString(static_cast<Remap *>(map)->Vec[index].first,
+void clang_remap_getFilenames(CXRemapping map, unsigned index,
+                              CXString *original, CXString *transformed) {
+  if (original)
+    *original = cxstring::createCXString(
+                                    static_cast<Remap *>(map)->Vec[index].first,
+                                        /*DupString =*/ true);
+  if (transformed)
+    *transformed = cxstring::createCXString(
+                                   static_cast<Remap *>(map)->Vec[index].second,
                                   /*DupString =*/ true);
 }
 
-CXString arcmt_remap_getTransformedFile(CMTRemap map, unsigned index) {
-  return cxstring::createCXString(static_cast<Remap *>(map)->Vec[index].second,
-                                  /*DupString =*/ true);
-}
-
-void arcmt_remap_dispose(CMTRemap map) {
+void clang_remap_dispose(CXRemapping map) {
   delete static_cast<Remap *>(map);
 }
 

Modified: cfe/trunk/tools/libclang/libclang.darwin.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.darwin.exports?rev=134916&r1=134915&r2=134916&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/libclang.darwin.exports (original)
+++ cfe/trunk/tools/libclang/libclang.darwin.exports Mon Jul 11 15:15:00 2011
@@ -137,8 +137,7 @@
 _clang_tokenize
 _clang_visitChildren
 _clang_visitChildrenWithBlock
-_arcmt_getRemappings
-_arcmt_remap_getNumFiles
-_arcmt_remap_getOriginalFile
-_arcmt_remap_getTransformedFile
-_arcmt_remap_dispose
+_clang_getRemappings
+_clang_remap_getNumFiles
+_clang_remap_getFilenames
+_clang_remap_dispose

Modified: cfe/trunk/tools/libclang/libclang.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.exports?rev=134916&r1=134915&r2=134916&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/libclang.exports (original)
+++ cfe/trunk/tools/libclang/libclang.exports Mon Jul 11 15:15:00 2011
@@ -137,8 +137,7 @@
 clang_tokenize
 clang_visitChildren
 clang_visitChildrenWithBlock
-arcmt_getRemappings
-arcmt_remap_getNumFiles
-arcmt_remap_getOriginalFile
-arcmt_remap_getTransformedFile
-arcmt_remap_dispose
+clang_getRemappings
+clang_remap_getNumFiles
+clang_remap_getFilenames
+clang_remap_dispose





More information about the cfe-commits mailing list