24
24
"should_create_per_object_debug_info" ,
25
25
)
26
26
load (":common/cc/compile/cc_compilation_helper.bzl" , "cc_compilation_helper" )
27
- load (":common/cc/compile/compile_build_variables.bzl" , "get_specific_compile_build_variables" )
28
- load (":common/cc/semantics.bzl" , _starlark_cc_semantics = "semantics" )
29
27
load (":common/paths.bzl" , "paths" )
30
28
31
29
cc_common_internal = _builtins .internal .cc_common
@@ -728,38 +726,8 @@ def _create_cc_compile_actions(
728
726
_basename_without_extension (source_artifact ) in compiled_basenames ):
729
727
continue
730
728
731
- output_name_base = cc_internal .get_artifact_name_for_category (
732
- cc_toolchain = cc_toolchain ,
733
- category = artifact_category .GENERATED_HEADER ,
734
- output_name = output_name_map [source_artifact ],
735
- )
736
- output_file = _get_compile_output_file (
737
- action_construction_context ,
738
- label ,
739
- output_name = cc_internal .get_artifact_name_for_category (
740
- cc_toolchain = cc_toolchain ,
741
- category = artifact_category .PROCESSED_HEADER ,
742
- output_name = output_name_base ,
743
- ),
744
- )
745
- dotd_file = _get_compile_output_file (
746
- action_construction_context ,
747
- label ,
748
- output_name = cc_internal .get_artifact_name_for_category (
749
- cc_toolchain = cc_toolchain ,
750
- category = artifact_category .INCLUDED_FILE_LIST ,
751
- output_name = output_name_base ,
752
- ),
753
- ) if _dotd_files_enabled (language , cpp_configuration , feature_configuration ) else None
754
- diagnostics_file = _get_compile_output_file (
755
- action_construction_context ,
756
- label ,
757
- output_name = cc_internal .get_artifact_name_for_category (
758
- cc_toolchain = cc_toolchain ,
759
- category = artifact_category .SERIALIZED_DIAGNOSTICS_FILE ,
760
- output_name = output_name_base ,
761
- ),
762
- ) if _serialized_diagnostics_file_enabled (feature_configuration ) else None
729
+ output_name = output_name_map [source_artifact ]
730
+
763
731
cpp_compile_action_builder = cc_internal .create_cpp_compile_action_builder_with_inputs (
764
732
action_construction_context = action_construction_context ,
765
733
cc_compilation_context = cc_compilation_context ,
@@ -771,38 +739,30 @@ def _create_cc_compile_actions(
771
739
source_artifact = source_artifact ,
772
740
additional_compilation_inputs = additional_compilation_inputs ,
773
741
additional_include_scanning_roots = additional_include_scanning_roots ,
774
- output_file = output_file ,
775
- dotd_file = dotd_file ,
776
- diagnostics_file = diagnostics_file ,
777
742
)
778
- specific_compile_build_variables = get_specific_compile_build_variables (
779
- feature_configuration ,
780
- use_pic = generate_pic_action ,
781
- source_file = source_artifact ,
782
- output_file = output_file ,
783
- dotd_file = dotd_file ,
784
- diagnostics_file = diagnostics_file ,
785
- cpp_module_map = cc_compilation_context .module_map (),
786
- direct_module_maps = cc_compilation_context .direct_module_maps ,
787
- user_compile_flags = _get_copts (
788
- language = language ,
789
- cpp_configuration = cpp_configuration ,
790
- source_file = source_artifact ,
791
- conlyopts = conlyopts ,
792
- copts = copts ,
793
- cxxopts = cxxopts ,
794
- label = cpp_source .label ,
795
- ),
743
+ output_name_base = cc_internal .get_artifact_name_for_category (
744
+ cc_toolchain = cc_toolchain ,
745
+ category = artifact_category .GENERATED_HEADER ,
746
+ output_name = output_name ,
796
747
)
797
748
header_token_file = cc_internal .create_parse_header_action (
798
749
action_construction_context = action_construction_context ,
750
+ cc_compilation_context = cc_compilation_context ,
751
+ cc_toolchain = cc_toolchain ,
799
752
configuration = configuration ,
753
+ conlyopts = conlyopts ,
754
+ copts = copts ,
755
+ cpp_configuration = cpp_configuration ,
756
+ cxxopts = cxxopts ,
757
+ fdo_context = fdo_context ,
758
+ auxiliary_fdo_inputs = auxiliary_fdo_inputs ,
800
759
feature_configuration = feature_configuration ,
801
760
use_pic = generate_pic_action ,
802
761
label = label ,
803
762
common_compile_build_variables = common_compile_build_variables ,
804
- specific_compile_build_variables = specific_compile_build_variables ,
763
+ fdo_build_variables = fdo_build_variables ,
805
764
cpp_semantics = cpp_semantics ,
765
+ source_label = cpp_source .label ,
806
766
output_name_base = output_name_base ,
807
767
cpp_compile_action_builder = cpp_compile_action_builder ,
808
768
)
@@ -861,63 +821,6 @@ def _create_module_action(
861
821
bitcode_output = False ,
862
822
)
863
823
864
- def _get_compile_output_file (ctx , label , * , output_name ):
865
- return ctx .actions .declare_file (paths .join ("_objs" , label .name , output_name ))
866
-
867
- def _dotd_files_enabled (language , cpp_configuration , feature_configuration ):
868
- enabled_in_config = (
869
- _starlark_cc_semantics .dotd_files_enabled (cpp_configuration ) if language == "cpp" else cpp_configuration .objc_should_generate_dotd_files ()
870
- )
871
- return (
872
- enabled_in_config and
873
- not feature_configuration .is_enabled ("parse_showincludes" ) and
874
- not feature_configuration .is_enabled ("no_dotd_file" )
875
- )
876
-
877
- def _serialized_diagnostics_file_enabled (feature_configuration ):
878
- return feature_configuration .is_enabled ("serialized_diagnostics_file" )
879
-
880
- _SOURCE_TYPES_FOR_CXXOPTS = set (
881
- extensions .CC_SOURCE +
882
- extensions .CC_HEADER +
883
- [".cppmap" ] + # cpp module map
884
- [".pcm" , ".gcm" , ".ifc" ] + # clif input proto
885
- [".mm" ], # objc source
886
- )
887
-
888
- def _get_copts (
889
- language ,
890
- cpp_configuration ,
891
- source_file ,
892
- conlyopts ,
893
- copts ,
894
- cxxopts ,
895
- label ):
896
- extension = "." + source_file .extension if source_file .extension else ""
897
- result = []
898
- result .extend (_copts_from_options (language , cpp_configuration , extension ))
899
- result .extend (copts )
900
- if extension in extensions .C_SOURCE :
901
- result .extend (conlyopts )
902
- if extension in _SOURCE_TYPES_FOR_CXXOPTS :
903
- result .extend (cxxopts )
904
- if label :
905
- result .extend (cc_internal .per_file_copts (cpp_configuration , source_file , label ))
906
- return result
907
-
908
- def _copts_from_options (language , cpp_configuration , extension ):
909
- result = []
910
- result .extend (cpp_configuration .copts )
911
- if extension in extensions .C_SOURCE :
912
- result .extend (cpp_configuration .conlyopts )
913
- if extension in _SOURCE_TYPES_FOR_CXXOPTS :
914
- result .extend (cpp_configuration .cxxopts )
915
- if extension in [".m" , ".mm" ] or (
916
- language == "objc" and extension in extensions .CC_HEADER
917
- ):
918
- result .extend (cpp_configuration .objccopts )
919
- return result
920
-
921
824
def _calculate_output_name_map_by_type (sources , prefix_dir ):
922
825
return (
923
826
_calculate_output_name_map (
0 commit comments