diff options
| -rw-r--r-- | clang/lib/CodeGen/CoverageMappingGen.cpp | 10 | ||||
| -rw-r--r-- | clang/test/CoverageMapping/objc.m | 11 |
2 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 836d09f7343..4c5f3751167 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -1042,6 +1042,16 @@ struct CounterCoverageMappingBuilder void VisitImaginaryLiteral(const ImaginaryLiteral *E) { mapToken(E->getLocStart()); } + + void VisitObjCMessageExpr(const ObjCMessageExpr *E) { + mapToken(E->getLeftLoc()); + for (Stmt::const_child_range I = static_cast<const Stmt*>(E)->children(); I; + ++I) { + if (*I) + this->Visit(*I); + } + mapToken(E->getRightLoc()); + } }; } diff --git a/clang/test/CoverageMapping/objc.m b/clang/test/CoverageMapping/objc.m new file mode 100644 index 00000000000..e14caa9bdb7 --- /dev/null +++ b/clang/test/CoverageMapping/objc.m @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name objc.m -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 %s | FileCheck %s + +@interface A +- (void)bork:(int)msg; +@end + + // CHECK: func +void func(A *a) { // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+3]]:2 = #0 (HasCodeBefore = 0) + if (a) + [a bork: 20 ]; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:20 = #1 (HasCodeBefore = 0) +} |

