| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tools/gn/ninja_helper.h" | 5 #include "tools/gn/ninja_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "tools/gn/filesystem_utils.h" | 8 #include "tools/gn/filesystem_utils.h" |
| 9 #include "tools/gn/string_utils.h" | 9 #include "tools/gn/string_utils.h" |
| 10 #include "tools/gn/target.h" | 10 #include "tools/gn/target.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 SourceFileType type) const { | 205 SourceFileType type) const { |
| 206 // This function may be hot since it will be called for every source file | 206 // This function may be hot since it will be called for every source file |
| 207 // in the tree. We could cache the results to avoid making a string for | 207 // in the tree. We could cache the results to avoid making a string for |
| 208 // every invocation. | 208 // every invocation. |
| 209 std::string prefix = GetRulePrefix(settings); | 209 std::string prefix = GetRulePrefix(settings); |
| 210 | 210 |
| 211 if (type == SOURCE_C) | 211 if (type == SOURCE_C) |
| 212 return prefix + "cc"; | 212 return prefix + "cc"; |
| 213 if (type == SOURCE_CC) | 213 if (type == SOURCE_CC) |
| 214 return prefix + "cxx"; | 214 return prefix + "cxx"; |
| 215 if (type == SOURCE_M) |
| 216 return prefix + "objc"; |
| 217 if (type == SOURCE_MM) |
| 218 return prefix + "objcxx"; |
| 219 if (type == SOURCE_RC) |
| 220 return prefix + "rc"; |
| 221 if (type == SOURCE_S) |
| 222 return prefix + "cc"; // Assembly files just get compiled by CC. |
| 215 | 223 |
| 216 // TODO(brettw) asm files. | 224 // TODO(brettw) asm files. |
| 217 | 225 |
| 218 if (settings->IsMac()) { | |
| 219 if (type == SOURCE_M) | |
| 220 return prefix + "objc"; | |
| 221 if (type == SOURCE_MM) | |
| 222 return prefix + "objcxx"; | |
| 223 } | |
| 224 | |
| 225 if (settings->IsWin()) { | |
| 226 if (type == SOURCE_RC) | |
| 227 return prefix + "rc"; | |
| 228 } else { | |
| 229 if (type == SOURCE_S) | |
| 230 return prefix + "cc"; // Assembly files just get compiled by CC. | |
| 231 } | |
| 232 | |
| 233 return std::string(); | 226 return std::string(); |
| 234 } | 227 } |
| OLD | NEW |