summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-04-17 08:32:38 +0000
committerNico Weber <nicolasweber@gmx.de>2015-04-17 08:32:38 +0000
commit337d5aa58fc22dd174dd6e9e96a764cf5a85f1fc (patch)
tree6943da87d7ad02fe16b585e345d325fd2124d585 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent607da974b2a4de3bc4f2d016c9c6c2dfe9bc8471 (diff)
downloadbcm5719-llvm-337d5aa58fc22dd174dd6e9e96a764cf5a85f1fc.tar.gz
bcm5719-llvm-337d5aa58fc22dd174dd6e9e96a764cf5a85f1fc.zip
Move fixit for const init from note to diag, weaken to warning in MS mode.
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
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud