Update prebuilt Clang to r416183b from Android.

https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef

clang 12.0.5 (based on r416183b) from build 7284624.

Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/lib64/cmake/llvm/LLVM-Config.cmake b/linux-x64/clang/lib64/cmake/llvm/LLVM-Config.cmake
index be28ca4..5d9ec79 100644
--- a/linux-x64/clang/lib64/cmake/llvm/LLVM-Config.cmake
+++ b/linux-x64/clang/lib64/cmake/llvm/LLVM-Config.cmake
@@ -28,7 +28,9 @@
     string(TOUPPER "${LLVM_TARGETS_TO_BUILD}" targets)
   elseif(ARG_OMITTED_TARGETS)
     set(omitted_targets ${LLVM_ALL_TARGETS})
-    list(REMOVE_ITEM omitted_targets ${LLVM_TARGETS_TO_BUILD})
+    if (LLVM_TARGETS_TO_BUILD)
+      list(REMOVE_ITEM omitted_targets ${LLVM_TARGETS_TO_BUILD})
+    endif()
     string(TOUPPER "${omitted_targets}" targets)
   else()
     string(TOUPPER "${LLVM_ALL_TARGETS}" targets)
@@ -117,6 +119,95 @@
   set( ${OUT_VAR} ${result} ${sys_result} PARENT_SCOPE )
 endfunction(llvm_map_components_to_libraries)
 
+# Expand pseudo-components into real components.
+# Does not cover 'native', 'backend', or 'engine' as these require special
+# handling. Also does not cover 'all' as we only have a list of the libnames
+# available and not a list of the components.
+function(llvm_expand_pseudo_components out_components)
+  set( link_components ${ARGN} )
+  foreach(c ${link_components})
+    # add codegen, asmprinter, asmparser, disassembler
+    list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
+    if( NOT idx LESS 0 )
+      if( TARGET LLVM${c}CodeGen )
+        list(APPEND expanded_components "${c}CodeGen")
+      else()
+        if( TARGET LLVM${c} )
+          list(APPEND expanded_components "${c}")
+        else()
+          message(FATAL_ERROR "Target ${c} is not in the set of libraries.")
+        endif()
+      endif()
+      if( TARGET LLVM${c}AsmPrinter )
+        list(APPEND expanded_components "${c}AsmPrinter")
+      endif()
+      if( TARGET LLVM${c}AsmParser )
+        list(APPEND expanded_components "${c}AsmParser")
+      endif()
+      if( TARGET LLVM${c}Desc )
+        list(APPEND expanded_components "${c}Desc")
+      endif()
+      if( TARGET LLVM${c}Disassembler )
+        list(APPEND expanded_components "${c}Disassembler")
+      endif()
+      if( TARGET LLVM${c}Info )
+        list(APPEND expanded_components "${c}Info")
+      endif()
+      if( TARGET LLVM${c}Utils )
+        list(APPEND expanded_components "${c}Utils")
+      endif()
+    elseif( c STREQUAL "nativecodegen" )
+      if( TARGET LLVM${LLVM_NATIVE_ARCH}CodeGen )
+        list(APPEND expanded_components "${LLVM_NATIVE_ARCH}CodeGen")
+      endif()
+      if( TARGET LLVM${LLVM_NATIVE_ARCH}Desc )
+        list(APPEND expanded_components "${LLVM_NATIVE_ARCH}Desc")
+      endif()
+      if( TARGET LLVM${LLVM_NATIVE_ARCH}Info )
+        list(APPEND expanded_components "${LLVM_NATIVE_ARCH}Info")
+      endif()
+    elseif( c STREQUAL "AllTargetsCodeGens" )
+      # Link all the codegens from all the targets
+      foreach(t ${LLVM_TARGETS_TO_BUILD})
+        if( TARGET LLVM${t}CodeGen)
+          list(APPEND expanded_components "${t}CodeGen")
+        endif()
+      endforeach(t)
+    elseif( c STREQUAL "AllTargetsAsmParsers" )
+      # Link all the asm parsers from all the targets
+      foreach(t ${LLVM_TARGETS_TO_BUILD})
+        if( TARGET LLVM${t}AsmParser )
+          list(APPEND expanded_components "${t}AsmParser")
+        endif()
+      endforeach(t)
+    elseif( c STREQUAL "AllTargetsDescs" )
+      # Link all the descs from all the targets
+      foreach(t ${LLVM_TARGETS_TO_BUILD})
+        if( TARGET LLVM${t}Desc )
+          list(APPEND expanded_components "${t}Desc")
+        endif()
+      endforeach(t)
+    elseif( c STREQUAL "AllTargetsDisassemblers" )
+      # Link all the disassemblers from all the targets
+      foreach(t ${LLVM_TARGETS_TO_BUILD})
+        if( TARGET LLVM${t}Disassembler )
+          list(APPEND expanded_components "${t}Disassembler")
+        endif()
+      endforeach(t)
+    elseif( c STREQUAL "AllTargetsInfos" )
+      # Link all the infos from all the targets
+      foreach(t ${LLVM_TARGETS_TO_BUILD})
+        if( TARGET LLVM${t}Info )
+          list(APPEND expanded_components "${t}Info")
+        endif()
+      endforeach(t)
+    else()
+      list(APPEND expanded_components "${c}")
+    endif()
+  endforeach()
+  set(${out_components} ${expanded_components} PARENT_SCOPE)
+endfunction(llvm_expand_pseudo_components out_components)
+
 # This is a variant intended for the final user:
 # Map LINK_COMPONENTS to actual libnames.
 function(llvm_map_components_to_libnames out_libs)
@@ -162,96 +253,22 @@
   endif()
 
   # Translate symbolic component names to real libraries:
+  llvm_expand_pseudo_components(link_components ${link_components})
   foreach(c ${link_components})
-    # add codegen, asmprinter, asmparser, disassembler
-    list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
-    if( NOT idx LESS 0 )
-      if( TARGET LLVM${c}CodeGen )
-        list(APPEND expanded_components "LLVM${c}CodeGen")
-      else()
-        if( TARGET LLVM${c} )
-          list(APPEND expanded_components "LLVM${c}")
-        else()
-          message(FATAL_ERROR "Target ${c} is not in the set of libraries.")
-        endif()
-      endif()
-      if( TARGET LLVM${c}AsmParser )
-        list(APPEND expanded_components "LLVM${c}AsmParser")
-      endif()
-      if( TARGET LLVM${c}AsmPrinter )
-        list(APPEND expanded_components "LLVM${c}AsmPrinter")
-      endif()
-      if( TARGET LLVM${c}Desc )
-        list(APPEND expanded_components "LLVM${c}Desc")
-      endif()
-      if( TARGET LLVM${c}Disassembler )
-        list(APPEND expanded_components "LLVM${c}Disassembler")
-      endif()
-      if( TARGET LLVM${c}Info )
-        list(APPEND expanded_components "LLVM${c}Info")
-      endif()
-      if( TARGET LLVM${c}Utils )
-        list(APPEND expanded_components "LLVM${c}Utils")
-      endif()
-    elseif( c STREQUAL "native" )
+    get_property(c_rename GLOBAL PROPERTY LLVM_COMPONENT_NAME_${c})
+    if(c_rename)
+        set(c ${c_rename})
+    endif()
+    if( c STREQUAL "native" )
       # already processed
-    elseif( c STREQUAL "nativecodegen" )
-      list(APPEND expanded_components "LLVM${LLVM_NATIVE_ARCH}CodeGen")
-      if( TARGET LLVM${LLVM_NATIVE_ARCH}Desc )
-        list(APPEND expanded_components "LLVM${LLVM_NATIVE_ARCH}Desc")
-      endif()
-      if( TARGET LLVM${LLVM_NATIVE_ARCH}Info )
-        list(APPEND expanded_components "LLVM${LLVM_NATIVE_ARCH}Info")
-      endif()
     elseif( c STREQUAL "backend" )
       # same case as in `native'.
     elseif( c STREQUAL "engine" )
       # already processed
     elseif( c STREQUAL "all" )
-      list(APPEND expanded_components ${LLVM_AVAILABLE_LIBS})
-    elseif( c STREQUAL "AllTargetsCodeGens" )
-      # Link all the codegens from all the targets
-      foreach(t ${LLVM_TARGETS_TO_BUILD})
-        if( TARGET LLVM${t}CodeGen)
-          list(APPEND expanded_components "LLVM${t}CodeGen")
-        endif()
-      endforeach(t)
-    elseif( c STREQUAL "AllTargetsAsmPrinters" )
-      # Link all the asm printers from all the targets
-      foreach(t ${LLVM_TARGETS_TO_BUILD})
-        if( TARGET LLVM${t}AsmPrinter )
-          list(APPEND expanded_components "LLVM${t}AsmPrinter")
-        endif()
-      endforeach(t)
-    elseif( c STREQUAL "AllTargetsAsmParsers" )
-      # Link all the asm parsers from all the targets
-      foreach(t ${LLVM_TARGETS_TO_BUILD})
-        if( TARGET LLVM${t}AsmParser )
-          list(APPEND expanded_components "LLVM${t}AsmParser")
-        endif()
-      endforeach(t)
-    elseif( c STREQUAL "AllTargetsDescs" )
-      # Link all the descs from all the targets
-      foreach(t ${LLVM_TARGETS_TO_BUILD})
-        if( TARGET LLVM${t}Desc )
-          list(APPEND expanded_components "LLVM${t}Desc")
-        endif()
-      endforeach(t)
-    elseif( c STREQUAL "AllTargetsDisassemblers" )
-      # Link all the disassemblers from all the targets
-      foreach(t ${LLVM_TARGETS_TO_BUILD})
-        if( TARGET LLVM${t}Disassembler )
-          list(APPEND expanded_components "LLVM${t}Disassembler")
-        endif()
-      endforeach(t)
-    elseif( c STREQUAL "AllTargetsInfos" )
-      # Link all the infos from all the targets
-      foreach(t ${LLVM_TARGETS_TO_BUILD})
-        if( TARGET LLVM${t}Info )
-          list(APPEND expanded_components "LLVM${t}Info")
-        endif()
-      endforeach(t)
-    else( NOT idx LESS 0 )
+      get_property(all_components GLOBAL PROPERTY LLVM_COMPONENT_LIBS)
+      list(APPEND expanded_components ${all_components})
+    else()
       # Canonize the component name:
       string(TOUPPER "${c}" capitalized)
       list(FIND capitalized_libs LLVM${capitalized} lib_idx)
@@ -272,7 +289,7 @@
         list(GET LLVM_AVAILABLE_LIBS ${lib_idx} canonical_lib)
         list(APPEND expanded_components ${canonical_lib})
       endif( lib_idx LESS 0 )
-    endif( NOT idx LESS 0 )
+    endif( c STREQUAL "native" )
   endforeach(c)
 
   set(${out_libs} ${expanded_components} PARENT_SCOPE)
@@ -287,14 +304,26 @@
     list(APPEND visited_libs ${name})
     set(visited_libs ${visited_libs} PARENT_SCOPE)
 
-    get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name})
+    #
+    get_property(libname GLOBAL PROPERTY LLVM_COMPONENT_NAME_${name})
+    if(libname)
+      set(cname LLVM${libname})
+    elseif(TARGET ${name})
+      set(cname ${name})
+    elseif(TARGET LLVM${name})
+      set(cname LLVM${name})
+    else()
+      message(FATAL_ERROR "unknown component ${name}")
+    endif()
+
+    get_property(lib_deps TARGET ${cname} PROPERTY LLVM_LINK_COMPONENTS)
     foreach( lib_dep ${lib_deps} )
       expand_topologically(${lib_dep} "${required_libs}" "${visited_libs}")
       set(required_libs ${required_libs} PARENT_SCOPE)
       set(visited_libs ${visited_libs} PARENT_SCOPE)
     endforeach()
 
-    list(APPEND required_libs ${name})
+    list(APPEND required_libs ${cname})
     set(required_libs ${required_libs} PARENT_SCOPE)
   endif()
 endfunction()