Skip to content

Commit

Permalink
Some patches for Figma
Browse files Browse the repository at this point in the history
* ignore some clang flags used by XCode (e.g. `--index-sort-path`)
* Disable `FPContract` which produces different floating-point results in
  macOS builds.
* Add missing include: "sanitizer_interface_internal.h"
* Use `isnan` instead of `std::isnan` because Apple Clang doesn't seem to
  compile properly otherwise.
  • Loading branch information
binji committed Jun 17, 2022
1 parent ce5588f commit d797af3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,14 @@ def : Joined<["-"], "objcmt-whitelist-dir-path=">, Flags<[CC1Option]>,
def : Joined<["-"], "objcmt-white-list-dir-path=">, Flags<[CC1Option]>,
Alias<objcmt_allowlist_dir_path>;

// FIGMA
def index_store_path : Separate<["-"], "index-store-path">, Flags<[CC1Option, NoArgumentUnused]>;
def index_ignore_system_symbols : Flag<["-"], "index-ignore-system-symbols">, Flags<[CC1Option, NoArgumentUnused]>;
def index_record_codegen_name : Flag<["-"], "index-record-codegen-name">, Flags<[CC1Option, NoArgumentUnused]>;
def index_unit_output_path : Separate<["-"], "index-unit-output-path">, MetaVarName<"<path>">, Flags<[CC1Option, NoArgumentUnused]>;
def index_ignore_macros : Flag<["-"], "index-ignore-macros">, Flags<[CC1Option, NoArgumentUnused]>;
// FIGMA

// Make sure all other -ccc- options are rejected.
def ccc_ : Joined<["-"], "ccc-">, Group<internal_Group>, Flags<[Unsupported]>;

Expand Down
1 change: 1 addition & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2732,6 +2732,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
if (!JA.isDeviceOffloading(Action::OFK_Cuda) &&
!JA.isOffloading(Action::OFK_HIP))
FPContract = "on";
/* FIGMA */ FPContract = "off";
bool StrictFPModel = false;

if (const Arg *A = Args.getLastArg(options::OPT_flimited_precision_EQ)) {
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "sanitizer_common.h"
#include "sanitizer_file.h"
#include "sanitizer_flags.h"
#include "sanitizer_interface_internal.h"
#include "sanitizer_internal_defs.h"
#include "sanitizer_libc.h"
#include "sanitizer_platform_limits_posix.h"
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Core/DumpDataExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ void DumpFloatingPoint(std::ostringstream &ss, FloatT f) {
// NaN and Inf are potentially implementation defined and on Darwin it
// seems NaNs are printed without their sign. Manually implement dumping them
// here to avoid having to deal with platform differences.
if (std::isnan(f)) {
if (std::signbit(f))
if (isnan(f)) { // FIGMA
if (signbit(f)) // FIGMA
ss << '-';
ss << "nan";
return;
}
if (std::isinf(f)) {
if (std::signbit(f))
if (isinf(f)) { // FIGMA
if (signbit(f)) // FIGMA
ss << '-';
ss << "inf";
return;
Expand Down

0 comments on commit d797af3

Please sign in to comment.