aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
Commit message (Collapse)AuthorAge
* Don't add -g0 as host copt when host platform is WindowsGravatar pcloudy2017-05-31
| | | | | RELNOTES: None PiperOrigin-RevId: 157578255
* BuildOptions cleanup:Gravatar gregce2017-05-04
| | | | | | | | | | | | | | | | | | | | | 1) Remove obsolete originalOptions field. This was originally added to support "parent" transitions, which supported config1 -> config2 -> config1 transitions by having config2 store config1's options. The purpose of this feature was to support LIPO (which has a DATA -> TARGET transition). But https://github.com/bazelbuild/bazel/commit/ff29c0b39cf936a2699b05edd54f483f1a037d93 makes this unnecessary. 2) Support the "disable actions" feature of the LIPO context collector configuration. Putting this in BuildOptions make this dynamic config-compatible. This change intentionally doesn't add disableOptions to BuildOptions.equals() or BuildOptions.hashCode(). It'd be great to do that. But that has semantic consequences. And we've run into really tricky bugs in the past with dynamic configurations and BuildOptions.equals / BuildConfiguration.equals. So it's best to experiment with that in its own change. PiperOrigin-RevId: 154999718
* Clarify the meaning of the two symbol counts that Gold outputs forGravatar Googler2017-05-03
| | | | | | --print-symbol-counts. PiperOrigin-RevId: 154843561
* Convert LLVM raw profiles to indexed format if necessary.Gravatar Googler2017-04-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Here is what is done today: bazel build -c opt --fdo_optimize=<path_to_profdata_file> //target The .profdata file is the LLVM profiles in indexed format and bazel creates a symlink to it from bazel-fdo/_fdo/... and compiles the target. However, the instrumented binary generates a .profraw file and hence the conversion to .profdata must be done manually using the llvm-profdata binary which is shipped along with the crosstool as: $ llvm-profdata -merge -o <path_to_profdata_file> <path_profraw_file> We are trying to avoid this intermediate step in this change by baking this into bazel. This implementation does the following: * In CppConfiguration.java, adds new tool llvm-profdata. * In CcToolchain.java, in function create, if LLVM instrumented FDO is desired, the profile format is checked and the profile conversion takes place. * FdoSupport.java checks for LLVM instrumented FDO is bypassed. RELNOTES[NEW]: Raw LLVM profiles are now supported. PiperOrigin-RevId: 154569896
* Deprecate use of option category to describe documentation level / usage ↵Gravatar ccalvarin2017-04-19
| | | | | | | | restrictions. Prevent the old category strings "undocumented," "hidden," or "internal" from being used as categories, to prevent developers from relying on deprecated behavior. PiperOrigin-RevId: 153525499
* Change Bazel's LIPO model to support dynamic configurations.Gravatar gregce2017-04-19
| | | | | | | | | | The key change is to eliminate the need to transition from the data to the target configuration by relying on out-of-band configuration state. Specifically, the old model drops LIPO options from the data configuration. In the cases when we have to switch back (i.e. TARGET_CONFIG_FOR_LIPO), those options have to get re-injected somehow. Static configurations achieve this with the global configuration transitions table. But dynamic configs have no comparable source (and they consciously eschew global state). This cl changes the model to *keep* LIPO settings in the data config, then use a new "enableOrDisable" flag to determine whether or not to actually use them. With this model, the data -> target transition is now as simple as toggling that flag. This change doesn't actually add dynamic config LIPO support. It's doing enough as it is, and we need to make sure it doesn't break existing LIPO semantics. Dynamic support will come as a followup. PiperOrigin-RevId: 153504240
* Split out option usage restriction from option category.Gravatar ccalvarin2017-04-18
| | | | | | | | | These are two different concepts. Do not remove category overload compatibility in this CL, to keep this change limited to converting the current uses of category. With some flyby formatting fixes on affected OptionsBases. RELNOTES: None. PiperOrigin-RevId: 153390002
* RELNOTES[NEW]: If grte_top is a label, it can now follow non-configurable ↵Gravatar Googler2017-03-21
| | | | | | | | redirects. -- PiperOrigin-RevId: 150647389 MOS_MIGRATED_REVID=150647389
* Create "internal" category of command-line options.Gravatar Michael Staib2017-03-20
| | | | | | | | | | | | | | | | | | | | This is intended to be used for "flags" which should never appear on the command line - things like configuration distinguishers, which are used internally and must be part of the build options, but should always be set to their default value at the top level. This is already a convention within Bazel, but doesn't actually work the way Bazel expects - flags with spaces can be set by simply escaping or quoting the spaces so that word splitting will not break on them. This means they can also be matched by config_settings, which pass a single string. Forbidding the parser from matching these flags solves both of these unintended cases. Existing cases like this have also been converted to internal. -- PiperOrigin-RevId: 150497246 MOS_MIGRATED_REVID=150497246
* Simplify Attribute.Configurator, add dynamic configs support.Gravatar Greg Estren2017-03-14
| | | | | | | | | | | | | | Specifically: 1) Read BuildOptions instead of BuildConfiguration 2) Remove unused extra parameters 1) is especially useful for dynamic configs. Before this change, dynamic configs just didn't support attribute configurators. This is because support would require Skyframe-instantiating temporary intermediate configurations, which is horribly awkward and would massively complicate Bazel's dependency evaluation logic. Using BuildOptions instead of BuildConfiguration completely eliminates the problem. As a bonus, dynamic configs can compose attribute configurators with any other transitions (including splits). This actually makes them more powerful than static configs. Whether anyone wants to use that composition is a different story, but that's now a policy decision vs. a technical limitation. This should also come in handy for RuleClass configurators, which will likely also leverage this. -- PiperOrigin-RevId: 150080977 MOS_MIGRATED_REVID=150080977
* Add host_cxxopt in parallel to host_copt. Gravatar Marcel Hlopko2017-02-24
| | | | | | | | | | Closes #2543. -- Change-Id: I0cd7566fc9ae91f3c1374eca61500a64b3cc8079 Reviewed-on: https://github.com/bazelbuild/bazel/pull/2543 PiperOrigin-RevId: 148449853 MOS_MIGRATED_REVID=148449853
* Remove DynamicModeFlag and thus fix crash caused by passing ↵Gravatar Lukacs Berki2017-02-17
| | | | | | | | --dynamic_mode=auto on the command line. -- PiperOrigin-RevId: 147824992 MOS_MIGRATED_REVID=147824992
* Add a flag that alters the behavior of the parse_headers feature. With theGravatar Googler2017-01-27
| | | | | | | | | | | | | flag, the headers of a target are compiled into a C++ module instead of being parsed as their own translation unit. The module otherwise remains unused. This way, parse_headers can be used to get a codebase ready for C++ modules. parse_headers currently already gets close, but there are still ways in which a header can be modules-incompatible although it parses fine. -- PiperOrigin-RevId: 145729231 MOS_MIGRATED_REVID=145729231
* Fix bug in --experimental_link_dynamic_binaries_separately.Gravatar Googler2017-01-11
| | | | | | | | | | | | | | | If linkstatic was explicitly set to 0 for a non-test target, we didn't set CcLibraryHelper to create CcLinkOutputs, but would still try to link those in instead of the compile output. Instead, pull out a variable that puts this logic into a single spot. Also rename the flag to --experimental_link_compile_output_separately, which IMO makes slightly more sense. Not too important as I don't think we should keep this flag long-term anyway. -- PiperOrigin-RevId: 144194903 MOS_MIGRATED_REVID=144194903
* Add option to dynamically link in the compilation output of cc_test andGravatar Googler2016-12-16
| | | | | | | | | | | | | | | | | | | cc_binary if we are doing dynamic linking anyway. The additional option is only for a smooth rollout and will go away once everything works as expected. The benefit is in an incremental save-build-test-cycle. When editing a test (or any of it's transitive headers), the linker input currently changes, meaning we need to do the full link again before the test can run. However, in conjunction with the option --interface_shared_objects, this actually isn't necessary. With this new option, the test source gets compiled into a .so file and while that file changes with each source change, the .ifso file often does not change. Thus, the costly link linking to gether all the .so and .ifso files can be retrieved from cache. Thus, this change should remove this linking step from the critical path of many save-build-test-cycles. -- PiperOrigin-RevId: 142244352 MOS_MIGRATED_REVID=142244352
* Add option to disable dynamic configs with LIPO.Gravatar Greg Estren2016-12-02
| | | | | | | | | | | | New option --experimental_dynamic_configs=notrim_partial automatically switches to --experimental_dynamic_configs=off if any BuildOptions fragment sets useStaticConfigurationsOverride(). CppOptions implements this override for FDO/LIPO. -- PiperOrigin-RevId: 140864317 MOS_MIGRATED_REVID=140864317
* Prune modules when building modules themselves to reduce build times shortenGravatar Googler2016-12-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | critical paths. When the inputs of a module M are reduced to a set S, then that same set S also needs to be supplied to compile something that uses M. To do this, input discovery is divided into two stages. For each CppCompileAction, the first stage discovers the necessary modules (M above). These are then added as inputs to ensure that they are built. The second stage then finds all the modules (S above) that are required to use those and also adds them as inputs. For now, the new behavior is guarded by a new flag --experimental_prune_more_modules. This is currently implemented by reading the .d files of used modules add adding all their module dependencies. There are two noteworthy alternatives: 1. Hack up input discovery to understand modules, e.g. if a modular header is hit, continue scanning from all it's headers. However, this seems very brittle and a lot of additional information would have to be passed to the input discovery. 2. Directly pass the results from input discovery of one CppCompileAction to another one. However, this seems to tightly couple the execution of different CppCompileActions and might lead to a mess of different states, more memory consumption, etc. With the current implementation, there is a bit of runtime overhead of reading the .d files (many times). This could potentially be improved by caching the results. However, even without this caching, the runtime overhead is limited (<10%) for all builds I have tried (I have tried with builds where all the compile results are already in the executor's cache. -- MOS_MIGRATED_REVID=140793217
* Add --ltoindexopt to pass options to LTO indexing stepGravatar Googler2016-12-02
| | | | | | | This makes it much easier to pass options just to the LTO indexing. Previously these had to be passed via --linkopt, but that also passed the options to the final native link, which causes issues since most useful ThinLTO indexing options are plugin options and gold gives an error when these are passed to native links not involving a plugin. -- MOS_MIGRATED_REVID=140735846
* Add experimental flag to stop requiring all transitive modules as inputs.Gravatar Googler2016-10-31
| | | | | | | | | Requiring all transitive modules to always be available can lead to long critical paths and even unnecessary compiles in combination with the prune_header_modules feature. -- MOS_MIGRATED_REVID=137696794
* Add a flag to lock down isystem include checks.Gravatar Ulf Adams2016-10-25
| | | | | | | | | | | | | | | | | If this flag is disabled, Bazel continues to behave as previously - includes reached through isystem paths are completely ignored, i.e., they don't have to be declared in any rule. This applies primarily to cc_library.includes. When the flag is enabled, Bazel gives an error for any such header file that isn't declared in srcs or hdrs of a dependent rule. Goes towards fixing #1162. RELNOTES[NEW]: Use --strict_system_includes to apply hdrs_check=strict also to cc_library.includes, even if sandboxing is disabled. -- MOS_MIGRATED_REVID=137125638
* Remove support for thin archives.Gravatar Lukacs Berki2016-08-23
| | | | | -- MOS_MIGRATED_REVID=130938527
* Move the --define command line option from CppConfiguration to ↵Gravatar Lukacs Berki2016-08-02
| | | | | | | | | | | BuildConfiguration. It makes much more sense there because it does *not* specify C++ #defines but BUILD variables. Also rename the getter method to make that clearer. This allows us to remove BuildConfiguration.Fragment#getCommandLineDefines(). -- MOS_MIGRATED_REVID=129080014
* --Gravatar Googler2016-08-01
| | | | MOS_MIGRATED_REVID=128827694
* Allow a config_setting() to match against the default grte_top.Gravatar Googler2016-06-14
| | | | | -- MOS_MIGRATED_REVID=124792198
* Remove the --use_isystem_for_includes option.Gravatar Lukacs Berki2016-05-31
| | | | | | | RELNOTES: The --ues_isystem_for_includes command line option is not supported anymore. -- MOS_MIGRATED_REVID=123617061
* Remove the --cwarn command line option.Gravatar Lukacs Berki2016-05-25
| | | | | | | RELNOTES[INC]: The --cwarn command line option is not supported anymore. Use --copt instead. -- MOS_MIGRATED_REVID=123101536
* Remove option to include transitive header module srcs in the compilation.Gravatar Googler2016-04-18
| | | | | -- MOS_MIGRATED_REVID=120115843
* Set --crosstool_top=@bazel_tools//tools/cpp:toolchain by default.Gravatar Luis Fernando Pino Duque2016-04-13
| | | | | -- MOS_MIGRATED_REVID=119653212
* Optionally stop adding headers from transitive modules as mandatory ↵Gravatar Googler2016-03-31
| | | | | | | | | | compilation inputs. As of r264664, Clang doesn't require files in module maps to be present anymore if the sources are instead available in the corresponding .pcm files. -- MOS_MIGRATED_REVID=118670841
* Enable the configuration sanity check for a subset of tests.Gravatar Ulf Adams2016-03-31
| | | | | | | | | | | Also remove a try-catch block, which was converting all configuration creation errors to IllegalStateException. This uncovered a bug in CppOptions, which wasn't adding host_grte_top to the set of explicit labels. -- MOS_MIGRATED_REVID=118654358
* Reformat CppOptions.javaGravatar Cal Peyser2016-02-22
| | | | | -- MOS_MIGRATED_REVID=115214428
* Allow switching on header processing (parse_headers or preprocess_headers)Gravatar Manuel Klimek2016-02-04
| | | | | | | | | | | for targets in the transitive closure of a target that is built. Rollback of commit e01291a1a3d65cd706190c9bf0c8cfc585f38eb7. Added an additional test to check that the configuration value is actually effectively used. -- MOS_MIGRATED_REVID=113836105
* Include .dwp file in the runfiles for cc_test when building with Fission.Gravatar Googler2016-02-03
| | | | | -- MOS_MIGRATED_REVID=113660258
* Rollback of commit 4fdd66db55d36c923b1e9fa30a158e1596408670.Gravatar Michajlo Matijkiw2016-02-02
| | | | | | | | | *** Reason for rollback *** The change this relies on is to be rolled back. -- MOS_MIGRATED_REVID=113564031
* Rollback of commit e379f28f464faacc4db21f4fed3a48fa6d4d23f0.Gravatar Googler2016-01-29
| | | | | | | | | | | | | *** Reason for rollback *** The new test apparently breaks some targets. Rolling back to fix the build. *** Original change description *** Include .dwp file in the runfiles for cc_test when building with Fission. -- MOS_MIGRATED_REVID=113310353
* Include .dwp file in the runfiles for cc_test when building with Fission.Gravatar Googler2016-01-29
| | | | | -- MOS_MIGRATED_REVID=113295790
* Allow switching on header processing (parse_headers or preprocess_headers)Gravatar Manuel Klimek2016-01-22
| | | | | | | | | | | | | | | | | for targets in the transitive closure of a target that is built. Previously, this would only happen if a link action for the library containing the headers was also built; this specifically means it did not trigger if a library didn't contain source files, as there is no link action for such libraries. That led to no header-only libraries would get their headers parsed, which includes all cc_public_library rules. Adding a flag to introduce this under so we can switch it on independently from the blaze release. Once it is switched on, we can remove the edges in the action graph from the link actions to the header processing actions. -- MOS_MIGRATED_REVID=112782219
* Libc top for the host should take its value only from --host_grte_top or the ↵Gravatar Googler2016-01-15
| | | | | | | | | host crosstool. RELNOTES[NEW]: --grte_top no longer also sets --host_grte_top in the absence of the latter -- MOS_MIGRATED_REVID=112258796
* Remove Constants.ALLOW_CC_INCLUDE_SCANNING and handle the logic in ↵Gravatar Philipp Wollermann2016-01-07
| | | | | | | CppSemantics instead. -- MOS_MIGRATED_REVID=111406721
* Force hdrs_check to "strict", remove "hdrs_check" attribute from cc_* rules.Gravatar Philipp Wollermann2015-10-27
| | | | | | | RELNOTES: Bazel does strict validation of include files now to ensure correct incremental builds. If you see compilation errors when building C++ code, please make sure that you explicitly declare all header files in the srcs or hdrs attribute of your cc_* targets and that your cc_* targets have correct "deps" on cc_library's that they use. -- MOS_MIGRATED_REVID=106410969
* Add a custom converter to --crosstool_top so that select() works.Gravatar Lukacs Berki2015-10-08
| | | | | -- MOS_MIGRATED_REVID=104845397
* Add a Constants.TOOLS_PREFIX constant that will serve to redirect the Bazel ↵Gravatar Lukacs Berki2015-10-05
| | | | | | | | | | | tools repository. This is a no-op refactoring CL. The actual switch will be made once everything passes with the new setup. As a side cleanup, change the awkward realAndroidSdk() / realAndroidCrosstoolTop() mechanism to a converter. -- MOS_MIGRATED_REVID=104649067
* Rationalize copyright headersGravatar Damien Martin-Guillerez2015-09-25
| | | | | | | | | | | The headers were modified with `find . -type f -exec 'sed' '-Ei' 's|Copyright 201([45]) Google|Copyright 201\1 The Bazel Authors|' '{}' ';'` And manual edit for not Google owned copyright. Because of the nature of ijar, I did not modified the header of file owned by Alan Donovan. The list of authors were extracted from the git log. It is missing older Google contributors that can be added on-demand. -- MOS_MIGRATED_REVID=103938715
* Move Label from the lib.syntax to the lib.cmdline package so that:Gravatar Lukacs Berki2015-09-21
| | | | | | | | | | - Label parsing can be simplified - lib.syntax is only contains the code for Skylark and is reasonably independent from the problem domain of building things This change is mostly only changes to imports declarations. The rest is reversing the dependency between :cmdline and :syntax and moving a tiny amount of code between Printer and FilesetEntry and the addition of SkylarkPrintableValue that I couldn't be bothered to separate out into its own change. -- MOS_MIGRATED_REVID=103527877
* Parse the label syntax "@//a:b" so that eventually we can make that the ↵Gravatar Lukacs Berki2015-09-15
| | | | | | | | | syntax that means "refer to the main repository". There isn't an overarching plan for what we are going to do with the cmdline package, which seems to be separated from the .syntax one in all sorts of awkward ways. -- MOS_MIGRATED_REVID=103088960
* Rollforward of []: Blaze changes to support LLVM profile feedbackGravatar Googler2015-07-23
| | | | | | | Rollback of commit b961bb931400044ed91e6b0b596f94fe983f9f17. -- MOS_MIGRATED_REVID=98833728
* Rollback of commit 69d20b26b50360221849a4860265150f9c66ef25.Gravatar Lukacs Berki2015-07-17
| | | | | | | | | | | | | *** Reason for rollback *** Breaks LIPO, [] *** Original change description *** Blaze changes to support LLVM profile feedback. -- MOS_MIGRATED_REVID=98382087
* Blaze changes to support LLVM profile feedback.Gravatar Googler2015-07-07
| | | | | -- MOS_MIGRATED_REVID=97610963
* Create a value class PatternWithEquality to wrap Pattern so that equal ↵Gravatar Janak Ramakrishnan2015-06-16
| | | | | | | strings can compare equal as Patterns. -- MOS_MIGRATED_REVID=96041927
* Use the crosstool feature configuration for all modules, layering and headerGravatar Manuel Klimek2015-02-22
| | | | | | | processing related flags. -- MOS_MIGRATED_REVID=86898123