RE: [clang] 0674f2e - [NFC] Fix warning on no return after switch.

2022-10-18 Thread stan li via cfe-commits
Thanks for the suggestion.

Updated llvm_unreachable.

The static_cast not only check the switch cases all covered, also make sure 2 
enums not out of sync.



Sent from Mail for Windows

From: David Blaikie
Sent: Monday, October 17, 2022 5:42 PM
To: Xiang Li; Xiang 
Li
Cc: cfe-commits@lists.llvm.org
Subject: Re: [clang] 0674f2e - [NFC] Fix warning on no return after switch.

Also the static_assert is probably not needed - Clang builds with
-Wswitch-enum, which will warn if a switch over an enum doesn't cover
all the enumerators. We have lots of other switches over enums that
depend on this warning to detect code that needs to be updated when an
enum is modified.

On Mon, Oct 17, 2022 at 5:40 PM David Blaikie  wrote:
>
> If the switch is exhaustive (covers all the enumerators in an
> enumeration), we usually use an llvm_unreachable at the end, rather
> than a return. Could you change this to an llvm_unreachable?
>
> On Mon, Oct 17, 2022 at 3:52 PM Xiang Li via cfe-commits
>  wrote:
> >
> >
> > Author: Xiang Li
> > Date: 2022-10-17T15:52:23-07:00
> > New Revision: 0674f2ec96422131abde0c042fbf2c11267db210
> >
> > URL: 
> > https://github.com/llvm/llvm-project/commit/0674f2ec96422131abde0c042fbf2c11267db210
> > DIFF: 
> > https://github.com/llvm/llvm-project/commit/0674f2ec96422131abde0c042fbf2c11267db210.diff
> >
> > LOG: [NFC] Fix warning on no return after switch.
> >
> > Added:
> >
> >
> > Modified:
> > clang/lib/CodeGen/CGHLSLRuntime.cpp
> >
> > Removed:
> >
> >
> >
> > 
> > diff  --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp 
> > b/clang/lib/CodeGen/CGHLSLRuntime.cpp
> > index 7a80dedb8133..6f32136b49de 100644
> > --- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
> > +++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
> > @@ -270,6 +270,7 @@ 
> > castResourceShapeToResourceKind(HLSLResourceAttr::ResourceKind RK) {
> >static_cast(
> >HLSLResourceAttr::ResourceKind::FeedbackTexture2DArray) ==
> >(static_cast(llvm::hlsl::ResourceKind::NumEntries) - 2));
> > +  return llvm::hlsl::ResourceKind::Invalid;
> >  }
> >
> >  void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable 
> > *GV) {
> >
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: [PATCH] D111109: AddGlobalAnnotations for function with or without function body.

2021-10-21 Thread stan li via cfe-commits
Hi Alex,
I’ll take a look. Not sure how long it takes though.
Please revert it. I don’t have the permission to commit yet.

Could you share more information about the crash?
What is the command line to repro the crash and which environment it crashed.

Thanks
Xiang
Sent from Mail for Windows

From: Alexander Kornienko via Phabricator
Sent: Wednesday, October 20, 2021 2:19 PM
To: python3k...@outlook.com; 
mizve...@gmail.com; 
blitzrak...@gmail.com; 
notst...@gmail.com; 
shen...@google.com; 
rich...@metafoo.co.uk; 
bhuvanendra.kum...@amd.com; 
mlek...@skidmore.edu; 
jlero...@apple.com; 
chris.biene...@me.com; 
aaron.ball...@gmail.com
Cc: ale...@google.com; 
ndesaulni...@google.com; 
cfe-commits@lists.llvm.org; 
david.gr...@arm.com; 
ruiling.s...@amd.com
Subject: [PATCH] D09: AddGlobalAnnotations for function with or without 
function body.

alexfh added a comment.

Reduced test case:

  template  void b(a);
  template  class d {
  public:
class e {
public:
  c *f();
};
e *g();
  };
  template  class j;
  template  class j {
  public:
class k {
public:
  k(int *);
  ~k();
};
int n();
d l;
  };
  template  int j::n() {
auto m = l.g()->f();
k a(*m);
b(a);
  }
  template 
  j::k::~k() __attribute__((annotate(""))) {}
  class o {
int m_fn4();
j p;
  };
  int o::m_fn4() { p.n(); }

Please revert the commit if there is no quick and obvious solution. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D09

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: [PATCH] D111109: AddGlobalAnnotations for function with or without function body.

2021-10-21 Thread stan li via cfe-commits
Hi Alex,
I tried compile your repro on Windows with
clang -S
But it didn’t crash.

Could you share the command line and environment to repro the crash?

Thanks
Xiang

Sent from Mail for Windows


From: Alexander Kornienko via Phabricator 
Sent: Wednesday, October 20, 2021 4:10:42 PM
To: python3k...@outlook.com ; mizve...@gmail.com 
; blitzrak...@gmail.com ; 
notst...@gmail.com ; shen...@google.com 
; rich...@metafoo.co.uk ; 
bhuvanendra.kum...@amd.com ; mlek...@skidmore.edu 
; jlero...@apple.com ; 
chris.biene...@me.com ; aaron.ball...@gmail.com 

Cc: ale...@google.com ; ndesaulni...@google.com 
; cfe-commits@lists.llvm.org 
; david.gr...@arm.com ; 
ruiling.s...@amd.com 
Subject: [PATCH] D09: AddGlobalAnnotations for function with or without 
function body.

alexfh added a comment.

Reduced the test further to:

  struct k {
~k() __attribute__((annotate(""))) {}
  };
  void m() { k(); }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D09

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits