{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift-clang/issues/45","repository_url":"https://api.github.com/repos/apple/swift-clang","labels_url":"https://api.github.com/repos/apple/swift-clang/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift-clang/issues/45/comments","events_url":"https://api.github.com/repos/apple/swift-clang/issues/45/events","html_url":"https://github.com/apple/swift-clang/pull/45","id":190378130,"number":45,"title":"Fix building specific Swift files in swift-clang with MSVC","user":{"login":"hughbe","id":1275900,"avatar_url":"https://avatars.githubusercontent.com/u/1275900?v=3","gravatar_id":"","url":"https://api.github.com/users/hughbe","html_url":"https://github.com/hughbe","followers_url":"https://api.github.com/users/hughbe/followers","following_url":"https://api.github.com/users/hughbe/following{/other_user}","gists_url":"https://api.github.com/users/hughbe/gists{/gist_id}","starred_url":"https://api.github.com/users/hughbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hughbe/subscriptions","organizations_url":"https://api.github.com/users/hughbe/orgs","repos_url":"https://api.github.com/users/hughbe/repos","events_url":"https://api.github.com/users/hughbe/events{/privacy}","received_events_url":"https://api.github.com/users/hughbe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-18T17:36:22Z","updated_at":"2016-11-29T17:07:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apple/swift-clang/pulls/45","html_url":"https://github.com/apple/swift-clang/pull/45","diff_url":"https://github.com/apple/swift-clang/pull/45.diff","patch_url":"https://github.com/apple/swift-clang/pull/45.patch"},"body":"Previous PR #44 was nuked by GitHub\r\n\r\n### Commit 1:\r\n- MSVC complains: specific_attr_begin is not a member of swift::Decl\r\n- The fix is to extract the default parameter and specifiy it for each call of the method\r\n\r\n### Commit 2:\r\nMSVC implodes compiling Clang, owing to the definition of llvm::None:\r\n```\r\nnamespace llvm {\r\n/// \\brief A simple null object to allow implicit construction of Optional<T>\r\n/// and similar types without having to spell out the specialization's name.\r\nenum class NoneType { None };\r\nconst NoneType None = None;\r\n}\r\n```\r\n\r\nhttps://connect.microsoft.com/VisualStudio/feedback/details/3111599/\r\n\r\nIt throws the following strange, obfuscated error:\r\n\r\n```\r\nError: Unhandled exception at 0x00007FFFF9669633 (ntdll.dll) in cl.exe: 0xC0000005: Access violation writing location 0x00000036C7A00E90.\r\n\r\n[1/665] Building CXX object tools\\clang\\lib\\APINotes\\CMakeFiles\\clangAPINotes.dir\\APINotesYAMLCompiler.cpp.obj\r\nFAILED: tools/clang/lib/APINotes/CMakeFiles/clangAPINotes.dir/APINotesYAMLCompiler.cpp.obj\r\nC:\\PROGRA~2\\MICROS~1.0\\VC\\bin\\amd64\\cl.exe   /nologo /TP -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\\clang\\lib\\APINotes -IC:\\Users\\hbellamy\\Documents\\GitHub\\llvm\\tools\\clang\\lib\\APINotes -IC:\\Users\\hbellamy\\Documents\\GitHub\\llvm\\tools\\clang\\include -Itools\\clang\\include -Iinclude -IC:\\Users\\hbellamy\\Documents\\GitHub\\llvm\\include /W4 -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 -we4238 /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast -O2   -UNDEBUG  /EHs-c- /GR- /showIncludes /Fotools\\clang\\lib\\APINotes\\CMakeFiles\\clangAPINotes.dir\\APINotesYAMLCompiler.cpp.obj /Fdtools\\clang\\lib\\APINotes\\CMakeFiles\\clangAPINotes.dir\\ /FS -c C:\\Users\\hbellamy\\Documents\\GitHub\\llvm\\tools\\clang\\lib\\APINotes\\APINotesYAMLCompiler.cpp\r\nInternal Compiler Error in C:\\PROGRA~2\\MICROS~1.0\\VC\\bin\\amd64\\cl.exe.  You will be prompted to send an error report to Microsoft later.\r\n```\r\n\r\nThe fix is to give MSVC some more information. However, it still complains if we use `llvm::None`, so we have to use `llvm::NoneType::None`. I assume the problem is that MSVC gets horribly confused at this line: `const NoneType None = None;`\r\n\r\n## Commit 3\r\n- MSVC cannot resolve the operator.\r\n- The fix is to add a static cast to unsigned: this has been done in other places in the file, and was missing in this case, presumably as an oversight\r\n\r\n/cc @DougGregor (this time, these files are swift-specific and no upstream version exists in Clang)\r\n\r\n@hyp @jrose-apple"},"comment":{"url":"https://api.github.com/repos/apple/swift-clang/issues/comments/263632721","html_url":"https://github.com/apple/swift-clang/pull/45#issuecomment-263632721","issue_url":"https://api.github.com/repos/apple/swift-clang/issues/45","id":263632721,"user":{"login":"jrose-apple","id":15097531,"avatar_url":"https://avatars.githubusercontent.com/u/15097531?v=3","gravatar_id":"","url":"https://api.github.com/users/jrose-apple","html_url":"https://github.com/jrose-apple","followers_url":"https://api.github.com/users/jrose-apple/followers","following_url":"https://api.github.com/users/jrose-apple/following{/other_user}","gists_url":"https://api.github.com/users/jrose-apple/gists{/gist_id}","starred_url":"https://api.github.com/users/jrose-apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrose-apple/subscriptions","organizations_url":"https://api.github.com/users/jrose-apple/orgs","repos_url":"https://api.github.com/users/jrose-apple/repos","events_url":"https://api.github.com/users/jrose-apple/events{/privacy}","received_events_url":"https://api.github.com/users/jrose-apple/received_events","type":"User","site_admin":false},"created_at":"2016-11-29T17:07:34Z","updated_at":"2016-11-29T17:07:34Z","body":"Ah, will do.\r\n\r\n@swift-ci Please test"}}
{"actor":{"display_login":"jrose-apple"}}