summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-03-06 09:23:02 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-03-06 09:23:02 +0000
commitdd5132ce2569a1ef901c92772eb8581aa1705f25 (patch)
tree7e0a88c3c6cb70271946aaa95a231b3da55d9f91 /tools
parent79ade4e028932fcb9dab15e2fb2305ca15ab0f14 (diff)
downloadsrc-test2-dd5132ce2569a1ef901c92772eb8581aa1705f25.tar.gz
src-test2-dd5132ce2569a1ef901c92772eb8581aa1705f25.zip
Notes
Diffstat (limited to 'tools')
-rw-r--r--tools/CIndex/CIndex.cpp12
-rw-r--r--tools/c-index-test/c-index-test.c8
2 files changed, 14 insertions, 6 deletions
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 6fc7b530307d..07bb7fbd83ef 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -104,7 +104,8 @@ public:
{
{
llvm::raw_svector_ostream Out(CrashString);
- Out << "ClangCIndex [createTranslationUnitFromSourceFile]: clang";
+ Out << "ClangCIndex [" << getClangFullVersion() << "]"
+ << "[createTranslationUnitFromSourceFile]: clang";
for (llvm::SmallVectorImpl<const char*>::iterator I=Args.begin(),
E=Args.end(); I!=E; ++I)
Out << ' ' << *I;
@@ -1002,7 +1003,8 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx,
// FIXME: Until we have broader testing, just drop the entire AST if we
// encountered an error.
if (NumErrors != Diags->getNumErrors()) {
- if (CXXIdx->getDisplayDiagnostics()) {
+ // Make sure to check that 'Unit' is non-NULL.
+ if (CXXIdx->getDisplayDiagnostics() && Unit.get()) {
for (ASTUnit::diag_iterator D = Unit->diag_begin(),
DEnd = Unit->diag_end();
D != DEnd; ++D) {
@@ -1527,6 +1529,8 @@ CXCursor clang_getCursor(CXTranslationUnit TU, CXSourceLocation Loc) {
ASTUnit *CXXUnit = static_cast<ASTUnit *>(TU);
+ ASTUnit::ConcurrencyCheck Check(*CXXUnit);
+
SourceLocation SLoc = cxloc::translateSourceLocation(Loc);
CXCursor Result = MakeCXCursorInvalid(CXCursor_NoDeclFound);
if (SLoc.isValid()) {
@@ -2052,6 +2056,8 @@ void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
if (!CXXUnit || !Tokens || !NumTokens)
return;
+ ASTUnit::ConcurrencyCheck Check(*CXXUnit);
+
SourceRange R = cxloc::translateCXSourceRange(Range);
if (R.isInvalid())
return;
@@ -2175,6 +2181,8 @@ void clang_annotateTokens(CXTranslationUnit TU,
if (!CXXUnit || !Tokens)
return;
+ ASTUnit::ConcurrencyCheck Check(*CXXUnit);
+
// Annotate all of the source locations in the region of interest that map
SourceRange RegionOfInterest;
RegionOfInterest.setBegin(
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 967afb763430..38c8811ab81e 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -431,10 +431,10 @@ static enum CXChildVisitResult PrintLinkage(CXCursor cursor, CXCursor p,
switch (clang_getCursorLinkage(cursor)) {
case CXLinkage_Invalid: break;
- case CXLinkage_NoLinkage: linkage = "NoLinkage";
- case CXLinkage_Internal: linkage = "Internal";
- case CXLinkage_UniqueExternal: linkage = "UniqueExternal";
- case CXLinkage_External: linkage = "External";
+ case CXLinkage_NoLinkage: linkage = "NoLinkage"; break;
+ case CXLinkage_Internal: linkage = "Internal"; break;
+ case CXLinkage_UniqueExternal: linkage = "UniqueExternal"; break;
+ case CXLinkage_External: linkage = "External"; break;
}
if (linkage) {