aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/ASTImporter.cpp27
-rw-r--r--lib/Frontend/ASTMerge.cpp6
2 files changed, 31 insertions, 2 deletions
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp
index 75917cf04c..9fb695e4e1 100644
--- a/lib/AST/ASTImporter.cpp
+++ b/lib/AST/ASTImporter.cpp
@@ -500,6 +500,33 @@ Decl *ASTNodeImporter::VisitVarDecl(VarDecl *D) {
break;
}
+ if (const IncompleteArrayType *FoundArray
+ = Importer.getToContext().getAsIncompleteArrayType(
+ FoundVar->getType())) {
+ if (const ConstantArrayType *TArray
+ = Importer.getToContext().getAsConstantArrayType(T)) {
+ if (Importer.getToContext().typesAreCompatible(
+ TArray->getElementType(),
+ FoundArray->getElementType())) {
+ FoundVar->setType(T);
+ MergeWithVar = FoundVar;
+ break;
+ }
+ }
+ } else if (const IncompleteArrayType *TArray
+ = Importer.getToContext().getAsIncompleteArrayType(T)) {
+ if (const ConstantArrayType *FoundArray
+ = Importer.getToContext().getAsConstantArrayType(
+ FoundVar->getType())) {
+ if (Importer.getToContext().typesAreCompatible(
+ TArray->getElementType(),
+ FoundArray->getElementType())) {
+ MergeWithVar = FoundVar;
+ break;
+ }
+ }
+ }
+
Importer.ToDiag(Loc, diag::err_odr_variable_type_inconsistent)
<< Name << T << FoundVar->getType();
Importer.ToDiag(FoundVar->getLocation(), diag::note_odr_value_here)
diff --git a/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp
index d51647bb16..f2de09a74c 100644
--- a/lib/Frontend/ASTMerge.cpp
+++ b/lib/Frontend/ASTMerge.cpp
@@ -32,6 +32,8 @@ bool ASTMergeAction::BeginSourceFileAction(CompilerInstance &CI,
void ASTMergeAction::ExecuteAction() {
CompilerInstance &CI = getCompilerInstance();
+ CI.getDiagnostics().getClient()->BeginSourceFile(
+ CI.getASTContext().getLangOptions());
CI.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument,
&CI.getASTContext());
for (unsigned I = 0, N = ASTFiles.size(); I != N; ++I) {
@@ -68,8 +70,8 @@ void ASTMergeAction::ExecuteAction() {
delete Unit;
}
-
- return AdaptedAction->ExecuteAction();
+ AdaptedAction->ExecuteAction();
+ CI.getDiagnostics().getClient()->EndSourceFile();
}
void ASTMergeAction::EndSourceFileAction() {