llvm-project/clang/test/Misc/serialized-diags.m
Justin Bogner a8dd73229e Correctly handle reading locations from serialized diagnostics
When reading a serialized diagnostic location with no file ID, we were
failing to increment the cursor past the rest of the location. This
would lead to the flags and category always appearing blank in such
diagnostics.

This changes the function to unconditionally increment the cursor and
updates the test to check for the correct output instead of testing
that we were doing this wrong. I've also updated the error check to
check for the correct number of fields.

llvm-svn: 219538
2014-10-10 22:20:26 +00:00

31 lines
1.2 KiB
Objective-C

@interface Foo
- (void) test;
- (void) test2;
@end
@implementation Foo
- (void) test {
[_self test2];
}
- (void) test2 {}
@end
// RUN: rm -f %t
// RUN: not %clang -Wall -fsyntax-only %s --serialize-diagnostics %t.diag > /dev/null 2>&1
// RUN: c-index-test -read-diagnostics %t.diag > %t 2>&1
// RUN: FileCheck --input-file=%t %s
// This test checks that serialized diagnostics handle notes with no source location.
// CHECK: {{.*[/\\]}}serialized-diags.m:8:4: error: use of undeclared identifier '_self'; did you mean 'self'? [] [Semantic Issue]
// CHECK: Range: {{.*[/\\]}}serialized-diags.m:8:4 {{.*[/\\]}}serialized-diags.m:8:9
// CHECK: Number FIXITs = 1
// CHECK: FIXIT: ({{.*[/\\]}}serialized-diags.m:8:4 - {{.*[/\\]}}serialized-diags.m:8:9): "self"
// CHECK: +-(null):0:0: note: 'self' is an implicit parameter [] [Semantic Issue]
// CHECK: Number FIXITs = 0
// CHECK: {{.*[/\\]}}serialized-diags.m:1:12: warning: class 'Foo' defined without specifying a base class [-Wobjc-root-class] [Semantic Issue]
// CHECK: Number FIXITs = 0
// CHECK: +-{{.*[/\\]}}serialized-diags.m:1:15: note: add a super class to fix this problem [] [Semantic Issue]
// CHECK: Number FIXITs = 0
// CHECK: Number of diagnostics: 2