[all-commits] [llvm/llvm-project] 63e0d0: Diagnose -Wunused-value based on CFG reachability

Yuanfang Chen via All-commits all-commits at lists.llvm.org
Mon Sep 20 10:44:06 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 63e0d038fc20c894a3d541effa1bc2b1fdea37b9
      https://github.com/llvm/llvm-project/commit/63e0d038fc20c894a3d541effa1bc2b1fdea37b9
  Author: Yuanfang Chen <yuanfang.chen at sony.com>
  Date:   2021-09-20 (Mon, 20 Sep 2021)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/SemaStmt.cpp
    M clang/test/Analysis/dead-stores.c
    M clang/test/CXX/basic/basic.link/p8.cpp
    M clang/test/CXX/drs/dr14xx.cpp
    M clang/test/CXX/drs/dr20xx.cpp
    M clang/test/CXX/drs/dr7xx.cpp
    M clang/test/CXX/temp/temp.constr/temp.constr.constr/partial-specializations.cpp
    M clang/test/CodeCompletion/pragma-macro-token-caching.c
    M clang/test/Frontend/fixed_point_crash.c
    M clang/test/PCH/cxx-explicit-specifier.cpp
    M clang/test/Parser/cxx-ambig-decl-expr.cpp
    M clang/test/Parser/cxx0x-ambig.cpp
    M clang/test/Parser/cxx1z-init-statement.cpp
    M clang/test/Parser/objc-messaging-1.m
    M clang/test/Parser/objc-try-catch-1.m
    M clang/test/Parser/objcxx11-attributes.mm
    M clang/test/Sema/const-eval.c
    M clang/test/Sema/exprs.c
    M clang/test/Sema/i-c-e.c
    M clang/test/Sema/sizeless-1.c
    M clang/test/Sema/switch-1.c
    M clang/test/Sema/vla-2.c
    M clang/test/Sema/warn-type-safety.c
    M clang/test/Sema/warn-unused-value.c
    M clang/test/SemaCXX/attr-annotate.cpp
    M clang/test/SemaCXX/builtin-constant-p.cpp
    M clang/test/SemaCXX/constant-expression-cxx2a.cpp
    M clang/test/SemaCXX/constant-expression.cpp
    M clang/test/SemaCXX/expression-traits.cpp
    M clang/test/SemaCXX/matrix-type-operators.cpp
    M clang/test/SemaCXX/overloaded-operator.cpp
    M clang/test/SemaCXX/sizeless-1.cpp
    M clang/test/SemaCXX/vector.cpp
    M clang/test/SemaCXX/warn-comma-operator.cpp
    M clang/test/SemaCXX/warn-unused-value.cpp
    M clang/test/SemaTemplate/derived.cpp
    M clang/test/SemaTemplate/lambda-capture-pack.cpp

  Log Message:
  -----------
  Diagnose -Wunused-value based on CFG reachability

While at it, add the diagnosis message "left operand of comma operator has no effect" (used by GCC) for comma operator.

This also makes Clang diagnose in the constant evaluation context which aligns with GCC/MSVC behavior. (https://godbolt.org/z/7zxb8Tx96)

Reviewed By: aaron.ballman

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




More information about the All-commits mailing list