[PATCH] SILParser: handle global_addr, allow global variables in .sil file

Manman Ren mren at apple.com
Thu Jul 18 10:45:28 PDT 2013


In r6346.

Thanks,
Manman

On Jul 18, 2013, at 9:17 AM, Chris Lattner <clattner at apple.com> wrote:

> lgtm.
> 
> -Chris
> 
> On Jul 17, 2013, at 5:47 PM, Manman Ren <mren at apple.com> wrote:
> 
>> 
>> The testing case has a global variable defined in .sil: "var x: Int = 0"
>> When parsing the .sil file, I got an assertion failure where the type of a ValueDecl is null.
>> 
>> To fix the problem, the patch modified lib/Sema/TypeCheckDecl.cpp:
>> @@ -316,6 +316,7 @@
>>  void visitPatternBindingDecl(PatternBindingDecl *PBD) {
>>    bool DelayCheckingPattern =
>>      TC.TU.Kind != TranslationUnit::Library &&
>> +      TC.TU.Kind != TranslationUnit::SIL &&
>>      PBD->getDeclContext()->isModuleContext();
>>    if (IsSecondPass && !DelayCheckingPattern) {
>>      if (PBD->getInit() && PBD->getPattern()->hasType()) {
>> 
>> Inside SILParser, a module level lookup is used to find the VarDecl for the global variable.
>> 
>> Thanks for reviewing,
>> Manman
>> <global_addr.patch>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130718/de8c02f0/attachment.html>


More information about the llvm-commits mailing list