Commits

Doug Gregor committed de635a8cd91
Implement the 'warn_unused_result' attribute. @warn_unused_result can be attached to function declarations to produce a warning if the function is called but its result is not used. It has two optional parameters that can be placed in parentheses: message="some message": a message to include with the warning. mutable_variant="somedecl": the name of the mutable variant of the method that should be suggested when the subject method is called on a mutable value. The specific use we're implementing this for now is for the mutating and in-place operations. For example: @warn_unused_result(mutable_variant="sortInPlace") func sort() -> [Generator.Element] { ... } mutating func sortInPlace() { ... } Translate Clang's __attribute__((warn_unused_result)) into @warn_unused_result. Implements rdar://problem/18165189. Swift SVN r28019