Skip to content

Commit 2919e1a

Browse files
author
git apple-llvm automerger
committed
Merge commit 'ade3acc17ce5' from apple/stable/20200714 into swift/main
2 parents 8300508 + 0376c64 commit 2919e1a

File tree

10 files changed

+61
-1426
lines changed

10 files changed

+61
-1426
lines changed

clang/lib/CodeGen/CGCall.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,6 +1797,14 @@ void CodeGenModule::getDefaultFunctionAttributes(StringRef Name,
17971797
FuncAttrs.addAttribute("stackrealign");
17981798
if (CodeGenOpts.Backchain)
17991799
FuncAttrs.addAttribute("backchain");
1800+
if (CodeGenOpts.PointerAuth.ReturnAddresses)
1801+
FuncAttrs.addAttribute("ptrauth-returns");
1802+
if (CodeGenOpts.PointerAuth.FunctionPointers)
1803+
FuncAttrs.addAttribute("ptrauth-calls");
1804+
if (CodeGenOpts.PointerAuth.IndirectGotos)
1805+
FuncAttrs.addAttribute("ptrauth-indirect-gotos");
1806+
if (CodeGenOpts.PointerAuth.AuthTraps)
1807+
FuncAttrs.addAttribute("ptrauth-auth-traps");
18001808
if (CodeGenOpts.EnableSegmentedStacks)
18011809
FuncAttrs.addAttribute("split-stack");
18021810

clang/lib/CodeGen/CGObjCGNU.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3501,19 +3501,6 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
35013501
ClassMethods.insert(ClassMethods.begin(), OID->classmeth_begin(),
35023502
OID->classmeth_end());
35033503

3504-
// Collect the same information about synthesized properties, which don't
3505-
// show up in the instance method lists.
3506-
for (auto *propertyImpl : OID->property_impls())
3507-
if (propertyImpl->getPropertyImplementation() ==
3508-
ObjCPropertyImplDecl::Synthesize) {
3509-
auto addPropertyMethod = [&](const ObjCMethodDecl *accessor) {
3510-
if (accessor)
3511-
InstanceMethods.push_back(accessor);
3512-
};
3513-
addPropertyMethod(propertyImpl->getGetterMethodDecl());
3514-
addPropertyMethod(propertyImpl->getSetterMethodDecl());
3515-
}
3516-
35173504
llvm::Constant *Properties = GeneratePropertyList(OID, ClassDecl);
35183505

35193506
// Collect the names of referenced protocols
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -S -emit-llvm -fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s -check-prefix=CHECK-NEW
2+
// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -S -emit-llvm -fobjc-runtime=gnustep-1.8 -o - %s | FileCheck %s -check-prefix=CHECK-OLD
3+
4+
// Clang 9 or 10 changed the handling of method lists so that methods provided
5+
// from synthesised properties showed up in the method list, where previously
6+
// CGObjCGNU had to collect them and merge them. One of the places where this
7+
// merging happened was missed in the move and so we ended up emitting two
8+
// copies of method metadata for declared properties.
9+
10+
// This class has only instance properties and only one pair of synthesized
11+
// methods from the property and so we should synthesize only one method list,
12+
// with precisely two methods on it.
13+
@interface X
14+
@property (retain) id iProp;
15+
@end
16+
17+
@implementation X
18+
@synthesize iProp;
19+
@end
20+
21+
// Check that the method list has precisely 2 methods.
22+
// CHECK-NEW: @.objc_method_list = internal global { i8*, i32, i64, [2 x
23+
// CHECK-OLD: @.objc_method_list = internal global { i8*, i32, [2 x

lldb/examples/python/symbolication.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,18 +437,22 @@ def create_target(self, debugger):
437437

438438
class Symbolicator:
439439

440-
def __init__(self, debugger):
441-
"""A class the represents the information needed to symbolicate addresses in a program"""
440+
def __init__(self, debugger=None, target=None, images=list()):
441+
"""A class the represents the information needed to symbolicate
442+
addresses in a program.
443+
444+
Do not call this initializer directly, but rather use the factory
445+
methods.
446+
"""
442447
self.debugger = debugger
443-
self.target = None
444-
self.images = list() # a list of images to be used when symbolicating
448+
self.target = target
449+
self.images = images # a list of images to be used when symbolicating
445450
self.addr_mask = 0xffffffffffffffff
446451

447452
@classmethod
448453
def InitWithSBTarget(cls, target):
449-
obj = cls()
450-
obj.target = target
451-
obj.images = list()
454+
"""Initialize a new Symbolicator with an existing SBTarget."""
455+
obj = cls(target=target)
452456
triple = target.triple
453457
if triple:
454458
arch = triple.split('-')[0]
@@ -460,6 +464,13 @@ def InitWithSBTarget(cls, target):
460464
obj.images.append(image)
461465
return obj
462466

467+
@classmethod
468+
def InitWithSBDebugger(cls, debugger, images):
469+
"""Initialize a new Symbolicator with an existing debugger and list of
470+
images. The Symbolicator will create the target."""
471+
obj = cls(debugger=debugger, images=images)
472+
return obj
473+
463474
def __str__(self):
464475
s = "Symbolicator:\n"
465476
if self.target:

lldb/packages/Python/lldbsuite/test/decorators.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from . import configuration
2020
from . import test_categories
2121
from . import lldbtest_config
22-
from lldbsuite.test_event.event_builder import EventBuilder
2322
from lldbsuite.support import funcutils
2423
from lldbsuite.test import lldbplatform
2524
from lldbsuite.test import lldbplatformutil
@@ -441,21 +440,11 @@ def expectedFailureNetBSD(bugnumber=None):
441440
['netbsd'],
442441
bugnumber)
443442

444-
# Flakey tests get two chances to run. If they fail the first time round, the result formatter
445-
# makes sure it is run one more time.
446-
447-
443+
# TODO: This decorator does not do anything. Remove it.
448444
def expectedFlakey(expected_fn, bugnumber=None):
449445
def expectedFailure_impl(func):
450446
@wraps(func)
451447
def wrapper(*args, **kwargs):
452-
self = args[0]
453-
if expected_fn(self):
454-
# Send event marking test as explicitly eligible for rerunning.
455-
if configuration.results_formatter_object is not None:
456-
# Mark this test as rerunnable.
457-
configuration.results_formatter_object.handle_event(
458-
EventBuilder.event_for_mark_test_rerun_eligible(self))
459448
func(*args, **kwargs)
460449
return wrapper
461450
# Some decorators can be called both with no arguments (e.g. @expectedFailureWindows)

lldb/packages/Python/lldbsuite/test/dotest.py

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@
4444
from . import dotest_args
4545
from . import lldbtest_config
4646
from . import test_categories
47-
from lldbsuite.test_event import formatter
4847
from . import test_result
49-
from lldbsuite.test_event.event_builder import EventBuilder
5048
from ..support import seven
5149

5250

@@ -459,26 +457,6 @@ def parseOptionsAndInitTestdirs():
459457
lldbtest_config.codesign_identity = args.codesign_identity
460458

461459

462-
def setupTestResults():
463-
"""Sets up test results-related objects based on arg settings."""
464-
465-
# Create the results formatter.
466-
formatter_spec = formatter.create_results_formatter(
467-
"lldbsuite.test_event.formatter.results_formatter.ResultsFormatter")
468-
if formatter_spec is not None and formatter_spec.formatter is not None:
469-
configuration.results_formatter_object = formatter_spec.formatter
470-
471-
# Send an initialize message to the formatter.
472-
initialize_event = EventBuilder.bare_event("initialize")
473-
initialize_event["worker_count"] = 1
474-
475-
formatter_spec.formatter.handle_event(initialize_event)
476-
477-
# Make sure we clean up the formatter on shutdown.
478-
if formatter_spec.cleanup_func is not None:
479-
atexit.register(formatter_spec.cleanup_func)
480-
481-
482460
def setupSysPath():
483461
"""
484462
Add LLDB.framework/Resources/Python to the search paths for modules.
@@ -695,31 +673,17 @@ def visit(prefix, dir, names):
695673

696674
# Visit all the python test files.
697675
for name in python_test_files:
698-
try:
699-
# Ensure we error out if we have multiple tests with the same
700-
# base name.
701-
# Future improvement: find all the places where we work with base
702-
# names and convert to full paths. We have directory structure
703-
# to disambiguate these, so we shouldn't need this constraint.
704-
if name in configuration.all_tests:
705-
raise Exception("Found multiple tests with the name %s" % name)
706-
configuration.all_tests.add(name)
707-
708-
# Run the relevant tests in the python file.
709-
visit_file(dir, name)
710-
except Exception as ex:
711-
# Convert this exception to a test event error for the file.
712-
test_filename = os.path.abspath(os.path.join(dir, name))
713-
if configuration.results_formatter_object is not None:
714-
# Grab the backtrace for the exception.
715-
import traceback
716-
backtrace = traceback.format_exc()
717-
718-
# Generate the test event.
719-
configuration.results_formatter_object.handle_event(
720-
EventBuilder.event_for_job_test_add_error(
721-
test_filename, ex, backtrace))
722-
raise
676+
# Ensure we error out if we have multiple tests with the same
677+
# base name.
678+
# Future improvement: find all the places where we work with base
679+
# names and convert to full paths. We have directory structure
680+
# to disambiguate these, so we shouldn't need this constraint.
681+
if name in configuration.all_tests:
682+
raise Exception("Found multiple tests with the name %s" % name)
683+
configuration.all_tests.add(name)
684+
685+
# Run the relevant tests in the python file.
686+
visit_file(dir, name)
723687

724688

725689
# ======================================== #
@@ -887,9 +851,6 @@ def run_suite():
887851
#
888852
parseOptionsAndInitTestdirs()
889853

890-
# Setup test results (test results formatter and output handling).
891-
setupTestResults()
892-
893854
setupSysPath()
894855

895856
import lldbconfig

lldb/packages/Python/lldbsuite/test/test_result.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
# LLDB Modules
1717
from . import configuration
18-
from lldbsuite.test_event.event_builder import EventBuilder
1918
from lldbsuite.test_event import build_exception
2019

2120

@@ -72,7 +71,6 @@ def __init__(self, *args):
7271
# This counts from 1 .. suite.countTestCases().
7372
self.counter = 0
7473
(width, height) = LLDBTestResult.getTerminalSize()
75-
self.results_formatter = configuration.results_formatter_object
7674

7775
def _config_string(self, test):
7876
compiler = getattr(test, "getCompiler", None)
@@ -181,9 +179,6 @@ def startTest(self, test):
181179
if self.showAll:
182180
self.stream.write(self.fmt % self.counter)
183181
super(LLDBTestResult, self).startTest(test)
184-
if self.results_formatter:
185-
self.results_formatter.handle_event(
186-
EventBuilder.event_for_start(test))
187182

188183
def addSuccess(self, test):
189184
if (self.checkExclusion(
@@ -197,9 +192,6 @@ def addSuccess(self, test):
197192
self.stream.write(
198193
"PASS: LLDB (%s) :: %s\n" %
199194
(self._config_string(test), str(test)))
200-
if self.results_formatter:
201-
self.results_formatter.handle_event(
202-
EventBuilder.event_for_success(test))
203195

204196
def _isBuildError(self, err_tuple):
205197
exception = err_tuple[1]
@@ -228,13 +220,6 @@ def addError(self, test, err):
228220
self.stream.write(
229221
"FAIL: LLDB (%s) :: %s\n" %
230222
(self._config_string(test), str(test)))
231-
if self.results_formatter:
232-
# Handle build errors as a separate event type
233-
if self._isBuildError(err):
234-
error_event = EventBuilder.event_for_build_error(test, err)
235-
else:
236-
error_event = EventBuilder.event_for_error(test, err)
237-
self.results_formatter.handle_event(error_event)
238223

239224
def addCleanupError(self, test, err):
240225
configuration.sdir_has_content = True
@@ -245,10 +230,6 @@ def addCleanupError(self, test, err):
245230
self.stream.write(
246231
"CLEANUP ERROR: LLDB (%s) :: %s\n" %
247232
(self._config_string(test), str(test)))
248-
if self.results_formatter:
249-
self.results_formatter.handle_event(
250-
EventBuilder.event_for_cleanup_error(
251-
test, err))
252233

253234
def addFailure(self, test, err):
254235
if (self.checkExclusion(
@@ -274,9 +255,6 @@ def addFailure(self, test, err):
274255
category] = configuration.failures_per_category[category] + 1
275256
else:
276257
configuration.failures_per_category[category] = 1
277-
if self.results_formatter:
278-
self.results_formatter.handle_event(
279-
EventBuilder.event_for_failure(test, err))
280258

281259
def addExpectedFailure(self, test, err, bugnumber):
282260
configuration.sdir_has_content = True
@@ -287,10 +265,6 @@ def addExpectedFailure(self, test, err, bugnumber):
287265
self.stream.write(
288266
"XFAIL: LLDB (%s) :: %s\n" %
289267
(self._config_string(test), str(test)))
290-
if self.results_formatter:
291-
self.results_formatter.handle_event(
292-
EventBuilder.event_for_expected_failure(
293-
test, err, bugnumber))
294268

295269
def addSkip(self, test, reason):
296270
configuration.sdir_has_content = True
@@ -301,9 +275,6 @@ def addSkip(self, test, reason):
301275
self.stream.write(
302276
"UNSUPPORTED: LLDB (%s) :: %s (%s) \n" %
303277
(self._config_string(test), str(test), reason))
304-
if self.results_formatter:
305-
self.results_formatter.handle_event(
306-
EventBuilder.event_for_skip(test, reason))
307278

308279
def addUnexpectedSuccess(self, test, bugnumber):
309280
configuration.sdir_has_content = True
@@ -314,7 +285,3 @@ def addUnexpectedSuccess(self, test, bugnumber):
314285
self.stream.write(
315286
"XPASS: LLDB (%s) :: %s\n" %
316287
(self._config_string(test), str(test)))
317-
if self.results_formatter:
318-
self.results_formatter.handle_event(
319-
EventBuilder.event_for_unexpected_success(
320-
test, bugnumber))

0 commit comments

Comments
 (0)