Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceIntrinsics.cpp - Functions related to intrinsics ----===// | 1 //===- subzero/src/IceIntrinsics.cpp - Functions related to intrinsics ----===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 | 229 |
| 230 Intrinsics::~Intrinsics() = default; | 230 Intrinsics::~Intrinsics() = default; |
| 231 | 231 |
| 232 const Intrinsics::FullIntrinsicInfo *Intrinsics::find(const IceString &Name, | 232 const Intrinsics::FullIntrinsicInfo *Intrinsics::find(const IceString &Name, |
| 233 bool &Error) const { | 233 bool &Error) const { |
| 234 static const char LLVMPrefix[] = "llvm."; | 234 static const char LLVMPrefix[] = "llvm."; |
| 235 const size_t LLVMPrefixLen = strlen(LLVMPrefix); | 235 const size_t LLVMPrefixLen = strlen(LLVMPrefix); |
| 236 Error = false; | 236 Error = false; |
| 237 if (Name.substr(0, LLVMPrefixLen) != LLVMPrefix) | 237 if (Name.substr(0, LLVMPrefixLen) != LLVMPrefix) |
| 238 return nullptr; | 238 return nullptr; |
| 239 IceString NameSuffix = Name.substr(LLVMPrefixLen); | 239 const IceString NameSuffix = Name.substr(LLVMPrefixLen); |
|
John
2016/03/06 22:39:38
Reference?
Jim Stichnoth
2016/03/07 00:03:10
std::string::substr() returns a newly constructed
John
2016/03/07 16:41:08
same comment about const reference. :)
| |
| 240 auto it = Map.find(NameSuffix); | 240 auto it = Map.find(NameSuffix); |
| 241 if (it == Map.end()) { | 241 if (it == Map.end()) { |
| 242 Error = true; | 242 Error = true; |
| 243 return nullptr; | 243 return nullptr; |
| 244 } | 244 } |
| 245 return &it->second; | 245 return &it->second; |
| 246 } | 246 } |
| 247 | 247 |
| 248 namespace { | 248 namespace { |
| 249 | 249 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 return Intrinsics::IsValidCall; | 337 return Intrinsics::IsValidCall; |
| 338 } | 338 } |
| 339 | 339 |
| 340 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { | 340 Type Intrinsics::FullIntrinsicInfo::getArgType(SizeT Index) const { |
| 341 assert(NumTypes > 1); | 341 assert(NumTypes > 1); |
| 342 assert(Index + 1 < NumTypes); | 342 assert(Index + 1 < NumTypes); |
| 343 return Signature[Index + 1]; | 343 return Signature[Index + 1]; |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // end of namespace Ice | 346 } // end of namespace Ice |
| OLD | NEW |