[llvm-branch-commits] [cfe-branch] r119416 - in /cfe/branches/Apple/whitney: include/clang-c/Index.h tools/c-index-test/c-index-test.c tools/libclang/CIndex.cpp tools/libclang/CIndexCXX.cpp tools/libclang/CIndexCodeCompletion.cpp tools/libclang/CIndexDiagnostic.cpp tools/libclang/CIndexUSRs.cpp tools/libclang/CIndexer.h tools/libclang/CMakeLists.txt tools/libclang/CXCursor.cpp tools/libclang/CXType.cpp
Daniel Dunbar
daniel at zuster.org
Tue Nov 16 16:23:29 PST 2010
Author: ddunbar
Date: Tue Nov 16 18:23:29 2010
New Revision: 119416
URL: http://llvm.org/viewvc/llvm-project?rev=119416&view=rev
Log:
Merge r119319:
--
Author: Ted Kremenek <kremenek at apple.com>
Date: Tue Nov 16 01:56:27 2010 +0000
Move CXString creation/management routines into
their own .cpp file and make the interpretation
of its flags private.
Modified:
cfe/branches/Apple/whitney/include/clang-c/Index.h
cfe/branches/Apple/whitney/tools/c-index-test/c-index-test.c
cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp
cfe/branches/Apple/whitney/tools/libclang/CIndexCXX.cpp
cfe/branches/Apple/whitney/tools/libclang/CIndexCodeCompletion.cpp
cfe/branches/Apple/whitney/tools/libclang/CIndexDiagnostic.cpp
cfe/branches/Apple/whitney/tools/libclang/CIndexUSRs.cpp
cfe/branches/Apple/whitney/tools/libclang/CIndexer.h
cfe/branches/Apple/whitney/tools/libclang/CMakeLists.txt
cfe/branches/Apple/whitney/tools/libclang/CXCursor.cpp
cfe/branches/Apple/whitney/tools/libclang/CXType.cpp
Modified: cfe/branches/Apple/whitney/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang-c/Index.h?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang-c/Index.h (original)
+++ cfe/branches/Apple/whitney/include/clang-c/Index.h Tue Nov 16 18:23:29 2010
@@ -134,9 +134,7 @@
*/
typedef struct {
const char *Spelling;
- /* A 1 value indicates the clang_ indexing API needed to allocate the string
- (and it must be freed by clang_disposeString()). */
- int MustFreeString;
+ unsigned private_flags;
} CXString;
/**
Modified: cfe/branches/Apple/whitney/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/c-index-test/c-index-test.c?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/c-index-test/c-index-test.c (original)
+++ cfe/branches/Apple/whitney/tools/c-index-test/c-index-test.c Tue Nov 16 18:23:29 2010
@@ -1306,7 +1306,7 @@
else {
CXString x;
x.Spelling = I[2];
- x.MustFreeString = 0;
+ x.private_flags = 0;
print_usr(clang_constructUSR_ObjCIvar(I[1], x));
}
@@ -1333,7 +1333,7 @@
else {
CXString x;
x.Spelling = I[3];
- x.MustFreeString = 0;
+ x.private_flags = 0;
print_usr(clang_constructUSR_ObjCMethod(I[1], atoi(I[2]), x));
}
I += 4;
@@ -1363,7 +1363,7 @@
else {
CXString x;
x.Spelling = I[2];
- x.MustFreeString = 0;
+ x.private_flags = 0;
print_usr(clang_constructUSR_ObjCProperty(I[1], x));
}
I += 3;
Modified: cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp Tue Nov 16 18:23:29 2010
@@ -14,6 +14,7 @@
#include "CIndexer.h"
#include "CXCursor.h"
+#include "CXString.h"
#include "CXType.h"
#include "CXSourceLocation.h"
#include "CIndexDiagnostic.h"
@@ -4604,51 +4605,6 @@
} // end: extern "C"
//===----------------------------------------------------------------------===//
-// CXString Operations.
-//===----------------------------------------------------------------------===//
-
-extern "C" {
-const char *clang_getCString(CXString string) {
- return string.Spelling;
-}
-
-void clang_disposeString(CXString string) {
- if (string.MustFreeString && string.Spelling)
- free((void*)string.Spelling);
-}
-
-} // end: extern "C"
-
-namespace clang { namespace cxstring {
-CXString createCXString(const char *String, bool DupString){
- CXString Str;
- if (DupString) {
- Str.Spelling = strdup(String);
- Str.MustFreeString = 1;
- } else {
- Str.Spelling = String;
- Str.MustFreeString = 0;
- }
- return Str;
-}
-
-CXString createCXString(llvm::StringRef String, bool DupString) {
- CXString Result;
- if (DupString || (!String.empty() && String.data()[String.size()] != 0)) {
- char *Spelling = (char *)malloc(String.size() + 1);
- memmove(Spelling, String.data(), String.size());
- Spelling[String.size()] = 0;
- Result.Spelling = Spelling;
- Result.MustFreeString = 1;
- } else {
- Result.Spelling = String.data();
- Result.MustFreeString = 0;
- }
- return Result;
-}
-}}
-
-//===----------------------------------------------------------------------===//
// Misc. utility functions.
//===----------------------------------------------------------------------===//
Modified: cfe/branches/Apple/whitney/tools/libclang/CIndexCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CIndexCXX.cpp?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndexCXX.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndexCXX.cpp Tue Nov 16 18:23:29 2010
@@ -18,7 +18,6 @@
#include "clang/AST/DeclTemplate.h"
using namespace clang;
-using namespace clang::cxstring;
using namespace clang::cxcursor;
extern "C" {
Modified: cfe/branches/Apple/whitney/tools/libclang/CIndexCodeCompletion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CIndexCodeCompletion.cpp?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndexCodeCompletion.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndexCodeCompletion.cpp Tue Nov 16 18:23:29 2010
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "CIndexer.h"
+#include "CXString.h"
#include "CIndexDiagnostic.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/FileManager.h"
Modified: cfe/branches/Apple/whitney/tools/libclang/CIndexDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CIndexDiagnostic.cpp?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndexDiagnostic.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndexDiagnostic.cpp Tue Nov 16 18:23:29 2010
@@ -13,6 +13,7 @@
#include "CIndexDiagnostic.h"
#include "CIndexer.h"
#include "CXSourceLocation.h"
+#include "CXString.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/FrontendDiagnostic.h"
Modified: cfe/branches/Apple/whitney/tools/libclang/CIndexUSRs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CIndexUSRs.cpp?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndexUSRs.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndexUSRs.cpp Tue Nov 16 18:23:29 2010
@@ -13,6 +13,7 @@
#include "CIndexer.h"
#include "CXCursor.h"
+#include "CXString.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/Frontend/ASTUnit.h"
Modified: cfe/branches/Apple/whitney/tools/libclang/CIndexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CIndexer.h?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndexer.h (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndexer.h Tue Nov 16 18:23:29 2010
@@ -24,13 +24,6 @@
class CrashRecoveryContext;
}
-namespace clang {
-namespace cxstring {
- CXString createCXString(const char *String, bool DupString = false);
- CXString createCXString(llvm::StringRef String, bool DupString = true);
-}
-}
-
class CIndexer {
bool OnlyLocalDecls;
bool DisplayDiagnostics;
Modified: cfe/branches/Apple/whitney/tools/libclang/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CMakeLists.txt?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CMakeLists.txt (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CMakeLists.txt Tue Nov 16 18:23:29 2010
@@ -27,6 +27,7 @@
CIndexUSRs.cpp
CIndexer.cpp
CXCursor.cpp
+ CXString.cpp
CXType.cpp
../../include/clang-c/Index.h
)
Modified: cfe/branches/Apple/whitney/tools/libclang/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CXCursor.cpp?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CXCursor.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CXCursor.cpp Tue Nov 16 18:23:29 2010
@@ -14,6 +14,7 @@
//===----------------------------------------------------------------------===//
#include "CXCursor.h"
+#include "CXString.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
Modified: cfe/branches/Apple/whitney/tools/libclang/CXType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CXType.cpp?rev=119416&r1=119415&r2=119416&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CXType.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CXType.cpp Tue Nov 16 18:23:29 2010
@@ -13,6 +13,7 @@
#include "CIndexer.h"
#include "CXCursor.h"
+#include "CXString.h"
#include "CXType.h"
#include "clang/AST/Expr.h"
#include "clang/AST/Type.h"
More information about the llvm-branch-commits
mailing list