r216081 - Coverage mapping: fix mapping for objective-c message expression
Alex Lorenz
arphaman at gmail.com
Wed Aug 20 10:10:57 PDT 2014
Author: arphaman
Date: Wed Aug 20 12:10:56 2014
New Revision: 216081
URL: http://llvm.org/viewvc/llvm-project?rev=216081&view=rev
Log:
Coverage mapping: fix mapping for objective-c message expression
Added:
cfe/trunk/test/CoverageMapping/objc.m
Modified:
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=216081&r1=216080&r2=216081&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Wed Aug 20 12:10:56 2014
@@ -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());
+ }
};
}
Added: cfe/trunk/test/CoverageMapping/objc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/objc.m?rev=216081&view=auto
==============================================================================
--- cfe/trunk/test/CoverageMapping/objc.m (added)
+++ cfe/trunk/test/CoverageMapping/objc.m Wed Aug 20 12:10:56 2014
@@ -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
+
+ at interface A
+- (void)bork:(int)msg;
+ at 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)
+}
More information about the cfe-commits
mailing list