New issue
Advanced search Search tips

Issue 875620 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 20
Cc:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 1
Type: Bug

Blocking:
issue 871418



Sign in to add a comment

ToTiOS red after clang r340102

Project Member Reported by thakis@chromium.org, Aug 18

Issue description

"""
[ObjC] Error out when using forward-declared protocol in a @protocol
expression

Clang emits invalid protocol metadata when a @protocol expression is used with a
forward-declared protocol. The protocol metadata is missing protocol conformance
list of the protocol since we don't have access to the definition of it in the
compiled translation unit. The linker then might end up picking the invalid
metadata when linking which will lead to incorrect runtime protocol conformance
checks.

This commit makes sure that Clang fails to compile code that uses a @protocol
expression with a forward-declared protocol. This ensures that Clang does not
emit invalid protocol metadata. I added an extra assert in CodeGen to ensure
that this kind of issue won't happen in other places.
"""


Fires on Chromium at least here:

https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.clang%2FToTiOS%2F2025%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout


FAILED: obj/ios/chrome/browser/ssl/unit_tests/ios_ssl_error_handler_unittest.o 
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/ios/chrome/browser/ssl/unit_tests/ios_ssl_error_handler_unittest.o.d -DV8_DEPRECATION_WARNINGS -DNO_TCMALLOC -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -D_LIBCPP_HIDE_FROM_ABI=_LIBCPP_HIDDEN\ _LIBCPP_ALWAYS_INLINE -DCR_XCODE_VERSION=1000 -DCR_CLANG_REVISION=\"340123\" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DNS_BLOCK_ASSERTIONS=1 -DWEBP_EXTERN=extern -DEXPAT_RELATIVE_PATH -DGTEST_API_= -DGTEST_HAS_POSIX_RE=0 -DGTEST_LANG_CXX11=1 -DGTEST_HAS_TR1_TUPLE=0 -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=uint16_t -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_MAC -DWEBRTC_IOS -DABSL_ALLOCATOR_NOTHROW=1 -DNO_MAIN_THREAD_WRAPPING -DUSE_REMOTE_TEST_SERVER -DUNIT_TEST -I../.. -Igen -I../../third_party/libyuv/include -I../../third_party/libwebp/src -I../../third_party/webrtc_overrides -I../../testing/gtest/include -I../../third_party/libyuv/include -I../../third_party/usrsctp/usrsctplib -I../../third_party/webrtc -I../../third_party/googletest/custom -I../../third_party/googletest/src/googletest/include -I../../third_party/ced/src -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/protobuf/src -Igen/protoc_out -I../../third_party/protobuf/src -I../../third_party/boringssl/src/include -I../../third_party/webrtc_overrides -I../../third_party/webrtc -I../../third_party/abseil-cpp -I../../third_party/googletest/custom -I../../third_party/googletest/src/googlemock/include -I../../third_party/ocmock -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -fcolor-diagnostics -fmerge-all-constants -no-canonical-prefixes -arch armv7 -Wall -Werror -Wextra -Wimplicit-fallthrough -Wthread-safety -Wunguarded-availability -Wundeclared-selector -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-user-defined-warnings -Wno-unused-lambda-capture -Wno-null-pointer-arithmetic -Wno-enum-compare-switch -Wno-ignored-pragma-optimize -Oz -fno-omit-frame-pointer -gdwarf-2 -isysroot /b/c/xcode_ios_10l221o.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk -stdlib=libc++ -miphoneos-version-min=10.0 -fvisibility=hidden -Xclang -load -Xclang ../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang enforce-in-thirdparty-webkit -Xclang -plugin-arg-find-bad-constructs -Xclang check-enum-max-value -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wno-inconsistent-missing-override -std=c++14 -fobjc-call-cxx-cdtors -Wobjc-missing-property-synthesis -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -fobjc-arc -c ../../ios/chrome/browser/ssl/ios_ssl_error_handler_unittest.mm -o obj/ios/chrome/browser/ssl/unit_tests/ios_ssl_error_handler_unittest.o
../../ios/chrome/browser/ssl/ios_ssl_error_handler_unittest.mm:50:26: error: @protocol is using a forward protocol declaration of 'CaptivePortalDetectorTabHelperDelegate'
        mockForProtocol:@protocol(CaptivePortalDetectorTabHelperDelegate)];
                         ^
../../ios/chrome/browser/ssl/captive_portal_detector_tab_helper.h:10:11: note: 'CaptivePortalDetectorTabHelperDelegate' declared here
@protocol CaptivePortalDetectorTabHelperDelegate;
          ^
 
Labels: -Pri-3 M-70 Pri-1
Labels: -OS-Mac OS-iOS
Status: Started (was: Assigned)
Components: Mobile>WebView>Glue
Project Member

Comment 4 by bugdroid1@chromium.org, Aug 20

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

commit 3f4d6d880d73e4790c17e38a9cc781957a2f090c
Author: Mike Dougherty <michaeldo@chromium.org>
Date: Mon Aug 20 18:49:41 2018

Import CaptivePortalDetectorTabHelperDelegate for use in @protocol.

Bug:  875620 
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I3ae27d80eb08915ae57a83d3c50b14cf4551874b
Reviewed-on: https://chromium-review.googlesource.com/1181687
Reviewed-by: Eugene But <eugenebut@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584517}
[modify] https://crrev.com/3f4d6d880d73e4790c17e38a9cc781957a2f090c/ios/chrome/browser/ssl/ios_ssl_error_handler_unittest.mm

Status: Fixed (was: Started)

Sign in to add a comment