Skip to content
Snippets Groups Projects
  • Alex Lorenz's avatar
    d0aceebb
    [Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like · d0aceebb
    Alex Lorenz authored
    builtin macros
    
    This patch implements the __is_target_arch, __is_target_vendor, __is_target_os,
    and __is_target_environment Clang preprocessor extensions that were proposed by
    @compnerd in Bob's cfe-dev post:
    http://lists.llvm.org/pipermail/cfe-dev/2017-November/056166.html.
    
    These macros can be used to examine the components of the target triple at
    compile time. A has_builtin(is_target_???) preprocessor check can be used to
    check for their availability.
    
    __is_target_arch allows you to check if an arch is specified without worring
    about a specific subarch, e.g.
    
    __is_target_arch(arm) returns 1 for the target arch "armv7"
    __is_target_arch(armv7) returns 1 for the target arch "armv7"
    __is_target_arch(armv6) returns 0 for the target arch "armv7"
    
    __is_target_vendor and __is_target_environment match the specific vendor
    or environment. __is_target_os matches the specific OS, but
    __is_target_os(darwin) will match any Darwin-based OS. "Unknown" can be used
    to test if the triple's component is specified.
    
    rdar://35753116
    
    Differential Revision: https://reviews.llvm.org/D41087
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320734 91177308-0d34-0410-b5e6-96231b3b80d8
    d0aceebb
    History
    [Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like
    Alex Lorenz authored
    builtin macros
    
    This patch implements the __is_target_arch, __is_target_vendor, __is_target_os,
    and __is_target_environment Clang preprocessor extensions that were proposed by
    @compnerd in Bob's cfe-dev post:
    http://lists.llvm.org/pipermail/cfe-dev/2017-November/056166.html.
    
    These macros can be used to examine the components of the target triple at
    compile time. A has_builtin(is_target_???) preprocessor check can be used to
    check for their availability.
    
    __is_target_arch allows you to check if an arch is specified without worring
    about a specific subarch, e.g.
    
    __is_target_arch(arm) returns 1 for the target arch "armv7"
    __is_target_arch(armv7) returns 1 for the target arch "armv7"
    __is_target_arch(armv6) returns 0 for the target arch "armv7"
    
    __is_target_vendor and __is_target_environment match the specific vendor
    or environment. __is_target_os matches the specific OS, but
    __is_target_os(darwin) will match any Darwin-based OS. "Unknown" can be used
    to test if the triple's component is specified.
    
    rdar://35753116
    
    Differential Revision: https://reviews.llvm.org/D41087
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320734 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.