summaryrefslogtreecommitdiff
path: root/lib/Frontend/ASTMerge.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-09 22:37:58 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-09 22:37:58 +0000
commitd343ff623eb11e277f1e70bca16073e424d8a30d (patch)
tree48e4fb5f8446f88e2bb383f53b5a67ff633d2110 /lib/Frontend/ASTMerge.cpp
parent79a9a3417929e340e84dcbc06ed9c3a277cad959 (diff)
downloadclang-d343ff623eb11e277f1e70bca16073e424d8a30d.tar.gz
Hook up the diagnostics-argument printer when merging AST files, so
that we get readable diagnostics such as: error: external variable 'x1' declared with incompatible types in different translation units ('double *' vs. 'float **') However, there is no translation of source locations, yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTMerge.cpp')
-rw-r--r--lib/Frontend/ASTMerge.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp
index 649af9e4b8..e88d2953c3 100644
--- a/lib/Frontend/ASTMerge.cpp
+++ b/lib/Frontend/ASTMerge.cpp
@@ -10,6 +10,7 @@
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/ASTImporter.h"
using namespace clang;
@@ -31,15 +32,20 @@ bool ASTMergeAction::BeginSourceFileAction(CompilerInstance &CI,
void ASTMergeAction::ExecuteAction() {
CompilerInstance &CI = getCompilerInstance();
-
+ CI.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument,
+ &CI.getASTContext());
for (unsigned I = 0, N = ASTFiles.size(); I != N; ++I) {
- ASTUnit *Unit = ASTUnit::LoadFromPCHFile(ASTFiles[I], CI.getDiagnostics(),
+ Diagnostic ASTDiags(CI.getDiagnostics().getClient());
+
+ ASTUnit *Unit = ASTUnit::LoadFromPCHFile(ASTFiles[I], ASTDiags,
false, true);
if (!Unit)
continue;
+ ASTDiags.SetArgToStringFn(&FormatASTNodeDiagnosticArgument,
+ &Unit->getASTContext());
ASTImporter Importer(CI.getASTContext(), CI.getDiagnostics(),
- Unit->getASTContext(), CI.getDiagnostics());
+ Unit->getASTContext(), ASTDiags);
TranslationUnitDecl *TU = Unit->getASTContext().getTranslationUnitDecl();
for (DeclContext::decl_iterator D = TU->decls_begin(),
@@ -51,8 +57,7 @@ void ASTMergeAction::ExecuteAction() {
if (VD->getIdentifier() &&
*VD->getIdentifier()->getNameStart() == 'x') {
Decl *Merged = Importer.Import(VD);
- if (Merged)
- Merged->dump();
+ (void)Merged;
}
}