[flang-commits] [flang] [flang] Pass to add frame pointer attribute (PR #74598)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Mon Dec 11 03:24:34 PST 2023
================
@@ -248,13 +248,21 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
if (const llvm::opt::Arg *a =
args.getLastArg(clang::driver::options::OPT_mframe_pointer_EQ)) {
llvm::StringRef s = a->getValue();
- assert(s == "none" || s == "non-leaf" || s == "all");
- if (s == "none")
+
+ if (!(s=="none" || s=="no-leaf" || s=="all")) {
+ const auto debugWarningId = diags.getCustomDiagID(
+ clang::DiagnosticsEngine::Warning, "Frame pointer: %0");
+ diags.Report(debugWarningId).AddString(a->getValue());
+ }
+
+ if (s == "none") {
opts.setFramePointer(llvm::FramePointerKind::None);
- else if (s == "non-leaf")
- opts.setFramePointer(llvm::FramePointerKind::NonLeaf);
- else
- opts.setFramePointer(llvm::FramePointerKind::All);
+ } else {
+ if (s == "non-leaf")
+ opts.setFramePointer(llvm::FramePointerKind::NonLeaf);
+ else
+ opts.setFramePointer(llvm::FramePointerKind::All);
----------------
kiranchandramohan wrote:
I agree with @tblah that they should all be at the same indentation. The old formattting (copied below) made it look like there are two levels of indentation and hence my comment.
```
if (s == "none")
opts.setFramePointer(llvm::FramePointerKind::None);
else
if (s == "non-leaf")
opts.setFramePointer(llvm::FramePointerKind::NonLeaf);
else
opts.setFramePointer(llvm::FramePointerKind::All);
```
https://github.com/llvm/llvm-project/pull/74598
More information about the flang-commits
mailing list