Merge pull request #24336 from ravikandhadai/oslog-optimization

[SIL Optimization] Add a mandatory pass for optimizing the new os log APIs based on string interpolation.
This commit is contained in:
ravikandhadai
2019-05-14 11:18:32 -07:00
committed by GitHub
10 changed files with 1030 additions and 1 deletions

View File

@@ -470,6 +470,27 @@ NOTE(switch_value_case_doesnt_yield, none, "missing yield in the %0 case",
NOTE(try_branch_doesnt_yield, none, "missing yield when error is "
"%select{not |}0thrown", (bool))
// OS log optimization dianostics.
ERROR(oslog_message_argument_not_found, none, "no argument of type %0 in "
" the os log call", (Identifier))
ERROR(oslog_dynamic_message, none, "os log methods must be passed a string "
"interpolation literal. 'OSLogMessage' must not be constructed explicitly",
())
ERROR(oslog_const_evaluation_error, none, "constant evaluating 'OSLogMessage'"
"implementation failed.", ())
ERROR(oslog_non_constant_message, none, "'OSLogMessage' struct is "
"unoptimizable: 'init' is not constant evaluable", ())
ERROR(oslog_non_constant_interpolation, none, "'OSLogInterpolation' struct is "
"unoptimizable: 'init' is not constant evaluable", ())
ERROR(oslog_property_not_constant, none, "'OSLogInterpolation.%0' is not a "
"constant: formatting and privacy options must be literals", (StringRef))
#ifndef DIAG_NO_UNDEF
# if defined(DIAG)
# undef DIAG

View File

@@ -178,6 +178,9 @@ IDENTIFIER_(ErrorType)
IDENTIFIER(Code)
IDENTIFIER_(nsError)
// Custom string interpolation type used by os log APIs.
IDENTIFIER(OSLogMessage)
#undef IDENTIFIER
#undef IDENTIFIER_
#undef IDENTIFIER_WITH_NAME

View File

@@ -309,6 +309,7 @@ PASS(SerializeSILPass, "serialize-sil",
"Utility pass. Serializes the current SILModule")
PASS(YieldOnceCheck, "yield-once-check",
"Check correct usage of yields in yield-once coroutines")
PASS(OSLogOptimization, "os-log-optimization", "Optimize os log calls")
PASS(BugReducerTester, "bug-reducer-tester",
"sil-bug-reducer Tool Testing by Asserting on a Sentinel Function")
PASS_RANGE(AllPasses, AADumper, BugReducerTester)