llvm.org GIT mirror llvm / 917365b
merge of r49785 (from branches/ggreif/use-diet): pass V to dyn_cast by const reference, this avoids copy-constructing and destructing all the time. especially important if these constructors are not accessible git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49787 91177308-0d34-0410-b5e6-96231b3b80d8 Gabor Greif 12 years ago
1 changed file(s) with 2 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
220220 //
221221
222222 template
223 inline typename cast_retty::ret_type dyn_cast(Y Val) {
223 inline typename cast_retty::ret_type dyn_cast(const Y &Val) {
224224 return isa(Val) ? cast(Val) : 0;
225225 }
226226
228228 // value is accepted.
229229 //
230230 template
231 inline typename cast_retty::ret_type dyn_cast_or_null(Y Val) {
231 inline typename cast_retty::ret_type dyn_cast_or_null(const Y &Val) {
232232 return (Val && isa(Val)) ? cast(Val) : 0;
233233 }
234234