VerifyDiagnosticConsumer and ModuleMapParser

Vassil Vassilev vvasilev at cern.ch
Mon Nov 3 14:38:59 PST 2014


On 03/11/14 16:49, Ben Langmuir wrote:
>> On Nov 3, 2014, at 2:10 AM, Vassil Vassilev <vvasilev at cern.ch> wrote:
>>
>> Hi guys,
>>   I am working on http://llvm.org/bugs/show_bug.cgi?id=20507 Now the diagnostic gets issued for:
>>     Clang :: Modules/declare-use1.cpp
>>     Clang :: Modules/declare-use2.cpp
>>     Clang :: Modules/declare-use3.cpp
>>     Clang :: Modules/strict-decluse.cpp
>>
>> It says smth like: Modules/Inputs/declare-use/module.map:30:10: note: Header file 'unavailable.h' not present in module 'XF'
>>
>> I'd like to add an expected diag to the modulemap file. Eg:
>> module XF {
>>   ...
>>   header "unavailable.h" // expected-note {{...}}
>>   ...
>> }
>>
>> Is that the right way to go?
>>
>> If yes, VerifyDiagnosticConsumer requires some callbacks (such as HandleComment) which come from the Preprocessor. In the ModuleMapParser we use raw lexing (without PP at all) and I was wondering what would be the right way to go, in order to make the -verify flag work inside the module maps. One solution that I see is to pass the comment handlers from the PP to the ModuleMapParser, however IMO this would break the encapsulation. Do you have better ideas?
> Rather than complicate the module map parsing, we could always put the // expected line into the importing source file (using @file:line).  I thought this would Just Work (TM), but when I tried some silly examples the verification didn’t work.  I don’t know if that’s related to it being a module map file or something to do with the fatal error.  I’m not sure what’s going wrong there, but that’s the direction I would explore.
Thanks for the pointers. I have prepared a starter already. Wording of 
the diagnostic probably needs rewording :) Do you mind having a look?  
Thanks!
Vassil
>
> Ben
>
>> Many thanks,
>> Vassil


-- 
--------------------------------------------
Q: Why is this email five sentences or less?
A: http://five.sentenc.es

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug20507.diff
Type: text/x-patch
Size: 4318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141103/2dd1c7d8/attachment.bin>


More information about the cfe-commits mailing list