[llvm-commits] [llvm] r149832 - /llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp

David Blaikie dblaikie at gmail.com
Sun Feb 5 09:46:12 PST 2012


On Sun, Feb 5, 2012 at 6:14 AM, Duncan Sands <baldrick at free.fr> wrote:
> Author: baldrick
> Date: Sun Feb  5 08:14:35 2012
> New Revision: 149832
>
> URL: http://llvm.org/viewvc/llvm-project?rev=149832&view=rev
> Log:
> Explain to the compiler why TargetAddr is not used uninitialized later.
...
>   } else {
>     // FIXME: Get the address of the target section and add that to RE.Offset
> -    assert(0 && ("Non-function relocation not implemented yet!"));
> +    llvm_unreachable("Non-function relocation not implemented yet!");
>   }

Does this satisfy GCC as well as Clang? (I assume you probably build
with DragonEgg so you know that it does - I'm just curious)

Takumi - do you know if this sort of solution satisfies MSVC? I
thought at least some (non-Clang) compilers only did the most
rudimentary path analysis without any noreturn/condition checking & so
would only be OK with this code if it initialized in both paths.

In any case - might this be better expressed with a single assert at
the start of the function (still with the comment that the negative
case should be handled at some point) rather than a conditional with
an unreachable inside?

I suppose that way you lose the documentation that this block is where
the distinction is important... but just a thought.
- David




More information about the llvm-commits mailing list