r252114 - [modules] If we're given a module file, via -fmodule-file=, for a module, but

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 8 14:39:56 PST 2016


Hi Richard,

This change 
> @@ -2239,16 +2240,21 @@ ASTReader::ReadControlBlock(ModuleFile &F,
[...]
> -          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;

either causes or uncovers a bug:

> CC=/Volumes/Data/llvm/_build.ninja.debug/bin/clang # r256948
> rm -rf cache && mkdir cache
> rm -rf Test && mkdir Test
> echo 'module Test {
>   umbrella header "Test.h"
> }' >Test/module.modulemap
> touch Test/Test.h
> echo '#import <Test/Test.h>'>2.m
> 
> clang -x objective-c -fmodules -fmodules-cache-path=cache  -DA=0 -I. -c 2.m -o 1.o
> clang -x objective-c -fmodules -fmodules-cache-path=cache -Werror -DA=0 -I. -c 2.m -o 2.o
> 


After encountering a configuration mismatch or out-of-date error, we now continue instead of returning early and subsequently crash in

  ASTReader::ReadControlBlock()
    ASTReader::getInputFile()
      Cursor.JumpToBit(F.InputFileOffsets[ID-1]);

I’ll keep digging deeper, but I thought you may have an intuition of what’s going on here.
Is the behavior change intentional? From the commit message it sounds as if implicit module builds shouldn’t be affected.

-- adrian


More information about the cfe-commits mailing list