[Lldb-commits] [lldb] 318454a - Inline my uuid_is_null() implementation in a header file

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 3 04:31:26 PDT 2022


On 02/08/2022 23:24, Jason Molenda via lldb-commits wrote:
> 
> Author: Jason Molenda
> Date: 2022-08-02T14:24:11-07:00
> New Revision: 318454a8e5fce57a92573f42e39f148adcedc5d4
> 
> URL: https://github.com/llvm/llvm-project/commit/318454a8e5fce57a92573f42e39f148adcedc5d4
> DIFF: https://github.com/llvm/llvm-project/commit/318454a8e5fce57a92573f42e39f148adcedc5d4.diff
> 
> LOG: Inline my uuid_is_null() implementation in a header file
> 
> This either needs to be static, or forced inline, or in a separate
> source file.

This is only true in plain C. In C++ a simple "inline" is enough, and 
will cause the compiler to emit the function whenever it is needed.

pl

>  Given that we only have one function in this
> UuidCompatibility.h, I think forced inline for the handful of uses
> of it may be best.
> 
> Added:
>      
> 
> Modified:
>      lldb/source/Utility/UuidCompatibility.h
> 
> Removed:
>      
> 
> 
> ################################################################################
> diff  --git a/lldb/source/Utility/UuidCompatibility.h b/lldb/source/Utility/UuidCompatibility.h
> index fe4aed00a351..40ebc1de24e4 100644
> --- a/lldb/source/Utility/UuidCompatibility.h
> +++ b/lldb/source/Utility/UuidCompatibility.h
> @@ -15,7 +15,7 @@
>   typedef unsigned char uuid_t[16];
>   
>   // Return 1 if uuid is null, that is, all zeroes.
> -int uuid_is_null(uuid_t uuid) {
> +inline __attribute__((always_inline)) int uuid_is_null(uuid_t uuid) {
>     for (int i = 0; i < 16; i++)
>       if (uuid[i])
>         return 0;
> 
> 
>          
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list