[all-commits] [llvm/llvm-project] 6c906f: [Sema] Diagnose more cases of static data members ...

john-brawn-arm via All-commits all-commits at lists.llvm.org
Tue May 26 05:38:39 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6c906f7785dad3a1dea5357cfde0762952c2a2bd
      https://github.com/llvm/llvm-project/commit/6c906f7785dad3a1dea5357cfde0762952c2a2bd
  Author: John Brawn <john.brawn at arm.com>
  Date:   2020-05-26 (Tue, 26 May 2020)

  Changed paths:
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/OpenMP/for_loop_messages.cpp
    M clang/test/SemaCXX/anonymous-struct.cpp
    M clang/test/SemaCXX/blocks.cpp

  Log Message:
  -----------
  [Sema] Diagnose more cases of static data members in local or unnamed classes

We currently diagnose static data members directly contained in unnamed classes,
but we should also diagnose when they're in a class that is nested (directly or
indirectly) in an unnamed class. Do this by iterating up the list of parent
DeclContexts and checking if any is an unnamed class.

Similarly also check for function or method DeclContexts (which includes things
like blocks and openmp captured statements) as then the class is considered to
be a local class, which means static data members aren't allowed.

Differential Revision: https://reviews.llvm.org/D80295




More information about the All-commits mailing list