aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Basic/DiagnosticFrontendKinds.td2
-rw-r--r--include/clang/Frontend/VerifyDiagnosticConsumer.h12
-rw-r--r--lib/Frontend/VerifyDiagnosticConsumer.cpp70
-rw-r--r--test/ASTMerge/function.c8
-rw-r--r--test/Analysis/diagnostics/explicit-suppression.cpp65
-rw-r--r--test/Frontend/verify.c16
-rw-r--r--test/Misc/warn-in-system-header.c2
-rw-r--r--test/Modules/auto-module-import.m4
-rw-r--r--test/Modules/decldef.m3
-rw-r--r--test/Modules/decldef.mm3
-rw-r--r--test/Modules/diamond-pch.c25
-rw-r--r--test/Modules/diamond.c22
-rw-r--r--test/Modules/linkage-merge.cpp13
-rw-r--r--test/Modules/linkage-merge.m23
-rw-r--r--test/Modules/lookup.cpp2
-rw-r--r--test/Modules/lookup.m18
-rw-r--r--test/Modules/macros.c14
-rw-r--r--test/Modules/method_pool.m8
-rw-r--r--test/Modules/module-private.cpp2
-rw-r--r--test/Modules/namespaces.cpp4
-rw-r--r--test/Modules/normal-module-map.cpp6
-rw-r--r--test/Modules/objc-categories.m9
-rw-r--r--test/Modules/on-demand-build.m2
-rw-r--r--test/Modules/redecl-merge.m18
-rw-r--r--test/Modules/subframeworks.m2
-rw-r--r--test/PCH/cxx-using.cpp7
-rw-r--r--test/PCH/cxx11-statement-attributes.cpp3
-rw-r--r--test/PCH/functions.c6
-rw-r--r--test/PCH/method_pool.m12
-rw-r--r--test/PCH/nonvisible-external-defs.c2
-rw-r--r--test/PCH/reloc.c4
-rw-r--r--test/PCH/tentative-defs.c3
-rw-r--r--test/PCH/typo.cpp19
-rw-r--r--test/PCH/typo.m3
-rw-r--r--test/Sema/pragma-arc-cf-code-audited.c2
-rw-r--r--test/SemaObjC/arc-system-header.m13
-rw-r--r--test/SemaObjCXX/arc-system-header.mm3
37 files changed, 211 insertions, 219 deletions
diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td
index 111622e0fe..f05fb9be82 100644
--- a/include/clang/Basic/DiagnosticFrontendKinds.td
+++ b/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -67,6 +67,8 @@ def warn_fe_serialized_diag_failure : Warning<
def err_verify_missing_line : Error<
"missing or invalid line number following '@' in expected %0">;
+def err_verify_missing_file : Error<
+ "file '%0' could not be located in expected %1">;
def err_verify_invalid_range : Error<
"invalid range following '-' in expected %0">;
def err_verify_missing_start : Error<
diff --git a/include/clang/Frontend/VerifyDiagnosticConsumer.h b/include/clang/Frontend/VerifyDiagnosticConsumer.h
index 06a3b24f3a..9cd73ba961 100644
--- a/include/clang/Frontend/VerifyDiagnosticConsumer.h
+++ b/include/clang/Frontend/VerifyDiagnosticConsumer.h
@@ -61,6 +61,18 @@ class FileEntry;
/// The line number may be absolute (as above), or relative to the current
/// line by prefixing the number with either '+' or '-'.
///
+/// If the diagnostic is generated in a separate file, for example in a shared
+/// header file, it may be beneficial to be able to declare the file in which
+/// the diagnostic will appear, rather than placing the expected-* directive in
+/// the actual file itself. This can be done using the following syntax:
+///
+/// \code
+/// // expected-error@path/include.h:15 {{error message}}
+/// \endcode
+///
+/// The path can be absolute or relative and the same search paths will be used
+/// as for #include directives.
+///
/// The simple syntax above allows each specification to match exactly one
/// error. You can use the extended syntax to customize this. The extended
/// syntax is "expected-<type> <n> {{diag text}}", where \<type> is one of
diff --git a/lib/Frontend/VerifyDiagnosticConsumer.cpp b/lib/Frontend/VerifyDiagnosticConsumer.cpp
index 82f6e916e5..4f05aef94f 100644
--- a/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ b/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -278,8 +278,10 @@ private:
///
/// Returns true if any valid directives were found.
static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM,
- SourceLocation Pos, DiagnosticsEngine &Diags,
+ Preprocessor *PP, SourceLocation Pos,
VerifyDiagnosticConsumer::DirectiveStatus &Status) {
+ DiagnosticsEngine &Diags = PP ? PP->getDiagnostics() : SM.getDiagnostics();
+
// A single comment may contain multiple directives.
bool FoundDirective = false;
for (ParseHelper PH(S); !PH.Done();) {
@@ -353,10 +355,30 @@ static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM,
else ExpectedLine -= Line;
ExpectedLoc = SM.translateLineCol(SM.getFileID(Pos), ExpectedLine, 1);
}
- } else {
+ } else if (PH.Next(Line)) {
// Absolute line number.
- if (PH.Next(Line) && Line > 0)
+ if (Line > 0)
ExpectedLoc = SM.translateLineCol(SM.getFileID(Pos), Line, 1);
+ } else if (PP && PH.Search(":")) {
+ // Specific source file.
+ StringRef Filename(PH.C, PH.P-PH.C);
+ PH.Advance();
+
+ // Lookup file via Preprocessor, like a #include.
+ const DirectoryLookup *CurDir;
+ const FileEntry *FE = PP->LookupFile(Filename, false, NULL, CurDir,
+ NULL, NULL, 0);
+ if (!FE) {
+ Diags.Report(Pos.getLocWithOffset(PH.C-PH.Begin),
+ diag::err_verify_missing_file) << Filename << KindStr;
+ continue;
+ }
+
+ if (SM.translateFile(FE).isInvalid())
+ SM.createFileID(FE, Pos, SrcMgr::C_User);
+
+ if (PH.Next(Line) && Line > 0)
+ ExpectedLoc = SM.translateFileLineCol(FE, Line, 1);
}
if (ExpectedLoc.isInvalid()) {
@@ -465,7 +487,7 @@ bool VerifyDiagnosticConsumer::HandleComment(Preprocessor &PP,
// Fold any "\<EOL>" sequences
size_t loc = C.find('\\');
if (loc == StringRef::npos) {
- ParseDirective(C, &ED, SM, CommentBegin, PP.getDiagnostics(), Status);
+ ParseDirective(C, &ED, SM, &PP, CommentBegin, Status);
return false;
}
@@ -495,7 +517,7 @@ bool VerifyDiagnosticConsumer::HandleComment(Preprocessor &PP,
}
if (!C2.empty())
- ParseDirective(C2, &ED, SM, CommentBegin, PP.getDiagnostics(), Status);
+ ParseDirective(C2, &ED, SM, &PP, CommentBegin, Status);
return false;
}
@@ -530,8 +552,7 @@ static bool findDirectives(SourceManager &SM, FileID FID,
if (Comment.empty()) continue;
// Find first directive.
- if (ParseDirective(Comment, 0, SM, Tok.getLocation(),
- SM.getDiagnostics(), Status))
+ if (ParseDirective(Comment, 0, SM, 0, Tok.getLocation(), Status))
return true;
}
return false;
@@ -551,8 +572,13 @@ static unsigned PrintUnexpected(DiagnosticsEngine &Diags, SourceManager *SourceM
for (const_diag_iterator I = diag_begin, E = diag_end; I != E; ++I) {
if (I->first.isInvalid() || !SourceMgr)
OS << "\n (frontend)";
- else
- OS << "\n Line " << SourceMgr->getPresumedLineNumber(I->first);
+ else {
+ OS << "\n ";
+ if (const FileEntry *File = SourceMgr->getFileEntryForID(
+ SourceMgr->getFileID(I->first)))
+ OS << " File " << File->getName();
+ OS << " Line " << SourceMgr->getPresumedLineNumber(I->first);
+ }
OS << ": " << I->second;
}
@@ -572,11 +598,12 @@ static unsigned PrintExpected(DiagnosticsEngine &Diags, SourceManager &SourceMgr
llvm::raw_svector_ostream OS(Fmt);
for (DirectiveList::iterator I = DL.begin(), E = DL.end(); I != E; ++I) {
Directive &D = **I;
- OS << "\n Line " << SourceMgr.getPresumedLineNumber(D.DiagnosticLoc);
+ OS << "\n File " << SourceMgr.getFilename(D.DiagnosticLoc)
+ << " Line " << SourceMgr.getPresumedLineNumber(D.DiagnosticLoc);
if (D.DirectiveLoc != D.DiagnosticLoc)
OS << " (directive at "
- << SourceMgr.getFilename(D.DirectiveLoc) << ":"
- << SourceMgr.getPresumedLineNumber(D.DirectiveLoc) << ")";
+ << SourceMgr.getFilename(D.DirectiveLoc) << ':'
+ << SourceMgr.getPresumedLineNumber(D.DirectiveLoc) << ')';
OS << ": " << D.Text;
}
@@ -585,6 +612,22 @@ static unsigned PrintExpected(DiagnosticsEngine &Diags, SourceManager &SourceMgr
return DL.size();
}
+/// \brief Determine whether two source locations come from the same file.
+static bool IsFromSameFile(SourceManager &SM, SourceLocation DirectiveLoc,
+ SourceLocation DiagnosticLoc) {
+ while (DiagnosticLoc.isMacroID())
+ DiagnosticLoc = SM.getImmediateMacroCallerLoc(DiagnosticLoc);
+
+ if (SM.isFromSameFile(DirectiveLoc, DiagnosticLoc))
+ return true;
+
+ const FileEntry *DiagFile = SM.getFileEntryForID(SM.getFileID(DiagnosticLoc));
+ if (!DiagFile && SM.isFromMainFile(DirectiveLoc))
+ return true;
+
+ return (DiagFile == SM.getFileEntryForID(SM.getFileID(DirectiveLoc)));
+}
+
/// CheckLists - Compare expected to seen diagnostic lists and return the
/// the difference between them.
///
@@ -607,6 +650,9 @@ static unsigned CheckLists(DiagnosticsEngine &Diags, SourceManager &SourceMgr,
if (LineNo1 != LineNo2)
continue;
+ if (!IsFromSameFile(SourceMgr, D.DiagnosticLoc, II->first))
+ continue;
+
const std::string &RightText = II->second;
if (D.match(RightText))
break;
diff --git a/test/ASTMerge/function.c b/test/ASTMerge/function.c
index 320bca2a36..8a8a030514 100644
--- a/test/ASTMerge/function.c
+++ b/test/ASTMerge/function.c
@@ -9,7 +9,7 @@
// CHECK: function1.c:4:6: note: declared here with type 'void (void)'
// CHECK: 2 errors generated
-// expected-error@3 {{external function 'f1' declared with incompatible types}}
-// expected-note@2 {{declared here}}
-// expected-error@5 {{external function 'f3' declared with incompatible types}}
-// expected-note@4 {{declared here}}
+// expected-error@Inputs/function2.c:3 {{external function 'f1' declared with incompatible types}}
+// expected-note@Inputs/function1.c:2 {{declared here}}
+// expected-error@Inputs/function2.c:5 {{external function 'f3' declared with incompatible types}}
+// expected-note@Inputs/function1.c:4 {{declared here}}
diff --git a/test/Analysis/diagnostics/explicit-suppression.cpp b/test/Analysis/diagnostics/explicit-suppression.cpp
index 79afeed6c5..57d2d16f89 100644
--- a/test/Analysis/diagnostics/explicit-suppression.cpp
+++ b/test/Analysis/diagnostics/explicit-suppression.cpp
@@ -12,69 +12,6 @@ void clang_analyzer_eval(bool);
void testCopyNull(int *I, int *E) {
std::copy(I, E, (int *)0);
#ifndef SUPPRESSED
- // This line number comes from system-header-simulator-cxx.h.
- // expected-warning@79 {{Dereference of null pointer}}
+ // expected-warning@../Inputs/system-header-simulator-cxx.h:80 {{Dereference of null pointer}}
#endif
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-// PR15613: expected-* can't refer to diagnostics in other source files.
-// The current implementation only matches line numbers, but has an upper limit
-// of the number of lines in the main source file.
diff --git a/test/Frontend/verify.c b/test/Frontend/verify.c
index 062e6bd861..3d71e04980 100644
--- a/test/Frontend/verify.c
+++ b/test/Frontend/verify.c
@@ -124,3 +124,19 @@ unexpected b; // expected-error@33 1-1 {{unknown type}}
// CHECK7-NEXT: Line 2: 2
// CHECK7-NEXT: 2 errors generated.
#endif
+
+#ifdef TEST8
+// RUN: %clang_cc1 -DTEST8 -verify %s 2>&1 | FileCheck -check-prefix=CHECK8 %s
+
+// expected-warning@nonexistant-file:1 {{ }}
+// expected-error@-1 {{file 'nonexistant-file' could not be located}}
+
+// expected-warning@verify-directive.h: {{ }}
+// expected-error@-1 {{missing or invalid line number}}
+
+// expected-warning@verify-directive.h:1 {{diagnostic}}
+
+// CHECK8: error: 'warning' diagnostics expected but not seen:
+// CHECK8-NEXT: File {{.*}}verify-directive.h Line 1 (directive at {{.*}}verify.c:137): diagnostic
+// CHECK8-NEXT: 1 error generated.
+#endif
diff --git a/test/Misc/warn-in-system-header.c b/test/Misc/warn-in-system-header.c
index 6e0237d0dc..132f083af7 100644
--- a/test/Misc/warn-in-system-header.c
+++ b/test/Misc/warn-in-system-header.c
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -isystem %S %s -fsyntax-only -verify
#include <warn-in-system-header.h>
-// expected-warning {{the cake is a lie}}
+// expected-warning@warn-in-system-header.h:4 {{the cake is a lie}}
diff --git a/test/Modules/auto-module-import.m b/test/Modules/auto-module-import.m
index 4bd3c5279c..7351828182 100644
--- a/test/Modules/auto-module-import.m
+++ b/test/Modules/auto-module-import.m
@@ -1,10 +1,10 @@
-// other file: expected-note{{'no_umbrella_A_private' declared here}}
-
// RUN: rm -rf %t
// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify
#include <DependsOnModule/DependsOnModule.h> // expected-warning{{treating #include as an import of module 'DependsOnModule'}}
+// expected-note@Inputs/NoUmbrella.framework/PrivateHeaders/A_Private.h:1{{'no_umbrella_A_private' declared here}}
+
#ifdef MODULE_H_MACRO
# error MODULE_H_MACRO should have been hidden
#endif
diff --git a/test/Modules/decldef.m b/test/Modules/decldef.m
index 7fb8a61386..7ed82b57e9 100644
--- a/test/Modules/decldef.m
+++ b/test/Modules/decldef.m
@@ -1,8 +1,7 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
-
-// In other file: expected-note {{previous definition is here}}
+// expected-note@Inputs/def.h:5 {{previous definition is here}}
@class Def;
Def *def;
diff --git a/test/Modules/decldef.mm b/test/Modules/decldef.mm
index 732c2a27e2..593f53b2c6 100644
--- a/test/Modules/decldef.mm
+++ b/test/Modules/decldef.mm
@@ -1,8 +1,7 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
-
-// In other file: expected-note {{previous definition is here}}
+// expected-note@Inputs/def.h:5 {{previous definition is here}}
@class Def;
Def *def;
diff --git a/test/Modules/diamond-pch.c b/test/Modules/diamond-pch.c
index 079f6afa9c..e7ad02dbe4 100644
--- a/test/Modules/diamond-pch.c
+++ b/test/Modules/diamond-pch.c
@@ -1,14 +1,20 @@
-
-
-
-// in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}}
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-pch -fmodules-cache-path=%t -o %t.pch %S/Inputs/diamond.h
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -include-pch %t.pch %s -verify
+// FIXME: When we have a syntax for modules in C, use that.
void test_diamond(int i, float f, double d, char c) {
top(&i);
left(&f);
right(&d);
bottom(&c);
- bottom(&d); // expected-warning{{incompatible pointer types passing 'double *' to parameter of type 'char *'}}
+ bottom(&d);
+ // expected-warning@-1{{incompatible pointer types passing 'double *' to parameter of type 'char *'}}
+ // expected-note@Inputs/diamond_bottom.h:4{{passing argument to parameter 'x' here}}
// Names in multiple places in the diamond.
top_left(&c);
@@ -17,12 +23,3 @@ void test_diamond(int i, float f, double d, char c) {
struct left_and_right lr;
lr.left = 17;
}
-
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-pch -fmodules-cache-path=%t -o %t.pch %S/Inputs/diamond.h
-// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -include-pch %t.pch %s -verify
-// FIXME: When we have a syntax for modules in C, use that.
diff --git a/test/Modules/diamond.c b/test/Modules/diamond.c
index 0bac1b7596..89d5bc0dda 100644
--- a/test/Modules/diamond.c
+++ b/test/Modules/diamond.c
@@ -1,7 +1,10 @@
-
-
-
-// in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}}
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t %s -verify
+// FIXME: When we have a syntax for modules in C, use that.
@import diamond_bottom;
@@ -10,7 +13,9 @@ void test_diamond(int i, float f, double d, char c) {
left(&f);
right(&d);
bottom(&c);
- bottom(&d); // expected-warning{{incompatible pointer types passing 'double *' to parameter of type 'char *'}}
+ bottom(&d);
+ // expected-warning@-1{{incompatible pointer types passing 'double *' to parameter of type 'char *'}}
+ // expected-note@Inputs/diamond_bottom.h:4{{passing argument to parameter 'x' here}}
// Names in multiple places in the diamond.
top_left(&c);
@@ -20,10 +25,3 @@ void test_diamond(int i, float f, double d, char c) {
lr.left = 17;
}
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t %s -verify
-// FIXME: When we have a syntax for modules in C, use that.
diff --git a/test/Modules/linkage-merge.cpp b/test/Modules/linkage-merge.cpp
index 4e2ecef7d9..9cc9ae64bf 100644
--- a/test/Modules/linkage-merge.cpp
+++ b/test/Modules/linkage-merge.cpp
@@ -1,13 +1,12 @@
-// FIXME: we should be able to put these in the .h file :-(
-// expected-note {{target of using declaration}}
-// expected-note {{using declaration}}
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -verify -fmodules -fmodules-cache-path=%t -I %S/Inputs %s
#include "linkage-merge-bar.h"
static int f(int);
int f(int);
-static void g(int); // expected-error {{declaration conflicts with target of using declaration already in scope}}
-
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -verify -fmodules -fmodules-cache-path=%t -I %S/Inputs %s
+static void g(int);
+// expected-error@-1 {{declaration conflicts with target of using declaration already in scope}}
+// expected-note@Inputs/linkage-merge-foo.h:2 {{target of using declaration}}
+// expected-note@Inputs/linkage-merge-bar.h:3 {{using declaration}}
diff --git a/test/Modules/linkage-merge.m b/test/Modules/linkage-merge.m
index 16e2205078..e838ca1018 100644
--- a/test/Modules/linkage-merge.m
+++ b/test/Modules/linkage-merge.m
@@ -1,27 +1,26 @@
-// In module: expected-note{{previous declaration}}
-
-
-
-
-// In module: expected-note{{previous definition is here}}
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=linkage_merge_left %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -w %s -verify
// Test redeclarations of functions where the original declaration is
// still hidden.
@import linkage_merge_left; // excludes "sub"
-extern int f0(float); // expected-error{{conflicting types for 'f0'}}
+extern int f0(float);
+// expected-error@-1{{conflicting types for 'f0'}}
+// expected-note@Inputs/linkage-merge-sub.h:1{{previous declaration}}
+
static int f1(float); // okay: considered distinct
static int f2(float); // okay: considered distinct
extern int f3(float); // okay: considered distinct
-extern float v0; // expected-error{{redefinition of 'v0' with a different type: 'float' vs 'int'}}
+extern float v0;
+// expected-error@-1{{redefinition of 'v0' with a different type: 'float' vs 'int'}}
+// expected-note@Inputs/linkage-merge-sub.h:6{{previous definition is here}}
+
static float v1;
static float v2;
extern float v3;
typedef float T0;
-
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=linkage_merge_left %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -w %s -verify
diff --git a/test/Modules/lookup.cpp b/test/Modules/lookup.cpp
index 002b6d1556..efd88f47e3 100644
--- a/test/Modules/lookup.cpp
+++ b/test/Modules/lookup.cpp
@@ -5,7 +5,7 @@ import lookup_left_cxx;
#define IMPORT(X) @import X
IMPORT(lookup_right_cxx);
-// in lookup_left.hpp: expected-warning@3 {{weak identifier 'weak_identifier' never declared}}
+// expected-warning@Inputs/lookup_left.hpp:3 {{weak identifier 'weak_identifier' never declared}}
void test(int i, float f) {
// unqualified lookup
diff --git a/test/Modules/lookup.m b/test/Modules/lookup.m
index abe95420d4..54c7491390 100644
--- a/test/Modules/lookup.m
+++ b/test/Modules/lookup.m
@@ -1,19 +1,19 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_left_objc %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_right_objc %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -verify %s
+// RUN: %clang_cc1 -fmodules -ast-print -x objective-c -fmodules-cache-path=%t %s | FileCheck -check-prefix=CHECK-PRINT %s
-// lookup_left.h: expected-note{{using}}
-// lookup_right.h: expected-note{{also found}}
@import lookup_left_objc;
@import lookup_right_objc;
void test(id x) {
- [x method]; // expected-warning{{multiple methods named 'method' found}}
+ [x method];
+// expected-warning@-1{{multiple methods named 'method' found}}
+// expected-note@Inputs/lookup_left.h:2{{using}}
+// expected-note@Inputs/lookup_right.h:3{{also found}}
}
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_left_objc %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_right_objc %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -verify %s
-// RUN: %clang_cc1 -fmodules -ast-print -x objective-c -fmodules-cache-path=%t %s | FileCheck -check-prefix=CHECK-PRINT %s
-
// CHECK-PRINT: - (int) method;
// CHECK-PRINT: - (double) method
// CHECK-PRINT: void test(id x)
diff --git a/test/Modules/macros.c b/test/Modules/macros.c
index fc448d9989..433e03324b 100644
--- a/test/Modules/macros.c
+++ b/test/Modules/macros.c
@@ -8,13 +8,13 @@
// FIXME: When we have a syntax for modules in C, use that.
// These notes come from headers in modules, and are bogus.
-// FIXME: expected-note{{previous definition is here}}
-// FIXME: expected-note{{previous definition is here}} expected-note{{expanding this definition of 'LEFT_RIGHT_DIFFERENT'}}
-// expected-note{{other definition of 'TOP_RIGHT_REDEF'}} expected-note{{expanding this definition of 'LEFT_RIGHT_DIFFERENT2'}}
-// expected-note{{other definition of 'LEFT_RIGHT_DIFFERENT'}}
-
-
-// expected-note{{expanding this definition of 'TOP_RIGHT_REDEF'}}
+// FIXME: expected-note@Inputs/macros_left.h:11{{previous definition is here}}
+// FIXME: expected-note@Inputs/macros_right.h:12{{previous definition is here}}
+// expected-note@Inputs/macros_right.h:12{{expanding this definition of 'LEFT_RIGHT_DIFFERENT'}}
+// expected-note@Inputs/macros_top.h:13{{other definition of 'TOP_RIGHT_REDEF'}}
+// expected-note@Inputs/macros_right.h:13{{expanding this definition of 'LEFT_RIGHT_DIFFERENT2'}}
+// expected-note@Inputs/macros_left.h:14{{other definition of 'LEFT_RIGHT_DIFFERENT'}}
+// expected-note@Inputs/macros_right.h:17{{expanding this definition of 'TOP_RIGHT_REDEF'}}
@import macros;
diff --git a/test/Modules/method_pool.m b/test/Modules/method_pool.m
index 9a8897b383..6fd74b0885 100644
--- a/test/Modules/method_pool.m
+++ b/test/Modules/method_pool.m
@@ -8,8 +8,8 @@
- (void)method5:(D*)obj;
@end
-// in other file: // expected-note@7{{using}}
-// in other file: expected-note@12{{also found}}
+// expected-note@Inputs/MethodPoolA.h:7{{using}}
+// expected-note@Inputs/MethodPoolB.h:12{{also found}}
void testMethod1(id object) {
[object method1];
@@ -51,8 +51,8 @@ void testMethod3Again(id object) {
void testMethod3AgainAgain(id object) {
[object method3]; // expected-warning{{multiple methods named 'method3' found}}
- // expected-note@2{{using}}
- // expected-note@2{{also found}}
+ // expected-note@Inputs/MethodPoolBSub.h:2{{using}}
+ // expected-note@Inputs/MethodPoolASub.h:2{{also found}}
}
void testMethod4Again(id object) {
diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp
index d4e73b5396..438dcab984 100644
--- a/test/Modules/module-private.cpp
+++ b/test/Modules/module-private.cpp
@@ -15,7 +15,7 @@ int test_broken() {
HiddenStruct hidden; // \
// expected-error{{must use 'struct' tag to refer to type 'HiddenStruct' in this scope}} \</