New issue
Advanced search Search tips

Issue 663463 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug



Sign in to add a comment

FindBadConstructsConsumer treats some POD members as non-POD

Project Member Reported by palmer@chromium.org, Nov 8 2016

Issue description

See discussion in https://codereview.chromium.org/2484803003: this Clang plugin thinks that for a class/struct to have-a std::atomic_int means that the class is non-trivial, presumably because atomic_int has some template magic. In fact, not all templated things are non-trivial.

dcheng: I'll try my hand at it.
 
Summary: FindBadConstructsConsumer treats some POD members as non-POD (was: FindBadConstructs treats some POD members as non-POD)
I'm handwaving a bit here, but if it's possible to defer checking templates until they're actually instantiated (as a CXXTemplateSpecializationDecl, I think?), I think that will help us achieve the right behavior: I'm hoping we would be able to use things like hasTrivialDestructor() to determine whether or not a templated type can be treated as trivial.
Project Member

Comment 4 by bugdroid1@chromium.org, Nov 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/11cb6892af5990d0e4430a8624d5643a1d658d46

commit 11cb6892af5990d0e4430a8624d5643a1d658d46
Author: thakis <thakis@chromium.org>
Date: Wed Nov 09 15:05:29 2016

Revert of Treat std::atomic_int as a trivial class member when checking for non-trivial classes. (patchset #2 id:20001 of https://codereview.chromium.org/2483973003/ )

Reason for revert:
This broke all clang tot bots, e.g. here:

https://build.chromium.org/p/chromium.fyi/builders/ClangToTLinux%20%28dbg%29/builds/4709/steps/gclient%20runhooks/logs/stdio

Testing trivial_ctor.cpp... failed: no expected file found
...
Ran 18 tests: 17 succeeded, 1 failed
    trivial_ctor

Original issue's description:
> Treat atomic_int as a trivial class member when checking for non-trivial classes.
>
> This is a quick hack to unblock work on
> https://codereview.chromium.org/2484803003. The real fix will be to check the
> class after template instantiation.
>
> BUG=663463
>
> Committed: https://crrev.com/9d17488d4ed2bfecab3d6e723881e1d9cedfb90a
> Cr-Commit-Position: refs/heads/master@{#430773}

TBR=dcheng@chromium.org,erg@chromium.org,palmer@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=663463

Review-Url: https://codereview.chromium.org/2491523002
Cr-Commit-Position: refs/heads/master@{#430930}

[modify] https://crrev.com/11cb6892af5990d0e4430a8624d5643a1d658d46/tools/clang/plugins/FindBadConstructsConsumer.cpp
[delete] https://crrev.com/4e2a6810fd84198ce9d8062d69393076b48a91e9/tools/clang/plugins/tests/trivial_ctor.cpp
[delete] https://crrev.com/4e2a6810fd84198ce9d8062d69393076b48a91e9/tools/clang/plugins/tests/trivial_ctor.h
[modify] https://crrev.com/11cb6892af5990d0e4430a8624d5643a1d658d46/tools/clang/plugins/tests/virtual_bodies.h

Project Member

Comment 6 by bugdroid1@chromium.org, Nov 15 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d57e2e35e306be47b0dc96337a131c6e28f1c387

commit d57e2e35e306be47b0dc96337a131c6e28f1c387
Author: hans <hans@chromium.org>
Date: Tue Nov 15 00:05:23 2016

Roll clang 284979-1:284979-2 (update style plugin)

Ran `tools/clang/scripts/upload_revision.py 284979 2`.

This doesn't change the Clang version, but picks up Chromium #431450
which contains a fix for the style plugin.

BUG=663463

Review-Url: https://codereview.chromium.org/2493243002
Cr-Commit-Position: refs/heads/master@{#431999}

[modify] https://crrev.com/d57e2e35e306be47b0dc96337a131c6e28f1c387/tools/clang/scripts/update.py

Comment 7 by palmer@chromium.org, Nov 18 2016

Cc: -dcheng@chromium.org palmer@chromium.org
Owner: dcheng@chromium.org
Passing the long-term fix off to dcheng.
This came up for std::atomic<uint_fast8_t> here - https://chromium-review.googlesource.com/c/chromium/src/+/1278425/4/base/synchronization/atomic_flag.h#24

(Just adding a note).

Sign in to add a comment