[all-commits] [llvm/llvm-project] ad5973: Fix __has_unique_object_representations with no_un...

gaborbencze via All-commits all-commits at lists.llvm.org
Thu Aug 26 00:29:13 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ad59735f9d150ebd10d4752a4468795c39f02c5d
      https://github.com/llvm/llvm-project/commit/ad59735f9d150ebd10d4752a4468795c39f02c5d
  Author: Gabor Bencze <b.gabor98 at gmail.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M clang/lib/AST/ASTContext.cpp
    A clang/test/SemaCXX/has_unique_object_reps_no_unique_addr.cpp

  Log Message:
  -----------
  Fix __has_unique_object_representations with no_unique_address

Fix incorrect behavior of `__has_unique_object_representations`
when using the no_unique_address attribute.
Based on the bug report: https://bugs.llvm.org/show_bug.cgi?id=47722

Reviewed By: aaron.ballman

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


  Commit: 3373e845398bfb8fa0e3c81b7ca84cbfedbad3ae
      https://github.com/llvm/llvm-project/commit/3373e845398bfb8fa0e3c81b7ca84cbfedbad3ae
  Author: Gabor Bencze <b.gabor98 at gmail.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
    M clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
    A clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
    A clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.h
    M clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    A clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-memory-comparison.rst
    A clang-tools-extra/docs/clang-tidy/checks/cert-exp42-c.rst
    A clang-tools-extra/docs/clang-tidy/checks/cert-flp37-c.rst
    M clang-tools-extra/docs/clang-tidy/checks/list.rst
    A clang-tools-extra/test/clang-tidy/checkers/bugprone-suspicious-memory-comparison-32bits.cpp
    A clang-tools-extra/test/clang-tidy/checkers/bugprone-suspicious-memory-comparison.c
    A clang-tools-extra/test/clang-tidy/checkers/bugprone-suspicious-memory-comparison.cpp

  Log Message:
  -----------
  [clang-tidy] Add bugprone-suspicious-memory-comparison check

The check warns on suspicious calls to `memcmp`.
It currently checks for comparing types that do not have
unique object representations or are non-standard-layout.
Based on
  https://wiki.sei.cmu.edu/confluence/display/c/EXP42-C.+Do+not+compare+padding+data
  https://wiki.sei.cmu.edu/confluence/display/c/FLP37-C.+Do+not+use+object+representations+to+compare+floating-point+values
and part of
  https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP57-CPP.+Prefer+special+member+functions+and+overloaded+operators+to+C+Standard+Library+functions
Add alias `cert-exp42-c` and `cert-flp37-c`.

Some tests are currently failing at head, the check depends on D89649.
Originally started in D71973

Reviewed By: aaron.ballman

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


Compare: https://github.com/llvm/llvm-project/compare/b21ed75e107b...3373e845398b


More information about the All-commits mailing list