[llvm] r254363 - [Windows] Simplify assertion code. NFC.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 21:37:35 PST 2015


On Mon, Nov 30, 2015 at 8:51 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
> On Mon, Nov 30, 2015 at 6:35 PM, Davide Italiano via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: davide
>> Date: Mon Nov 30 20:35:04 2015
>> New Revision: 254363
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=254363&view=rev
>> Log:
>> [Windows] Simplify assertion code. NFC.
>>
>>
>> Modified:
>>     llvm/trunk/lib/Support/Windows/DynamicLibrary.inc
>>     llvm/trunk/lib/Support/Windows/Signals.inc
>>
>> Modified: llvm/trunk/lib/Support/Windows/DynamicLibrary.inc
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/DynamicLibrary.inc?rev=254363&r1=254362&r2=254363&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Support/Windows/DynamicLibrary.inc (original)
>> +++ llvm/trunk/lib/Support/Windows/DynamicLibrary.inc Mon Nov 30 20:35:04
>> 2015
>> @@ -61,10 +61,8 @@ DynamicLibrary DynamicLibrary::getPerman
>>        OpenedHandles = new DenseSet<HMODULE>();
>>
>>      if (!fEnumerateLoadedModules) {
>> -      if (!loadDebugHelp()) {
>> -        assert(false && "These APIs should always be available");
>> -        return DynamicLibrary();
>> -      }
>> +      assert(loadDebugHelp() && "These APIs should always be available");
>> +      return DynamicLibrary();
>
>
> This looks like the wrong transformation - the previous code never returned
> under valid situations (it only returned when the assertion would've fired)
>
> It looks like this should be:
>
>   assert(fEnumerateLoadedModules || loadDebugHelp())
>
> with no ifs/returns, yes?
>

Thanks for catching this. Sorry I don't have a Windows machine right
now (and I won't have until tomorrow) so I reverted this in r254378 in
the meanwhile.

Thanks!

--
Davide


More information about the llvm-commits mailing list