r213454 - If a module build reports errors, don't try to load it

Ben Langmuir blangmuir at apple.com
Sat Jul 19 10:17:02 PDT 2014


> On Jul 19, 2014, at 10:00 AM, Sebastian Redl <sebastian.redl at getdesigned.at> wrote:
> 
> 
> On 19 Jul 2014, at 18:29, Ben Langmuir <blangmuir at apple.com> wrote:
> 
>> Author: benlangmuir
>> Date: Sat Jul 19 11:29:28 2014
>> New Revision: 213454
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=213454&view=rev
>> Log:
>> If a module build reports errors, don't try to load it
>> 
>> ... just to find out that it didn't build.
>> 
>> Modified:
>>   cfe/trunk/lib/Frontend/CompilerInstance.cpp
>> 
>> Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=213454&r1=213453&r2=213454&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
>> +++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Sat Jul 19 11:29:28 2014
>> @@ -852,11 +852,12 @@ static InputKind getSourceInputKindFromO
>> }
>> 
>> /// \brief Compile a module file for the given module, using the options 
>> -/// provided by the importing compiler instance.
>> -static void compileModuleImpl(CompilerInstance &ImportingInstance,
>> -                          SourceLocation ImportLoc,
>> -                          Module *Module,
>> -                          StringRef ModuleFileName) {
>> +/// provided by the importing compiler instance. Returns true if the module
>> +/// was built without errors.
> 
> That’s the opposite of the Clang convention - almost all functions return true on error.

Hi Sebastian,

I used “true on success” to be the consistent with compileAndLoadModule, but it’s also consistent with the rest of CompilerInstance and CompilerInvocation: all of their methods that use bool as an error code return “true on success”.  I honestly don’t care either way, I just like to be locally consistent.

Ben

> 
> Sebastian





More information about the cfe-commits mailing list