Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Parse] multiline strings inside interpolations #9049

Merged
merged 6 commits into from
Apr 28, 2017

Conversation

johnno1962
Copy link
Contributor

A late requirement emgerged during the implementation of SE proposal 0168 that it should be possible to use multiline strings inside interpolations. These are the minor changes necessary to skipToEndOfInterpolatedExpression() to allow this.

Resolves SR-4708.

@@ -1257,9 +1258,11 @@ static const char *skipToEndOfInterpolatedExpression(const char *CurPtr,
// issues with malformed tokens or other problems.
switch (*CurPtr++) {
// String literals in general cannot be split across multiple lines;
// interpolated ones are no exception.
// interpolated ones are no exception (unless multiline strings.)
Copy link
Collaborator

@xwu xwu Apr 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: period after parenthesis; also, it's "unless multiline string literals" yes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m never sure about that.. I’ll change it

Copy link
Collaborator

@xwu xwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hurray! Excited for this.

@johnno1962
Copy link
Contributor Author

johnno1962 commented Apr 27, 2017

Toolchain: http://johnholdsworth.com/swift-LOCAL-2017-04-27-a-osx.tar.gz

This now works:

      let bookTuples = [(1, "john", "book", "novel", 9.99),
                        (2, "john", "book", "novel", 9.99)]

      print("""
            <?xml version="1.0"?>
            <catalog>
            \(bookTuples.map { (id, author, title, genre, price) in """
                <book id="bk\(id)" empty="">
                    <author>\(author)</author>
                    <title>\(title)</title>
                    <genre>\(genre)</genre>
                    <price>\(price)</price>
                </book>
            """}.joined(separator:"\n"))
            </catalog>
            """)

<?xml version="1.0"?>
<catalog>
    <book id="bk1" empty="">
        <author>john</author>
        <title>book</title>
        <genre>novel</genre>
        <price>9.99</price>
    </book>
    <book id="bk2" empty="">
        <author>john</author>
        <title>book</title>
        <genre>novel</genre>
        <price>9.99</price>
    </book>
</catalog>

@johnno1962
Copy link
Contributor Author

You get the occasional SourceKit crash while you're typing - always in the same place:

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000168
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]

0 com.apple.SourceKitService.swift-LOCAL-2017-04-26-a 0x0000000102f5157d swift::InFlightDiagnostic swift::DiagnosticEngine::diagnose<>(swift::SourceLoc, swift::Diag<>, swift::detail::PassArgument<>::type) + 29
1 com.apple.SourceKitService.swift-LOCAL-2017-04-26-a 0x0000000102b16151 swift::Lexer::lexStringLiteral() + 1553

Something to look at another day.

@milseman
Copy link
Member

Sweet! As to that SourceKit crash, do you have more information? E.g, is it because we're reading past the end of a buffer now? (and if so, then the common logic could be extracted into a safer utility function). At this stage, I'd hate to introduce new potential crashers.

@johnno1962
Copy link
Contributor Author

johnno1962 commented Apr 27, 2017

I’ve made a small change to skipToEndOfInterpolatedExpression() to prevent the possibility of it running off the end of the buffer and fuzzed it for half an hour with a script to make random changes to an example source and compile it to see if I could generate a crash - no problems yet.

@xwu
Copy link
Collaborator

xwu commented Apr 27, 2017

@johnno1962 Hmm, the existing logic shouldn't be broken, as there's a case for EOF and lexing always proceeded character by character. I'd have to surmise that something about your new logic is jumping past it.

@johnno1962
Copy link
Contributor Author

johnno1962 commented Apr 27, 2017

I see what you mean.. I have it boxed in to the following causing a SourceKit crash. Any ideas?:

//
//  AppDelegate.swift
//  Multiline
//
//  Created by John Holdsworth on 09/04/2017.
//  Copyright © 2017 John Holdsworth. All rights reserved.
//

    func applicationDidFinishLaunching(_ aNotification: Notification) {
        // Insert code here to initialize your application

      print("\((0..<10).map {"""
        \("a" + """
         \($0) valid
        """)
        """}.joined(separator:" ")) literal")


      let bookTuples = [(1, "john", "book", "novel", 9.99),
                        (2, "john", "book", "novel", 9.99)]

      print("
            <?xml version="1.0"?>
            <catalog>
            \(bookTuples.map { (id, author, title, genre, price) in """
                <book id="bk\(id)" empty="">
                    <author>\(author)</author>
                    <title>\(title)</title>
                    <genre>\(genre)</genre>
                    <price>\(price)</price>
                </book>
            """}.joined(separator:"\n"))
            </catalog>
            """)

    }

Odd thing is deleting or commenting out the first section about “a valid literal” makes crash go away.

@milseman
Copy link
Member

Do you have a backtrace for the crash?

@johnno1962
Copy link
Contributor Author

Do I?

Process:               SourceKitService [43907]
Path:                  /Library/Developer/Toolchains/swift-LOCAL-2017-04-27-a.xctoolchain/usr/lib/sourcekitd.framework/Versions/A/XPCServices/SourceKitService.xpc/Contents/MacOS/SourceKitService
Identifier:            SourceKitService
Version:               1.0 (swift-LOCAL-2017-04-27-a)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           com.apple.dt.SourceKitService [42539]
User ID:               501

Date/Time:             2017-04-27 21:15:35.605 +0100
OS Version:            Mac OS X 10.12.4 (16E195)
Report Version:        12
Anonymous UUID:        02D2198B-1242-6CEF-1917-5BF2C565B7C4


Time Awake Since Boot: 640000 seconds

System Integrity Protection: enabled

Crashed Thread:        4  Dispatch queue: com.apple.root.default-qos

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000168
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0x168:
--> 
    __TEXT                 00000001052ab000-000000010896e000 [ 54.8M] r-x/rwx SM=COW  /Library/Developer/Toolchains/swift-LOCAL-2017-04-27-a.xctoolchain/usr/lib/sourcekitd.framework/Versions/A/XPCServices/SourceKitService.xpc/Contents/MacOS/SourceKitService

Thread 0:
0   libsystem_kernel.dylib        	0x00007fff94fadf5e __semwait_signal_nocancel + 10
1   libsystem_c.dylib             	0x00007fff94ebb904 nanosleep$NOCANCEL + 188
2   libsystem_c.dylib             	0x00007fff94ee2f23 sleep$NOCANCEL + 42
3   libdispatch.dylib             	0x00007fff94e571ee _dispatch_queue_cleanup2 + 113
4   libsystem_pthread.dylib       	0x00007fff9509a413 _pthread_tsd_cleanup + 544
5   libsystem_pthread.dylib       	0x00007fff9509a14d _pthread_exit + 152
6   libsystem_pthread.dylib       	0x00007fff9509acac pthread_exit + 30
7   libdispatch.dylib             	0x00007fff94e57155 dispatch_main + 110
8   libxpc.dylib                  	0x00007fff950d886a _xpc_objc_main + 682
9   libxpc.dylib                  	0x00007fff950d72e4 xpc_main + 494
10  com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x00000001052ade7b main + 1163
11  libdyld.dylib                 	0x00007fff94e7f235 start + 1

Thread 1:: Dispatch queue: com.apple.root.default-qos.overcommit
0   libsystem_kernel.dylib        	0x00007fff94fae1e6 __sigsuspend_nocancel + 10
1   libdispatch.dylib             	0x00007fff94e57264 _dispatch_sigsuspend + 21
2   libdispatch.dylib             	0x00007fff94e5724f _dispatch_sig_thread + 41

Thread 2:
0   libsystem_kernel.dylib        	0x00007fff94fae44e __workq_kernreturn + 10
1   libsystem_pthread.dylib       	0x00007fff95098502 _pthread_wqthread + 1023
2   libsystem_pthread.dylib       	0x00007fff950980f1 start_wqthread + 13

Thread 3:
0   libsystem_kernel.dylib        	0x00007fff94fae44e __workq_kernreturn + 10
1   libsystem_pthread.dylib       	0x00007fff95098502 _pthread_wqthread + 1023
2   libsystem_pthread.dylib       	0x00007fff950980f1 start_wqthread + 13

Thread 4 Crashed:: Dispatch queue: com.apple.root.default-qos
0   com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x0000000105c9617d swift::InFlightDiagnostic swift::DiagnosticEngine::diagnose<>(swift::SourceLoc, swift::Diag<>, swift::detail::PassArgument<>::type) + 29
1   com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x000000010583b791 swift::Lexer::lexStringLiteral() + 1553
2   com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x0000000105834ec7 swift::Lexer::lexImpl() + 1447
3   com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x0000000105877e55 swift::tokenize(swift::LangOptions const&, swift::SourceManager const&, unsigned int, unsigned int, unsigned int, bool, bool, llvm::ArrayRef<swift::Token>) + 597
4   com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x000000010587814e swift::tokenize(swift::LangOptions const&, swift::SourceManager const&, unsigned int, unsigned int, unsigned int, bool, bool, llvm::ArrayRef<swift::Token>) + 1358
5   com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x000000010587814e swift::tokenize(swift::LangOptions const&, swift::SourceManager const&, unsigned int, unsigned int, unsigned int, bool, bool, llvm::ArrayRef<swift::Token>) + 1358
6   com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x0000000105445545 swift::ide::SyntaxModelContext::SyntaxModelContext(swift::SourceFile&) + 213
7   com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x00000001052de9a7 SourceKit::SwiftEditorDocument::readSyntaxInfo(SourceKit::EditorConsumer&) + 967
8   com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x00000001052e163c SourceKit::SwiftLangSupport::editorOpen(llvm::StringRef, llvm::MemoryBuffer*, bool, SourceKit::EditorConsumer&, llvm::ArrayRef<char const*>) + 1228
9   com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x000000010530f81d handleRequestImpl(void*, std::__1::function<void (void*)>) + 4941
10  com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x000000010530e45d sourcekitd::handleRequest(void*, std::__1::function<void (void*)>) + 429
11  com.apple.SourceKitService.swift-LOCAL-2017-04-27-a	0x00000001052ae3a6 ___ZL35sourcekitdServer_peer_event_handlerP17_xpc_connection_sPv_block_invoke + 214
12  libdispatch.dylib             	0x00007fff94e52524 _dispatch_call_block_and_release + 12
13  libdispatch.dylib             	0x00007fff94e498fc _dispatch_client_callout + 8
14  libdispatch.dylib             	0x00007fff94e58196 _dispatch_queue_override_invoke + 743
15  libdispatch.dylib             	0x00007fff94e4b6b5 _dispatch_root_queue_drain + 476
16  libdispatch.dylib             	0x00007fff94e4b48c _dispatch_worker_thread3 + 99
17  libsystem_pthread.dylib       	0x00007fff95098616 _pthread_wqthread + 1299
18  libsystem_pthread.dylib       	0x00007fff950980f1 start_wqthread + 13

Thread 5:
0   libsystem_kernel.dylib        	0x00007fff94fae44e __workq_kernreturn + 10
1   libsystem_pthread.dylib       	0x00007fff95098502 _pthread_wqthread + 1023
2   libsystem_pthread.dylib       	0x00007fff950980f1 start_wqthread + 13

Thread 4 crashed with X86 Thread State (64-bit):
  rax: 0x0000000108cb3ed8  rbx: 0x00007fe637004a22  rcx: 0x0000000000000031  rdx: 0x00007fe6370047e3
  rdi: 0x000070000546c7f0  rsi: 0x0000000000000000  rbp: 0x000070000546c760  rsp: 0x000070000546c610
   r8: 0x0000000000000020   r9: 0x0000000000000001  r10: 0x0000000000000001  r11: 0x000000000000000c
  r12: 0x0000000000000000  r13: 0x0000000000000270  r14: 0x000070000546c7f0  r15: 0x00007fe6370047e3
  rip: 0x0000000105c9617d  rfl: 0x0000000000010202  cr2: 0x0000000000000168
  
Logical CPU:     1
Error Code:      0x00000004
Trap Number:     14


Binary Images:
       0x1052ab000 -        0x10896dff7  com.apple.SourceKitService.swift-LOCAL-2017-04-27-a (1.0 - swift-LOCAL-2017-04-27-a) <0F00A756-C06D-3D5E-92E2-E95D41A9B66F> /Library/Developer/Toolchains/swift-LOCAL-2017-04-27-a.xctoolchain/usr/lib/sourcekitd.framework/Versions/A/XPCServices/SourceKitService.xpc/Contents/MacOS/SourceKitService
       0x109761000 -        0x10979edc7  dyld (433.5) <8239D0D7-66F6-3C44-A77F-586F74525DA3> /usr/lib/dyld
    0x7fff938d7000 -     0x7fff938d8ffb  libSystem.B.dylib (1238.51.1) <D9B20A4F-87BC-36CB-9405-80E105666725> /usr/lib/libSystem.B.dylib
    0x7fff93a11000 -     0x7fff93a67ff7  libc++.1.dylib (307.5) <0B43BB5D-E6EB-3464-8DE9-B41AC8ED9D1C> /usr/lib/libc++.1.dylib
    0x7fff93a68000 -     0x7fff93a92fff  libc++abi.dylib (307.3) <30199352-88BF-30BD-8CFF-2A4FBE247523> /usr/lib/libc++abi.dylib
    0x7fff944d8000 -     0x7fff94509ffb  libncurses.5.4.dylib (51.30.1) <B03B1BD2-7080-3856-BB02-7E8238320C3B> /usr/lib/libncurses.5.4.dylib
    0x7fff94585000 -     0x7fff94957047  libobjc.A.dylib (709) <DC77AA6E-A4E4-326D-8D7F-82D63AA88F99> /usr/lib/libobjc.A.dylib
    0x7fff94d83000 -     0x7fff94d94ff3  libz.1.dylib (67) <46E3FFA2-4328-327A-8D34-A03E20BFFB8E> /usr/lib/libz.1.dylib
    0x7fff94da3000 -     0x7fff94da7ff7  libcache.dylib (79) <093A4DAB-8385-3D47-A350-E20CB7CCF7BF> /usr/lib/system/libcache.dylib
    0x7fff94da8000 -     0x7fff94db2fff  libcommonCrypto.dylib (60092.50.5) <BE8380C5-C09D-3F48-A502-AEBB58231067> /usr/lib/system/libcommonCrypto.dylib
    0x7fff94db3000 -     0x7fff94dbafff  libcompiler_rt.dylib (62) <55D47421-772A-32AB-B529-1A46C2F43B4D> /usr/lib/system/libcompiler_rt.dylib
    0x7fff94dbb000 -     0x7fff94dc3fff  libcopyfile.dylib (138) <819BEA3C-DF11-3E3D-A1A1-5A51C5BF1961> /usr/lib/system/libcopyfile.dylib
    0x7fff94dc4000 -     0x7fff94e47fdf  libcorecrypto.dylib (442.50.19) <8A39EE06-121C-3731-A9E9-35847064B3EE> /usr/lib/system/libcorecrypto.dylib
    0x7fff94e48000 -     0x7fff94e79fff  libdispatch.dylib (703.50.37) <D122E712-9593-31CA-BAC4-4A54410BF4A0> /usr/lib/system/libdispatch.dylib
    0x7fff94e7a000 -     0x7fff94e7fffb  libdyld.dylib (433.5) <129D3B44-FB21-3750-9A68-48B5C3DC632B> /usr/lib/system/libdyld.dylib
    0x7fff94e80000 -     0x7fff94e80ffb  libkeymgr.dylib (28) <7AA011A9-DC21-3488-BF73-3B5B14D1FDD6> /usr/lib/system/libkeymgr.dylib
    0x7fff94e8e000 -     0x7fff94e8efff  liblaunch.dylib (972.50.27) <037D198D-9B02-3EF9-A8E9-6F43EA555A9E> /usr/lib/system/liblaunch.dylib
    0x7fff94e8f000 -     0x7fff94e94ff3  libmacho.dylib (898) <17D5D855-F6C3-3B04-B680-E9BF02EF8AED> /usr/lib/system/libmacho.dylib
    0x7fff94e95000 -     0x7fff94e97ff3  libquarantine.dylib (85.50.1) <7B32EA91-AB8B-32A4-8E52-9D3ED46CAC8E> /usr/lib/system/libquarantine.dylib
    0x7fff94e98000 -     0x7fff94e99ffb  libremovefile.dylib (45) <38D4CB9C-10CD-30D3-8B7B-A515EC75FE85> /usr/lib/system/libremovefile.dylib
    0x7fff94e9a000 -     0x7fff94eb2ff7  libsystem_asl.dylib (349.50.5) <096E4228-3B7C-30A6-8B13-EC909A64499A> /usr/lib/system/libsystem_asl.dylib
    0x7fff94eb3000 -     0x7fff94eb3ff7  libsystem_blocks.dylib (67) <10DC5404-73AB-35B3-A277-A8AFECB476EB> /usr/lib/system/libsystem_blocks.dylib
    0x7fff94eb4000 -     0x7fff94f41fef  libsystem_c.dylib (1158.50.2) <B03F8915-1E9B-3C84-AED5-68E2E0031630> /usr/lib/system/libsystem_c.dylib
    0x7fff94f42000 -     0x7fff94f45ffb  libsystem_configuration.dylib (888.51.2) <872C8A42-0871-3424-830B-84E587A75D27> /usr/lib/system/libsystem_configuration.dylib
    0x7fff94f46000 -     0x7fff94f49fff  libsystem_coreservices.dylib (41.4) <FD0915E8-9C43-3FCB-94E0-33C45DF028CD> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff94f4a000 -     0x7fff94f62fff  libsystem_coretls.dylib (121.50.4) <EC6FCF07-DCFB-3A03-9CC9-6DD3709974C6> /usr/lib/system/libsystem_coretls.dylib
    0x7fff94f63000 -     0x7fff94f69fff  libsystem_dnssd.dylib (765.50.9) <FF02A197-7CEF-3684-8155-E5E225051E44> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff94f6a000 -     0x7fff94f93ff7  libsystem_info.dylib (503.50.4) <611DB84C-BF70-3F92-8702-B9F28A900920> /usr/lib/system/libsystem_info.dylib
    0x7fff94f94000 -     0x7fff94fb6ff7  libsystem_kernel.dylib (3789.51.2) <FC51D7B0-8292-3F6A-9231-64340B237EB7> /usr/lib/system/libsystem_kernel.dylib
    0x7fff94fb7000 -     0x7fff94ffefe7  libsystem_m.dylib (3121.6) <A790C9A5-DD24-32F5-8FD7-33BFCE79AC87> /usr/lib/system/libsystem_m.dylib
    0x7fff94fff000 -     0x7fff9501dff7  libsystem_malloc.dylib (116.50.8) <48D1BBA3-914E-3C65-AF70-C33B4A1B5233> /usr/lib/system/libsystem_malloc.dylib
    0x7fff9501e000 -     0x7fff95077ffb  libsystem_network.dylib (856.50.56) <FDE14243-4328-3EFD-824C-C0D314D7B540> /usr/lib/system/libsystem_network.dylib
    0x7fff95078000 -     0x7fff95081ff3  libsystem_networkextension.dylib (563.50.32) <D5381DA9-529C-3588-BE16-A2245DE93423> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff95082000 -     0x7fff9508bff3  libsystem_notify.dylib (165.20.1) <B8160190-A069-3B3A-BDF6-2AA408221FAE> /usr/lib/system/libsystem_notify.dylib
    0x7fff9508c000 -     0x7fff95094fe7  libsystem_platform.dylib (126.50.8) <5940EAB7-84D6-34DC-9B38-111648B2B589> /usr/lib/system/libsystem_platform.dylib
    0x7fff95095000 -     0x7fff9509fff7  libsystem_pthread.dylib (218.51.1) <62A84A68-431D-3B54-A7B6-31367CCF2884> /usr/lib/system/libsystem_pthread.dylib
    0x7fff950a0000 -     0x7fff950a3ff7  libsystem_sandbox.dylib (592.50.47) <87A2327D-B7A1-3E4C-A85D-D3D9484003DB> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff950a4000 -     0x7fff950a5ff3  libsystem_secinit.dylib (24.50.4) <F78B847B-3565-3E4B-98A6-F7AD40392E2D> /usr/lib/system/libsystem_secinit.dylib
    0x7fff950a6000 -     0x7fff950adffb  libsystem_symptoms.dylib (532.50.47) <9CF6A47C-8343-3E85-9C27-A8D98E726A8B> /usr/lib/system/libsystem_symptoms.dylib
    0x7fff950ae000 -     0x7fff950c1ff7  libsystem_trace.dylib (518.51.1) <E1D540D8-CC88-3901-92BA-FC4B802FE0E8> /usr/lib/system/libsystem_trace.dylib
    0x7fff950c2000 -     0x7fff950c7ffb  libunwind.dylib (35.3) <3D50D8A8-C460-334D-A519-2DA841102C6B> /usr/lib/system/libunwind.dylib
    0x7fff950c8000 -     0x7fff950f1ff7  libxpc.dylib (972.50.27) <ABC45890-DA23-3A4A-B50B-1384BD4CBBDF> /usr/lib/system/libxpc.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 35384365
    thread_create: 1
    thread_set_state: 4247

VM Region Summary:
ReadOnly portion of Libraries: Total=186.8M resident=0K(0%) swapped_out_or_unallocated=186.8M(100%)
Writable regions: Total=55.2M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=55.2M(100%)
 
                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Activity Tracing                   256K        2 
Dispatch continuations            8192K        2 
Kernel Alloc Once                    8K        2 
MALLOC                            36.2M        8 
MALLOC guard page                   16K        4 
STACK GUARD                       56.0M        7 
Stack                             10.5M        7 
__DATA                            5168K       44 
__LINKEDIT                       123.9M        4 
__TEXT                            62.9M       43 
shared memory                       12K        4 
===========                     =======  ======= 
TOTAL                            302.9M      116 

@milseman
Copy link
Member

So this is crashing while trying to emit a diagnostic. If you look at Lexer::diagnose, you'll see:

  if (Diags)
    return Diags->diagnose(getSourceLoc(Loc), Diag);
  
  return InFlightDiagnostic();

That is, it checks for a null Diags first. But, in this patch, it seems validateMultilineIndents is no longer null safe. Is that intended?

@johnno1962
Copy link
Contributor Author

Well spotted. Was just building that at the moment - I’ll have an answer for you in about half an hour.

@johnno1962
Copy link
Contributor Author

Why wouldn’t I see validateMultilineIndents in the stack trace though? Does it get inlined?

@milseman
Copy link
Member

Probably, as that trace looks like it's from a release build.

@johnno1962
Copy link
Contributor Author

OK, that really seems to have fixed it. Diags is nulll during Syntax highlighting I guess. Pretty high degree of confidence on this patch now when you’re ready to merge.

@milseman
Copy link
Member

@swift-ci please smoke test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - aca8dfd
Test requested by - @milseman

@milseman
Copy link
Member

(I'm hoping ci was taking a nap when I asked for a full test run...)

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - aca8dfd
Test requested by - @milseman

@johnno1962
Copy link
Contributor Author

OSX Build seems jammed. Failed with something unrelated:

16:46:21 FAIL: Swift(iphonesimulator-i386) :: DebugInfo/ErrorVar.swift (460 of 9761)
16:46:21
******************** TEST 'Swift(iphonesimulator-i386) :: DebugInfo/ErrorVar.swift' FAILED ********************
16:46:21 Script:
16:46:21 --
16:46:21 /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/buildbot_incremental/swift-macosx-x86_64/bin/swiftc -frontend -target i386-apple-ios7.0 -module-cache-path '/var/folders/_8/79jmzf2142z2xydc_01btlx00000gn/T/swift-testsuite-clang-module-cacheJXIQfK' -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -swift-version 3 /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/swift/test/DebugInfo/ErrorVar.swift -emit-ir -g -o - | /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/swift/utils/PathSanitizingFileCheck --sanitize 'BUILD_DIR=/Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/buildbot_incremental/swift-macosx-x86_64' --sanitize 'SOURCE_DIR=/Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/swift' --use-filecheck '/Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/buildbot_incremental/llvm-macosx-x86_64/./bin/FileCheck' /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/swift/test/DebugInfo/ErrorVar.swift
16:46:21 --
16:46:21 Exit Code: 1
16:46:21
16:46:21 Command Output (stderr):
16:46:21 --
16:46:21
/Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/swift/test/DebugInfo/ErrorVar.swift:14:12: error: expected string not found in input
16:46:21 // CHECK: define {{.}}void @_T06Errors6simpleys5Int64VKF(i64, %swift.refcounted swiftself, %swift.error**)
16:46:21 ^
16:46:21 :1:1: note: scanning from here
16:46:21 ; ModuleID = '-'
16:46:21 ^
16:46:21
16:46:21 --
16:46:21
16:46:21 ********************

Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants