[PATCH] D97371: [clang][parser] Remove questionable ProhibitAttributes() call in objc parsing

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 18 01:46:39 PDT 2021


tbaeder added a comment.

Thank you.

I'm not looking at this test case:

  void opaque(void);
  void opaque2(void);
  void opaque3(void);
  
  @class C;
  
  int main(int argc, const char * argv[]) {
    __attribute__((nomerge)) @try {
      opaque();
    } @catch(C *c) {
      opaque2();
    } @finally {
      opaque3();
    }
      return 0;
  }

and compiling with `-S -emit-llvm`

shows:

  %0 = type opaque
  
  ; Function Attrs: noinline nounwind optnone uwtable
  define dso_local i32 @main(i32 %argc, i8** %argv) #0 {
  entry:
    ; ...
    call void @opaque() #2
    ; ...
  
  cleanup:                                          ; preds = %entry, %catch
    %cleanup.dest.saved = load i32, i32* %cleanup.dest.slot, align 4
    call void @opaque3() #2
    %finally.shouldthrow = load i1, i1* %finally.for-eh, align 1
    br i1 %finally.shouldthrow, label %finally.rethrow, label %finally.cont
  
  catch:                                            ; No predecessors!
    ; ...
    call void @opaque2() #2
    ; ...
  
  attributes #2 = { nomerge }

So all three function calls have the `nomerge` attribute.

I can't find an existing test case checking that `nomerge`, shall I just add this one in `clang/test/CodeGenObjC` in this patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97371



More information about the cfe-commits mailing list