New issue
Advanced search Search tips

Issue 804944 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

clang plugin should allow raw pointers in lambda init-capture

Project Member Reported by jdoerrie@chromium.org, Jan 23 2018

Issue description

As described in [1] the clang-plugin currently disallows capturing raw pointers in a lambda init capture, as it triggers the "Do not use auto to deduce a raw pointer" check [2]. Since there is no explicit mention of `auto` in the capture list, this is likely a bug and should be fixed.

[1] https://groups.google.com/a/chromium.org/d/msg/cxx/8BHoi4T6ZhA/pWHB6IYoAgAJ
[2] https://www.chromium.org/developers/coding-style/cpp-dos-and-donts#TOC-Do-not-use-auto-to-deduce-a-raw-pointer
 

Comment 1 by danakj@chromium.org, Jan 23 2018

Cc: vmp...@chromium.org
Components: Tools
Attempted Fix: https://crrev.com/c/879181
Project Member

Comment 3 by bugdroid1@chromium.org, Jan 25 2018

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

commit 5bc544cfb9c6aa72cb53d6491e2e64c4a38d2bbe
Author: jdoerrie <jdoerrie@chromium.org>
Date: Thu Jan 25 18:26:09 2018

[clang-tool] Allow Pointers in Lambda Init Capture

This change fixes clang-tool to allow pointers in lambda init-captures.
Prior to this change it erroneously triggered the auto raw pointer check.

Bug:  804944 
Change-Id: Ifc8811d80cefcc593383c21d7c086d3ba719975f
Reviewed-on: https://chromium-review.googlesource.com/879181
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531954}
[modify] https://crrev.com/5bc544cfb9c6aa72cb53d6491e2e64c4a38d2bbe/tools/clang/plugins/FindBadConstructsConsumer.cpp
[modify] https://crrev.com/5bc544cfb9c6aa72cb53d6491e2e64c4a38d2bbe/tools/clang/plugins/tests/auto_raw_pointer.cpp
[modify] https://crrev.com/5bc544cfb9c6aa72cb53d6491e2e64c4a38d2bbe/tools/clang/pylib/clang/plugin_testing.py

Status: Fixed (was: Started)
r531954 fixes this issue. How frequently is the clang-tool updated? I.e. when could I use a raw pointer in an init-capture without breaking compilation?

Sign in to add a comment