summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-04-06 15:53:59 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-04-06 15:53:59 +0000
commit71438373cd57f0d5d8c93bb5cf690844a0fbc9d0 (patch)
tree59c928209f8007777dd96568b026bdfe200691de /tools
parentac616af773f5062edaaf1a0bb5610b49a22ac41f (diff)
downloadFreeBSD-src-71438373cd57f0d5d8c93bb5cf690844a0fbc9d0.zip
FreeBSD-src-71438373cd57f0d5d8c93bb5cf690844a0fbc9d0.tar.gz
Update clang to r100520.
Diffstat (limited to 'tools')
-rw-r--r--tools/CIndex/CIndex.cpp28
-rw-r--r--tools/CIndex/CIndexCodeCompletion.cpp4
-rw-r--r--tools/CIndex/CIndexDiagnostic.cpp6
-rw-r--r--tools/driver/cc1_main.cpp1
4 files changed, 18 insertions, 21 deletions
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 998fbbb..01130e2 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -996,11 +996,8 @@ CXTranslationUnit clang_createTranslationUnit(CXIndex CIdx,
CIndexer *CXXIdx = static_cast<CIndexer *>(CIdx);
- // Configure the diagnostics.
- DiagnosticOptions DiagOpts;
- llvm::OwningPtr<Diagnostic> Diags;
- Diags.reset(CompilerInstance::createDiagnostics(DiagOpts, 0, 0));
- return ASTUnit::LoadFromPCHFile(ast_filename, *Diags,
+ llvm::IntrusiveRefCntPtr<Diagnostic> Diags;
+ return ASTUnit::LoadFromPCHFile(ast_filename, Diags,
CXXIdx->getOnlyLocalDecls(),
0, 0, true);
}
@@ -1019,15 +1016,14 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx,
// Configure the diagnostics.
DiagnosticOptions DiagOpts;
- llvm::OwningPtr<Diagnostic> Diags;
- Diags.reset(CompilerInstance::createDiagnostics(DiagOpts, 0, 0));
+ llvm::IntrusiveRefCntPtr<Diagnostic> Diags;
+ Diags = CompilerInstance::createDiagnostics(DiagOpts, 0, 0);
llvm::SmallVector<ASTUnit::RemappedFile, 4> RemappedFiles;
for (unsigned I = 0; I != num_unsaved_files; ++I) {
+ llvm::StringRef Data(unsaved_files[I].Contents, unsaved_files[I].Length);
const llvm::MemoryBuffer *Buffer
- = llvm::MemoryBuffer::getMemBufferCopy(unsaved_files[I].Contents,
- unsaved_files[I].Contents + unsaved_files[I].Length,
- unsaved_files[I].Filename);
+ = llvm::MemoryBuffer::getMemBufferCopy(Data, unsaved_files[I].Filename);
RemappedFiles.push_back(std::make_pair(unsaved_files[I].Filename,
Buffer));
}
@@ -1052,7 +1048,7 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx,
llvm::OwningPtr<ASTUnit> Unit(
ASTUnit::LoadFromCommandLine(Args.data(), Args.data() + Args.size(),
- *Diags,
+ Diags,
CXXIdx->getClangResourcesPath(),
CXXIdx->getOnlyLocalDecls(),
RemappedFiles.data(),
@@ -1064,8 +1060,8 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx,
if (NumErrors != Diags->getNumErrors()) {
// 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();
+ for (ASTUnit::stored_diag_iterator D = Unit->stored_diag_begin(),
+ DEnd = Unit->stored_diag_end();
D != DEnd; ++D) {
CXStoredDiagnostic Diag(*D, Unit->getASTContext().getLangOptions());
CXString Msg = clang_formatDiagnostic(&Diag,
@@ -1169,7 +1165,7 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx,
Diags->Report(diag::err_fe_invoking) << AllArgs << ErrMsg;
}
- ASTUnit *ATU = ASTUnit::LoadFromPCHFile(astTmpFile, *Diags,
+ ASTUnit *ATU = ASTUnit::LoadFromPCHFile(astTmpFile, Diags,
CXXIdx->getOnlyLocalDecls(),
RemappedFiles.data(),
RemappedFiles.size(),
@@ -1179,7 +1175,7 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx,
num_unsaved_files, unsaved_files,
ATU->getFileManager(),
ATU->getSourceManager(),
- ATU->getDiagnostics());
+ ATU->getStoredDiagnostics());
} else if (CXXIdx->getDisplayDiagnostics()) {
// We failed to load the ASTUnit, but we can still deserialize the
// diagnostics and emit them.
@@ -2333,7 +2329,7 @@ void clang_annotateTokens(CXTranslationUnit TU,
RegionOfInterest.setBegin(
cxloc::translateSourceLocation(clang_getTokenLocation(TU, Tokens[0])));
SourceLocation End
- = cxloc::translateSourceLocation(clang_getTokenLocation(TU,
+ = cxloc::translateSourceLocation(clang_getTokenLocation(TU,
Tokens[NumTokens - 1]));
RegionOfInterest.setEnd(CXXUnit->getPreprocessor().getLocForEndOfToken(End));
diff --git a/tools/CIndex/CIndexCodeCompletion.cpp b/tools/CIndex/CIndexCodeCompletion.cpp
index 264e506..d11b8df 100644
--- a/tools/CIndex/CIndexCodeCompletion.cpp
+++ b/tools/CIndex/CIndexCodeCompletion.cpp
@@ -231,8 +231,8 @@ CXCodeCompleteResults *clang_codeComplete(CXIndex CIdx,
// Configure the diagnostics.
DiagnosticOptions DiagOpts;
- llvm::OwningPtr<Diagnostic> Diags;
- Diags.reset(CompilerInstance::createDiagnostics(DiagOpts, 0, 0));
+ llvm::IntrusiveRefCntPtr<Diagnostic> Diags;
+ Diags = CompilerInstance::createDiagnostics(DiagOpts, 0, 0);
// The set of temporary files that we've built.
std::vector<llvm::sys::Path> TemporaryFiles;
diff --git a/tools/CIndex/CIndexDiagnostic.cpp b/tools/CIndex/CIndexDiagnostic.cpp
index 0314a67..bcf066d 100644
--- a/tools/CIndex/CIndexDiagnostic.cpp
+++ b/tools/CIndex/CIndexDiagnostic.cpp
@@ -32,15 +32,15 @@ extern "C" {
unsigned clang_getNumDiagnostics(CXTranslationUnit Unit) {
ASTUnit *CXXUnit = static_cast<ASTUnit *>(Unit);
- return CXXUnit? CXXUnit->diag_size() : 0;
+ return CXXUnit? CXXUnit->stored_diag_size() : 0;
}
CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, unsigned Index) {
ASTUnit *CXXUnit = static_cast<ASTUnit *>(Unit);
- if (!CXXUnit || Index >= CXXUnit->diag_size())
+ if (!CXXUnit || Index >= CXXUnit->stored_diag_size())
return 0;
- return new CXStoredDiagnostic(CXXUnit->diag_begin()[Index],
+ return new CXStoredDiagnostic(CXXUnit->stored_diag_begin()[Index],
CXXUnit->getASTContext().getLangOptions());
}
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp
index 35854be..dd440f5 100644
--- a/tools/driver/cc1_main.cpp
+++ b/tools/driver/cc1_main.cpp
@@ -211,6 +211,7 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd,
// Initialize targets first, so that --version shows registered targets.
llvm::InitializeAllTargets();
llvm::InitializeAllAsmPrinters();
+ llvm::InitializeAllAsmParsers();
// Buffer diagnostics from argument parsing so that we can output them using a
// well formed diagnostic object.
OpenPOWER on IntegriCloud