[llvm] r254363 - [Windows] Simplify assertion code. NFC.
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 30 20:51:32 PST 2015
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?
> }
>
> fEnumerateLoadedModules(GetCurrentProcess(), ELM_Callback, 0);
>
> Modified: llvm/trunk/lib/Support/Windows/Signals.inc
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Signals.inc?rev=254363&r1=254362&r2=254363&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Support/Windows/Signals.inc (original)
> +++ llvm/trunk/lib/Support/Windows/Signals.inc Mon Nov 30 20:35:04 2015
> @@ -405,10 +405,7 @@ static void RegisterHandler() {
> // If we cannot load up the APIs (which would be unexpected as they
> should
> // exist on every version of Windows we support), we will bail out since
> // there would be nothing to report.
> - if (!load64BitDebugHelp()) {
> - assert(false && "These APIs should always be available");
> - return;
> - }
> + assert(load64BitDebugHelp() && "These APIs should always be available");
>
> if (RegisteredUnhandledExceptionFilter) {
> EnterCriticalSection(&CriticalSection);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151130/d17dcf6c/attachment.html>
More information about the llvm-commits
mailing list