diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-05 00:54:55 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-05 00:54:55 +0000 |
commit | 8a308ec24d627e22c29b1e6305c334dc2ba4c4b4 (patch) | |
tree | 9b7de496955ab83aa8fe88800a1c6bb6ec2bb9a0 /clang/lib/Serialization | |
parent | 192c74802798a7cead3f5b53d74bed654f82c3d4 (diff) | |
download | bcm5719-llvm-8a308ec24d627e22c29b1e6305c334dc2ba4c4b4.tar.gz bcm5719-llvm-8a308ec24d627e22c29b1e6305c334dc2ba4c4b4.zip |
[modules] If we're given a module file, via -fmodule-file=, for a module, but
we can't load that file due to a configuration mismatch, and implicit module
building is disabled, and the user turns off the error-by-default warning for
that situation, then fall back to textual inclusion for the module rather than
giving an error if any of its headers are included.
llvm-svn: 252114
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index b7b56f68b81..32656037921 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2151,6 +2151,7 @@ ASTReader::ReadControlBlock(ModuleFile &F, const ModuleFile *ImportedBy, unsigned ClientLoadCapabilities) { BitstreamCursor &Stream = F.Stream; + ASTReadResult Result = Success; if (Stream.EnterSubBlock(CONTROL_BLOCK_ID)) { Error("malformed block record in AST file"); @@ -2211,7 +2212,7 @@ ASTReader::ReadControlBlock(ModuleFile &F, } } - return Success; + return Result; } case llvm::BitstreamEntry::SubBlock: @@ -2239,16 +2240,21 @@ ASTReader::ReadControlBlock(ModuleFile &F, bool AllowCompatibleConfigurationMismatch = F.Kind == MK_ExplicitModule; - auto Result = ReadOptionsBlock(Stream, ClientLoadCapabilities, - AllowCompatibleConfigurationMismatch, - *Listener, SuggestedPredefines); + Result = ReadOptionsBlock(Stream, ClientLoadCapabilities, + AllowCompatibleConfigurationMismatch, + *Listener, SuggestedPredefines); if (Result == Failure) { Error("malformed block record in AST file"); return Result; } - if (!DisableValidation && Result != Success && - (Result != ConfigurationMismatch || !AllowConfigurationMismatch)) + if (DisableValidation || + (AllowConfigurationMismatch && Result == ConfigurationMismatch)) + Result = Success; + + // If we've diagnosed a problem, we're done. + if (Result != Success && + isDiagnosedResult(Result, ClientLoadCapabilities)) return Result; } else if (Stream.SkipBlock()) { Error("malformed block record in AST file"); |