diff --git a/tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp b/tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp index 40b1473..73a1753 100644 --- a/tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp +++ b/tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp
@@ -57,7 +57,7 @@ if (!managed_host_) return; - if (edge->IsUnsafe()) + if (edge->on_heap()) invalid_fields_.push_back(std::make_pair(current_, kIteratorToGCManaged)); }
diff --git a/tools/clang/blink_gc_plugin/Config.h b/tools/clang/blink_gc_plugin/Config.h index 5729d33..1f9ce59 100644 --- a/tools/clang/blink_gc_plugin/Config.h +++ b/tools/clang/blink_gc_plugin/Config.h
@@ -134,7 +134,6 @@ return name == "Vector" || name == "Deque" || name == "HashSet" || - name == "ListHashSet" || name == "LinkedHashSet" || name == "HashCountedSet" || name == "HashMap"; @@ -142,25 +141,12 @@ static bool IsGCCollection(llvm::StringRef name) { return name == "HeapVector" || name == "HeapDeque" || - name == "HeapHashSet" || name == "HeapListHashSet" || - name == "HeapLinkedHashSet" || name == "HeapHashCountedSet" || - name == "HeapHashMap"; - } - - static bool IsGCCollectionWithUnsafeIterator(llvm::StringRef name) { - if (!IsGCCollection(name)) - return false; - // The list hash set iterators refer to the set, not the - // backing store and are consequently safe. - if (name == "HeapListHashSet" || name == "PersistentHeapListHashSet") - return false; - return true; + name == "HeapHashSet" || name == "HeapLinkedHashSet" || + name == "HeapHashCountedSet" || name == "HeapHashMap"; } static bool IsHashMap(llvm::StringRef name) { - return name == "HashMap" || - name == "HeapHashMap" || - name == "PersistentHeapHashMap"; + return name == "HashMap" || name == "HeapHashMap"; } // Assumes name is a valid collection name.
diff --git a/tools/clang/blink_gc_plugin/Edge.h b/tools/clang/blink_gc_plugin/Edge.h index 2b0b0e66..671c640 100644 --- a/tools/clang/blink_gc_plugin/Edge.h +++ b/tools/clang/blink_gc_plugin/Edge.h
@@ -289,8 +289,7 @@ // An iterator edge is a direct edge to some iterator type. class Iterator : public Edge { public: - Iterator(RecordInfo* info, bool on_heap, bool is_unsafe) - : info_(info), on_heap_(on_heap), is_unsafe_(is_unsafe) {} + Iterator(RecordInfo* info, bool on_heap) : info_(info), on_heap_(on_heap) {} ~Iterator() {} void Accept(EdgeVisitor* visitor) override { visitor->VisitIterator(this); } @@ -298,18 +297,17 @@ bool NeedsFinalization() override { return false; } TracingStatus NeedsTracing(NeedsTracingOption) override { if (on_heap_) - return TracingStatus::Needed(); + return TracingStatus::Illegal(); return TracingStatus::Unneeded(); } RecordInfo* info() const { return info_; } - bool IsUnsafe() const { return is_unsafe_; } + bool on_heap() const { return on_heap_; } private: RecordInfo* info_; bool on_heap_; - bool is_unsafe_; }; #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_
diff --git a/tools/clang/blink_gc_plugin/RecordInfo.cpp b/tools/clang/blink_gc_plugin/RecordInfo.cpp index 23c70665..e5d7500 100644 --- a/tools/clang/blink_gc_plugin/RecordInfo.cpp +++ b/tools/clang/blink_gc_plugin/RecordInfo.cpp
@@ -84,7 +84,7 @@ return false; // Heap collections may have a finalizer but it is optional (i.e. may be // delayed until FinalizeGarbageCollectedObject() gets called), unless there - // is an inline buffer. Vector, Deque, and ListHashSet can have an inline + // is an inline buffer. Vector and Deque can have an inline // buffer. if (name_ != "Vector" && name_ != "Deque" && name_ != "HeapVector" && name_ != "HeapDeque") @@ -665,15 +665,12 @@ cache_->Lookup(elaboratedType->getQualifier()->getAsType()); bool on_heap = false; - bool is_unsafe = false; // Silently handle unknown types; the on-heap collection types will // have to be in scope for the declaration to compile, though. if (info) { - is_unsafe = Config::IsGCCollectionWithUnsafeIterator(info->name()); - // Don't mark iterator as being on the heap if it is not supported. - on_heap = !is_unsafe && Config::IsGCCollection(info->name()); + on_heap = Config::IsGCCollection(info->name()); } - return new Iterator(info, on_heap, is_unsafe); + return new Iterator(info, on_heap); } Edge* RecordInfo::CreateEdge(const Type* type) {
diff --git a/tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.h b/tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.h index 8462840..f2cd919 100644 --- a/tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.h +++ b/tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.h
@@ -57,7 +57,6 @@ std::unique_ptr<HeapObject> m_obj4; HeapHashMap<int, Member<HeapObject>>::reverse_iterator m_iterator3; HeapDeque<Member<HeapObject>>::const_reverse_iterator m_iterator4; - HeapListHashSet<Member<HeapObject>>::const_iterator m_iterator5; HeapLinkedHashSet<Member<HeapObject>>::const_iterator m_iterator6; };
diff --git a/tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.txt b/tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.txt index 55ea423..76e3386 100644 --- a/tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.txt +++ b/tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.txt
@@ -29,7 +29,7 @@ ./fields_illegal_tracing.h:59:3: warning: [blink-gc] Iterator field 'm_iterator4' to a GC managed collection declared here: HeapDeque<Member<HeapObject>>::const_reverse_iterator m_iterator4; ^ -./fields_illegal_tracing.h:61:3: warning: [blink-gc] Iterator field 'm_iterator6' to a GC managed collection declared here: +./fields_illegal_tracing.h:60:3: warning: [blink-gc] Iterator field 'm_iterator6' to a GC managed collection declared here: HeapLinkedHashSet<Member<HeapObject>>::const_iterator m_iterator6; ^ fields_illegal_tracing.cpp:9:1: warning: [blink-gc] Class 'PartObjectWithTrace' has untraced or not traceable fields. @@ -50,7 +50,4 @@ ./fields_illegal_tracing.h:57:3: note: [blink-gc] Untraceable field 'm_obj4' declared here: std::unique_ptr<HeapObject> m_obj4; ^ -./fields_illegal_tracing.h:60:3: note: [blink-gc] Untraced field 'm_iterator5' declared here: - HeapListHashSet<Member<HeapObject>>::const_iterator m_iterator5; - ^ 9 warnings generated.
diff --git a/tools/clang/blink_gc_plugin/tests/heap/stubs.h b/tools/clang/blink_gc_plugin/tests/heap/stubs.h index 7c7c88d..ebabff6 100644 --- a/tools/clang/blink_gc_plugin/tests/heap/stubs.h +++ b/tools/clang/blink_gc_plugin/tests/heap/stubs.h
@@ -88,20 +88,6 @@ }; template <typename ValueArg, - typename HashArg = void, - typename TraitsArg = void, - typename Allocator = DefaultAllocator> -class ListHashSet { - public: - typedef ValueArg* iterator; - typedef const ValueArg* const_iterator; - typedef ValueArg* reverse_iterator; - typedef const ValueArg* const_reverse_iterator; - - ~ListHashSet() {} -}; - -template <typename ValueArg, typename TraitsArg = void, typename Allocator = DefaultAllocator> class LinkedHashSet { @@ -414,10 +400,6 @@ public HashSet<T, void, void, HeapAllocator> {}; template <typename T> -class HeapListHashSet : public GarbageCollected<HeapListHashSet<T>>, - public ListHashSet<T, void, void, HeapAllocator> {}; - -template <typename T> class HeapLinkedHashSet : public GarbageCollected<HeapLinkedHashSet<T>>, public LinkedHashSet<T, void, HeapAllocator> {};
diff --git a/tools/clang/blink_gc_plugin/tests/stack_allocated.txt b/tools/clang/blink_gc_plugin/tests/stack_allocated.txt index f6742df0..4ddcb355 100644 --- a/tools/clang/blink_gc_plugin/tests/stack_allocated.txt +++ b/tools/clang/blink_gc_plugin/tests/stack_allocated.txt
@@ -23,7 +23,7 @@ ./stack_allocated.h:44:3: warning: [blink-gc] Garbage collected class 'DerivedHeapObject2' is not permitted to override its new operator. STACK_ALLOCATED(); ^ -./heap/stubs.h:374:3: note: expanded from macro 'STACK_ALLOCATED' +./heap/stubs.h:360:3: note: expanded from macro 'STACK_ALLOCATED' __attribute__((annotate("blink_stack_allocated"))) void* operator new( \ ^ In file included from stack_allocated.cpp:5:
diff --git a/tools/clang/blink_gc_plugin/tests/trace_collections.h b/tools/clang/blink_gc_plugin/tests/trace_collections.h index c3e3b6a..bd3b779 100644 --- a/tools/clang/blink_gc_plugin/tests/trace_collections.h +++ b/tools/clang/blink_gc_plugin/tests/trace_collections.h
@@ -23,9 +23,6 @@ HeapHashSet<Member<HeapObject> > m_heapSet; HashSet<Member<HeapObject>, void, HeapAllocator> m_wtfSet; - HeapListHashSet<Member<HeapObject> > m_heapListSet; - ListHashSet<Member<HeapObject>, void, HeapAllocator> m_wtfListSet; - HeapLinkedHashSet<Member<HeapObject> > m_heapLinkedSet; LinkedHashSet<Member<HeapObject>, void, HeapAllocator> m_wtfLinkedSet;
diff --git a/tools/clang/blink_gc_plugin/tests/trace_collections.txt b/tools/clang/blink_gc_plugin/tests/trace_collections.txt index 8e6ac7b..0b65112 100644 --- a/tools/clang/blink_gc_plugin/tests/trace_collections.txt +++ b/tools/clang/blink_gc_plugin/tests/trace_collections.txt
@@ -19,34 +19,28 @@ ./trace_collections.h:24:5: note: [blink-gc] Untraced field 'm_wtfSet' declared here: HashSet<Member<HeapObject>, void, HeapAllocator> m_wtfSet; ^ -./trace_collections.h:26:5: note: [blink-gc] Untraced field 'm_heapListSet' declared here: - HeapListHashSet<Member<HeapObject> > m_heapListSet; - ^ -./trace_collections.h:27:5: note: [blink-gc] Untraced field 'm_wtfListSet' declared here: - ListHashSet<Member<HeapObject>, void, HeapAllocator> m_wtfListSet; - ^ -./trace_collections.h:29:5: note: [blink-gc] Untraced field 'm_heapLinkedSet' declared here: +./trace_collections.h:26:5: note: [blink-gc] Untraced field 'm_heapLinkedSet' declared here: HeapLinkedHashSet<Member<HeapObject> > m_heapLinkedSet; ^ -./trace_collections.h:30:5: note: [blink-gc] Untraced field 'm_wtfLinkedSet' declared here: +./trace_collections.h:27:5: note: [blink-gc] Untraced field 'm_wtfLinkedSet' declared here: LinkedHashSet<Member<HeapObject>, void, HeapAllocator> m_wtfLinkedSet; ^ -./trace_collections.h:32:5: note: [blink-gc] Untraced field 'm_heapCountedSet' declared here: +./trace_collections.h:29:5: note: [blink-gc] Untraced field 'm_heapCountedSet' declared here: HeapHashCountedSet<Member<HeapObject> > m_heapCountedSet; ^ -./trace_collections.h:33:5: note: [blink-gc] Untraced field 'm_wtfCountedSet' declared here: +./trace_collections.h:30:5: note: [blink-gc] Untraced field 'm_wtfCountedSet' declared here: HashCountedSet<Member<HeapObject>, void, HeapAllocator> m_wtfCountedSet; ^ -./trace_collections.h:35:5: note: [blink-gc] Untraced field 'm_heapMapKey' declared here: +./trace_collections.h:32:5: note: [blink-gc] Untraced field 'm_heapMapKey' declared here: HeapHashMap<int, Member<HeapObject> > m_heapMapKey; ^ -./trace_collections.h:36:5: note: [blink-gc] Untraced field 'm_heapMapVal' declared here: +./trace_collections.h:33:5: note: [blink-gc] Untraced field 'm_heapMapVal' declared here: HeapHashMap<Member<HeapObject>, int > m_heapMapVal; ^ -./trace_collections.h:37:5: note: [blink-gc] Untraced field 'm_wtfMapKey' declared here: +./trace_collections.h:34:5: note: [blink-gc] Untraced field 'm_wtfMapKey' declared here: HashMap<int, Member<HeapObject>, void, void, void, HeapAllocator> ^ -./trace_collections.h:39:5: note: [blink-gc] Untraced field 'm_wtfMapVal' declared here: +./trace_collections.h:36:5: note: [blink-gc] Untraced field 'm_wtfMapVal' declared here: HashMap<Member<HeapObject>, int, void, void, void, HeapAllocator> ^ 1 warning generated.
diff --git a/tools/clang/rewrite_raw_ptr_fields/manual-fields-to-ignore.txt b/tools/clang/rewrite_raw_ptr_fields/manual-fields-to-ignore.txt index 7b018c45..7b9f8d8 100644 --- a/tools/clang/rewrite_raw_ptr_fields/manual-fields-to-ignore.txt +++ b/tools/clang/rewrite_raw_ptr_fields/manual-fields-to-ignore.txt
@@ -195,8 +195,6 @@ blink::weakness_marking_test::EphemeronCallbacksCounter::count_holder_ sql::recover::InnerPageDecoder::db_reader_ sql::recover::LeafPageDecoder::db_reader_ -WTF::ListHashSet::head_ -WTF::ListHashSet::tail_ # Populated manually - flexible array with non-trivial destruction blink::ShapeResultView::(anonymous struct)::alignment
diff --git a/tools/clang/scripts/build.py b/tools/clang/scripts/build.py index f421cbc..978ea1d 100755 --- a/tools/clang/scripts/build.py +++ b/tools/clang/scripts/build.py
@@ -994,7 +994,7 @@ # TODO(thakis): Now that the NDK uses clang, try to build all archs in # one LLVM build instead of building 3 times. toolchain_dir = ANDROID_NDK_DIR + '/toolchains/llvm/prebuilt/linux-x86_64' - for target_arch in ['aarch64', 'arm', 'i686']: + for target_arch in ['aarch64', 'arm', 'i686', 'x86_64']: # Build compiler-rt runtimes needed for Android in a separate build tree. build_dir = os.path.join(LLVM_BUILD_DIR, 'android-' + target_arch) if not os.path.exists(build_dir): @@ -1003,7 +1003,9 @@ target_triple = target_arch if target_arch == 'arm': target_triple = 'armv7' - api_level = '21' if target_arch == 'aarch64' else '19' + api_level = '19' + if target_arch == 'aarch64' or target_arch == 'x86_64': + api_level = '21' target_triple += '-linux-android' + api_level cflags = [ '--target=' + target_triple, @@ -1013,10 +1015,11 @@ # depends on a newer version of libxml2.so than what's available on # the bots. To make things work, use our just-built lld as linker. '-fuse-ld=lld', - # Clang defaults to compiler-rt when targeting android after - # a478b0a199f4. Stick with libgcc for now. (crbug.com/1184398). + # The compiler we're building with (just-built clang) doesn't have the + # compiler-rt builtins; use libgcc to get past the CMake checks. '--rtlib=libgcc', ] + android_args = base_cmake_args + [ '-DCMAKE_C_COMPILER=' + os.path.join(LLVM_BUILD_DIR, 'bin/clang'), '-DCMAKE_CXX_COMPILER=' + os.path.join(LLVM_BUILD_DIR, 'bin/clang++'), @@ -1024,7 +1027,7 @@ '-DCMAKE_C_FLAGS=' + ' '.join(cflags), '-DCMAKE_CXX_FLAGS=' + ' '.join(cflags), '-DCMAKE_ASM_FLAGS=' + ' '.join(cflags), - '-DCOMPILER_RT_BUILD_BUILTINS=OFF', + '-DCOMPILER_RT_BUILD_BUILTINS=ON', '-DCOMPILER_RT_BUILD_CRT=OFF', '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF', '-DCOMPILER_RT_BUILD_MEMPROF=OFF', @@ -1037,13 +1040,13 @@ '-DANDROID=1'] RunCommand(['cmake'] + android_args + [COMPILER_RT_DIR]) - # We use ASan, UBSan, coverage, and PGO on the various Android targets. - # Only build HWASan for AArch64. libs_want = [ 'lib/linux/libclang_rt.asan-{0}-android.so', + 'lib/linux/libclang_rt.builtins-{0}-android.a', 'lib/linux/libclang_rt.ubsan_standalone-{0}-android.so', 'lib/linux/libclang_rt.profile-{0}-android.a', ] + # Only build HWASan for AArch64. if target_arch == 'aarch64': libs_want += ['lib/linux/libclang_rt.hwasan-{0}-android.so'] libs_want = [lib.format(target_arch) for lib in libs_want]
diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py index 635634df..5f85abf0 100755 --- a/tools/clang/scripts/package.py +++ b/tools/clang/scripts/package.py
@@ -256,7 +256,8 @@ if not args.build_mac_arm: # TODO(thakis): Figure out why this doesn't build in --build-mac-arm # builds. - want.append('lib/clang/$V/lib/x86_64-unknown-fuchsia/libclang_rt.profile.a') + want.append( + 'lib/clang/$V/lib/x86_64-unknown-fuchsia/libclang_rt.profile.a') if sys.platform != 'darwin': # The Fuchsia asan runtime is only built on non-Mac platforms. want.append('lib/clang/$V/lib/x86_64-unknown-fuchsia/libclang_rt.asan.so') @@ -306,6 +307,12 @@ 'lib/clang/$V/lib/linux/libclang_rt.asan-arm-android.so', 'lib/clang/$V/lib/linux/libclang_rt.asan-i686-android.so', + # Builtins for Android. + 'lib/clang/$V/lib/linux/libclang_rt.builtins-aarch64-android.a', + 'lib/clang/$V/lib/linux/libclang_rt.builtins-arm-android.a', + 'lib/clang/$V/lib/linux/libclang_rt.builtins-i686-android.a', + 'lib/clang/$V/lib/linux/libclang_rt.builtins-x86_64-android.a', + # HWASAN Android runtime. 'lib/clang/$V/lib/linux/libclang_rt.hwasan-aarch64-android.so', @@ -342,7 +349,9 @@ 'lib/clang/$V/lib/linux/libclang_rt.ubsan_standalone_cxx-x86_64.a.syms', # UndefinedBehaviorSanitizer Android runtime, needed for CFI. + # pylint: disable=line-too-long 'lib/clang/$V/lib/linux/libclang_rt.ubsan_standalone-aarch64-android.so', + # pylint: enable=line-too-long 'lib/clang/$V/lib/linux/libclang_rt.ubsan_standalone-arm-android.so', # Ignorelist for MemorySanitizer (used on Linux only). @@ -477,8 +486,10 @@ objdumpdir = 'llvmobjdump-' + stamp shutil.rmtree(objdumpdir, ignore_errors=True) os.makedirs(os.path.join(objdumpdir, 'bin')) - for filename in ['llvm-bcanalyzer', 'llvm-cxxfilt', 'llvm-nm', 'llvm-objdump', - 'llvm-readobj']: + for filename in [ + 'llvm-bcanalyzer', 'llvm-cxxfilt', 'llvm-dwarfdump', 'llvm-nm', + 'llvm-objdump', 'llvm-readobj' + ]: shutil.copy(os.path.join(LLVM_RELEASE_DIR, 'bin', filename + exe_ext), os.path.join(objdumpdir, 'bin')) llvmobjdump_stamp_file_base = 'llvmobjdump_build_revision'
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 95ba8a5..7f4e63b 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -39,7 +39,7 @@ # https://chromium.googlesource.com/chromium/src/+/main/docs/updating_clang.md # Reverting problematic clang rolls is safe, though. # This is the output of `git describe` and is usable as a commit-ish. -CLANG_REVISION = 'llvmorg-14-init-2175-g945cde8b' +CLANG_REVISION = 'llvmorg-14-init-3710-gd11a0c5d' CLANG_SUB_REVISION = 1 PACKAGE_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION)
diff --git a/tools/clang/scripts/upload_revision.py b/tools/clang/scripts/upload_revision.py index 4b554d0..8716135d 100755 --- a/tools/clang/scripts/upload_revision.py +++ b/tools/clang/scripts/upload_revision.py
@@ -40,7 +40,7 @@ Cq-Include-Trybots: chromium/try:linux_chromium_chromeos_msan_rel_ng Cq-Include-Trybots: chromium/try:linux_chromium_compile_dbg_32_ng Cq-Include-Trybots: chromium/try:linux_chromium_msan_rel_ng -Cq-Include-Trybots: chromium/try:mac-arm64-rel,mac_chromium_asan_rel_ng +Cq-Include-Trybots: chromium/try:mac11-arm64-rel,mac_chromium_asan_rel_ng Cq-Include-Trybots: chromium/try:win-asan,win7-rel Cq-Include-Trybots: chromium/try:android-official,fuchsia-official Cq-Include-Trybots: chromium/try:mac-official,linux-official