forked from OSchip/llvm-project
337d5aa58f
r235046 turned "extern __declspec(selectany) int a;" from a declaration into a definition to fix PR23242 (required for compatibility with mc.exe output). However, this broke parsing Windows headers: A d3d11 headers contain something like struct SomeStruct {}; extern const __declspec(selectany) SomeStruct some_struct; This is now a definition, and const objects either need an explicit default ctor or an initializer so this errors out with d3d11.h(1065,48) : error: default initialization of an object of const type 'const CD3D11_DEFAULT' without a user-provided default constructor (cl.exe just doesn't implement this rule, independent of selectany.) To work around this, weaken this error into a warning for selectany decls in microsoft mode, and recover with zero-initialization. Doing this is a bit hairy since it adds a fixit on an error emitted by InitializationSequence – this means it needs to build a correct AST, which in turn means InitializationSequence::Failed() cannot return true when this fixit is applied. As a workaround, the patch adds a fixit member to InitializationSequence, and InitializationSequence::Perform() prints the diagnostic if the fixit member is set right after its call to Diagnose. That function is usually called when InitializationSequences are used – InitListChecker::PerformEmptyInit() doesn't call it, but the InitListChecker case never performs default-initialization, so this is technically OK. This is the alternative, original fix for PR20208 that got reviewed in the thread "[patch] Improve diagnostic on default-initializing const variables (PR20208)". This change basically reverts r213725, adds the original fix for PR20208, and makes the error a warning in Microsoft mode. llvm-svn: 235166 |
||
---|---|---|
.. | ||
atomic-property.m | ||
auto-fixit.m | ||
auto-isa-fixit.m | ||
bridge-cast-in-arc.mm | ||
bridge-in-non-arc.m | ||
dereference-addressof.c | ||
fixit-autoreleasepool.m | ||
fixit-c90.c | ||
fixit-class-method-messaging.m | ||
fixit-cxx0x.cpp | ||
fixit-cxx1y-compat.cpp | ||
fixit-cxx11-attributes.cpp | ||
fixit-cxx11-compat.cpp | ||
fixit-eof-space.c | ||
fixit-errors-1.c | ||
fixit-errors.c | ||
fixit-function-call.cpp | ||
fixit-include.c | ||
fixit-include.h | ||
fixit-interface-as-param.m | ||
fixit-missing-method-return-type.m | ||
fixit-missing-self-in-block.m | ||
fixit-multiple-selector-warnings.m | ||
fixit-newline-style.c | ||
fixit-nsstring-compare.m | ||
fixit-objc-arc.m | ||
fixit-objc-bridge-related-attr.m | ||
fixit-objc-bridge-related-property.m | ||
fixit-objc-bridge-related.m | ||
fixit-objc-message-comma-separator.m | ||
fixit-objc-message.m | ||
fixit-objc.m | ||
fixit-pmem.cpp | ||
fixit-recompile.c | ||
fixit-recursive-block.c | ||
fixit-static-object-decl.m | ||
fixit-suffix.c | ||
fixit-unicode-with-utf8-output.c | ||
fixit-unicode.c | ||
fixit-uninit.c | ||
fixit-unrecoverable.c | ||
fixit-unrecoverable.cpp | ||
fixit-vexing-parse-cxx0x.cpp | ||
fixit-vexing-parse.cpp | ||
fixit.c | ||
fixit.cpp | ||
format-darwin.m | ||
format-no-fixit.m | ||
format.m | ||
format.mm | ||
messages.cpp | ||
multiarg-selector-fixit.m | ||
no-diagnostics-fixit-info.c | ||
no-fixit.cpp | ||
no-macro-fixit.c | ||
no-typo.c | ||
objc-literals.m | ||
property-access-fixit.m | ||
selector-fixit.m | ||
typo-crash.cpp | ||
typo-crash.m | ||
typo-location-bugs.cpp | ||
typo-using.cpp | ||
typo.c | ||
typo.cpp | ||
typo.m |