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)
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) {
delete Unit;
}
-
- return AdaptedAction->ExecuteAction();
+ AdaptedAction->ExecuteAction();
+ CI.getDiagnostics().getClient()->EndSourceFile();
}
void ASTMergeAction::EndSourceFileAction() {
// CHECK: var2.c:3:5: error: external variable 'x2' declared with incompatible types in different translation units ('int' vs. 'double')
// CHECK: In file included from{{.*}}var1.c:3:
// CHECK: var1.h:1:8: note: declared here with type 'double'
+// CHECK: error: external variable 'xarray3' declared with incompatible types in different translation units ('int [17]' vs. 'int [18]')
+// CHECK: var1.c:7:5: note: declared here with type 'int [18]'