[PATCH] D119291: [Clang] Add support for STDC CX_LIMITED_RANGE pragma.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 06:39:58 PST 2022


aaron.ballman added reviewers: aaron.ballman, rjmccall, tahonermann, erichkeane.
aaron.ballman added a comment.

Adding some more reviewers for visibility.

Please address the clang-format issues; also, this seems to be missing all of the test I would expect to see in Preprocessor or Parser for checking that the proper diagnostics are emitted or CodeGen tests for more complicated situations, like:

  _Complex float range_scoped(_Complex float a, _Complex float b) {
  // CHECK-COMMON: @range_scoped
  // CHECK-COMMON: call{{.*}}complex.fmul{{.*}} #[[FULL]]
  // CHECK-COMMON: call{{.*}}complex.fdiv{{.*}} #[[FULL]]
  #pragma STDC CX_LIMITED_RANGE OFF
    _Complex float res = a * b;
    {
  #pragma STDC CX_LIMITED_RANGE DEFAULT
      res += a / b;
  #pragma STDC CX_LIMITED_RANGE OFF
      res += a / b;
    }
    return res;
  }

What should the behavior be if this pragma is at file scope instead of block scope (should that be diagnosed)?

(Also, this functionality should get a release note and potentially some public documentation?)



================
Comment at: clang/lib/Lex/Pragma.cpp:1028
     Diag(Tok, diag::ext_pragma_syntax_eod);
+    DiscardUntilEndOfDirective();
+  }
----------------
Good catch, but do we have a test case for this change?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119291/new/

https://reviews.llvm.org/D119291



More information about the cfe-commits mailing list