New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 685264 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug-Regression

Blocking:
issue 578344



Sign in to add a comment

rewrite_to_chrome_style: no member named 'kSafeToCompareToEmptyOrDeleted'

Project Member Reported by lukasza@chromium.org, Jan 25 2017

Issue description

We have regressed ability to cleanly build third_party/WebKit/Source/wtf:wtf after a dry-run of the Great Blink Rename.

In particular:

$ ninja -C out/gn obj/third_party/WebKit/Source/wtf/wtf/TextEncodingRegistry.o
...
../../third_party/WebKit/Source/wtf/HashTable.h:1028:26: error: no member named 'kSafeToCompareToEmptyOrDeleted' in 'WTF::TextEncodingNameHash'
          HashFunctions::kSafeToCompareToEmptyOrDeleted>::CheckKey(key)));
...


 

Comment 1 by danakj@chromium.org, Jan 25 2017

Uh hm. I whitelisted that to become safe_to_compare_to_empty_or_deleted, but I guess it went wrong.

Comment 2 by danakj@chromium.org, Jan 25 2017

I guess the usage of it went the wrong way somehow?
After automatic rename, I see the following state:

$ find . -type f | xargs grep safe_to_compare_to_empty_or_deleted
./LinkedHashSet.h:  static const bool safe_to_compare_to_empty_or_deleted = false;
./text/TextEncodingRegistry.cpp:  static const bool safe_to_compare_to_empty_or_deleted = false;
./text/AtomicStringHash.h:  static const bool safe_to_compare_to_empty_or_deleted = false;
./text/StringHash.h:  static const bool safe_to_compare_to_empty_or_deleted = false;
./text/StringHash.h:  static const bool safe_to_compare_to_empty_or_deleted = false;
./HashSetTest.cpp:  static const bool safe_to_compare_to_empty_or_deleted = true;
./HashSetTest.cpp:  static const bool safe_to_compare_to_empty_or_deleted = true;
./ListHashSet.h:  static const bool safe_to_compare_to_empty_or_deleted = false;
./HashMapTest.cpp:  static const bool safe_to_compare_to_empty_or_deleted = true;
./HashFunctions.h:  static const bool safe_to_compare_to_empty_or_deleted = true;
./HashFunctions.h:  static const bool safe_to_compare_to_empty_or_deleted = true;
./HashFunctions.h:  static const bool safe_to_compare_to_empty_or_deleted = true;
./HashFunctions.h:  static const bool safe_to_compare_to_empty_or_deleted =
./HashFunctions.h:  static const bool safe_to_compare_to_empty_or_deleted =

~/src/chromium4/src/third_party/WebKit/Source/wtf on (HEAD detached at 4ecf949ea6d9)*
$ find . -type f | xargs grep kSafeToCompareToEmptyOrDeleted
./HashTable.h:          HashFunctions::kSafeToCompareToEmptyOrDeleted>::CheckKey(key)));
./HashTable.h:    if (HashFunctions::kSafeToCompareToEmptyOrDeleted) {
./HashTable.h:    if (HashFunctions::kSafeToCompareToEmptyOrDeleted) {
./HashTable.h:    if (HashFunctions::kSafeToCompareToEmptyOrDeleted) {


This repros with:

template-original.cc:

namespace blink {
...
namespace safe_to_compate_to_empty_or_deleted_trouble {

template <typename T>
class TypeTrait {
 public:
  static const bool safeToCompareToEmptyOrDeleted = false;
};
template <>
class TypeTrait<int> {
 public:
  static const bool safeToCompareToEmptyOrDeleted = true;
};

template <typename T>
bool foo() {
  return TypeTrait<T>::safeToCompareToEmptyOrDeleted;
}

}  // namespace safe_to_compate_to_empty_or_deleted_trouble



template-expected.cc:

namespace blink {
...
namespace safe_to_compate_to_empty_or_deleted_trouble {

template <typename T>
class TypeTrait {
 public:
  static const bool safe_to_compare_to_empty_or_deleted = false;
};
template <>
class TypeTrait<int> {
 public:
  static const bool safe_to_compare_to_empty_or_deleted = true;
};

template <typename T>
bool Foo() {
  return TypeTrait<T>::safe_to_compare_to_empty_or_deleted;
}

}  // namespace safe_to_compate_to_empty_or_deleted_trouble


And the diff is as danakj@ suggested in the usage:

-  return TypeTrait<T>::safe_to_compare_to_empty_or_deleted;
+  return TypeTrait<T>::safeToCompareToEmptyOrDeleted;

Comment 6 by danakj@chromium.org, Jan 25 2017

Owner: danakj@chromium.org
Status: Started (was: Untriaged)

Comment 9 by danakj@chromium.org, Jan 25 2017

Status: Fixed (was: Started)
lmk if more things are broken tho..
Status: Assigned (was: Fixed)
We seem to generate conflicting edits here:

$ cat ~/scratch/run_tool.edits | tools/clang/scripts/apply_edits.py out/gn                           
Conflicting edit: /usr/local/google/home/lukasza/src/chromium4/src/third_party/WebKit/Source/wtf/HashTable.h at offset 38635, length 29: "kSafeToCompareToEmptyOrDeleted" != "safe_to_compare_to_empty_or_deleted"
Conflicting edit: /usr/local/google/home/lukasza/src/chromium4/src/third_party/WebKit/Source/wtf/HashTable.h at offset 34211, length 29: "kSafeToCompareToEmptyOrDeleted" != "safe_to_compare_to_empty_or_deleted"
Conflicting edit: /usr/local/google/home/lukasza/src/chromium4/src/third_party/WebKit/Source/wtf/HashTable.h at offset 32632, length 29: "kSafeToCompareToEmptyOrDeleted" != "safe_to_compare_to_empty_or_deleted"
Conflicting edit: /usr/local/google/home/lukasza/src/chromium4/src/third_party/WebKit/Source/wtf/HashTable.h at offset 32284, length 29: "kSafeToCompareToEmptyOrDeleted" != "safe_to_compare_to_empty_or_deleted"
Applied 878496 edits (4 errors) to 9046 files [100.00%]
Nooo. Why does this trait have to be so hard. Thanks for the info D:
When investigating this, in addition to #c10 it might be useful to look at compilation as well.  Interestignly, after an automatic rename,
1) building of third_party/WebKit/Source/wtf:wtf and third_party/WebKit/Source/wtf:wtf_unittests works just fine.
2) OTOH, there are quite a few build errors outside of wtf.  Some examples:

Building of obj/third_party/WebKit/Source/core/animation/animation/LengthListPropertyFunctions.o target fails with:
../../third_party/WebKit/Source/wtf/HashTable.h:1256:24: error: no member named 'safe_to_compare_to_empty_or_deleted' in 'blink::ShapeCache::SmallStringKeyHash'

Building of obj/third_party/WebKit/Source/core/core_generated/ScriptValueSerializer.o target fails with:
../../third_party/WebKit/Source/wtf/HashTable.h:1256:24: error: no member named 'safe_to_compare_to_empty_or_deleted' in 'blink::V8ObjectMap<v8::Object, unsigned int>::V8HandlePtrHash<v8::Object>' 
Hm.

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h?rcl=0&l=93

When I did git grep though I didn't find any instances of safeToCompareToEmptyOrDeleted afterward, I wonder what I missed.
I think my brute force patch will work, I don't see errors related to this for those 2 files now.
Project Member

Comment 15 by bugdroid1@chromium.org, Jan 31 2017

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

commit bc7ab72c78b36430b6c77078d2ad9790d1bf79c0
Author: danakj <danakj@chromium.org>
Date: Tue Jan 31 00:43:02 2017

Force the safeToCompareToEmptyOrDeleted trait to be renamed correctly

This simply renames all varDecl and varDeclRefs with that name to
safe_to_compare_to_empty_or_deleted. It leaves matchers for outside
of the blink namespace still.

R=dcheng@chromium.org
BUG= 685264 

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

[modify] https://crrev.com/bc7ab72c78b36430b6c77078d2ad9790d1bf79c0/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp

Status: Fixed (was: Assigned)
ONCE AND FOR ALL?

Sign in to add a comment