C Chung via llvm-dev
2016-Aug-16 22:43 UTC
[llvm-dev] does #line directive of c++ work for Source-based Code Coverage?
Hi All, I tried to use line directive in one of my C++ source file hoping that the report generated from llvm-cov will display the file name and line number specified in "#line ..." directive instead of the real file that got compiled, but it does not seem to work. Do you know how or if it is even possible to do so? [detailed problem description] 1. I have a main file named "foo.cpp" and another file named "real.cpp" 2. at the bottom of "foo.cpp", it has a block of code clipped from "real.cpp" (say line 10 to line 20 of real.cpp). 3. right before the clipped code, I added the following line directive in front of it (in foo.cpp). #line 10 "real.cpp" 4. Then, I compile it (clang++ -fprofile-instr-generate -fcoverage-mapping foo.cpp -o foo), run the executable file, get raw profile, index the raw profile, and run llvm-cov -show/report to read the coverage. 5. In the report, the file name always shows up as "foo.cpp" NOT "real.cpp" 6. What I really want is having the report showing line number and file name from "real.cpp". Thank you very much for your time and help. Best, Chien -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160816/7a5c8f4a/attachment.html>
Vedant Kumar via llvm-dev
2016-Aug-17 00:00 UTC
[llvm-dev] does #line directive of c++ work for Source-based Code Coverage?
Hi Chien, This isn't supported at the moment. I've filed http://llvm.org/bugs/show_bug.cgi?id=29008. Thanks for the report! vedant> On Aug 16, 2016, at 3:43 PM, C Chung via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi All, > > I tried to use line directive in one of my C++ source file hoping that the report generated from llvm-cov will display the file name and line number specified in "#line ..." directive instead of the real file that got compiled, but it does not seem to work. > > Do you know how or if it is even possible to do so? > > [detailed problem description] > 1. I have a main file named "foo.cpp" and another file named "real.cpp" > 2. at the bottom of "foo.cpp", it has a block of code clipped from "real.cpp" (say line 10 to line 20 of real.cpp). > 3. right before the clipped code, I added the following line directive in front of it (in foo.cpp). > #line 10 "real.cpp" > 4. Then, I compile it (clang++ -fprofile-instr-generate -fcoverage-mapping foo.cpp -o foo), run the executable file, get raw profile, index the raw profile, and run llvm-cov -show/report to read the coverage. > 5. In the report, the file name always shows up as "foo.cpp" NOT "real.cpp" > 6. What I really want is having the report showing line number and file name from "real.cpp". > > Thank you very much for your time and help. > > Best, > Chien > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev