Revert "[GN] Remove a duplication of a source type check"
This reverts commit 844a031c63c6ec1123da1b5b0caa97958679ddf5.
Reason for revert: This CL causes failures when generating Xcode project on iOS platform, please see comments inline.
Original change's description:
> [GN] Remove a duplication of a source type check
>
> There was a duplication of the source type checking. It may lead
> errors when a type set will be changed for a language.
>
> R=​dpranke@chromium.org
>
> Bug: None
> Change-Id: Ieab8885899446e625cfe20c1650418a085b937ee
> Reviewed-on: https://chromium-review.googlesource.com/702414
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> Commit-Queue: Dirk Pranke <dpranke@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#506763}
TBR=dpranke@chromium.org,vladbelov@yandex-team.ru
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: None
Change-Id: I5dd0a68f9dd9ac1edd6b94e248bdf5959f83b3ab
Reviewed-on: https://chromium-review.googlesource.com/747087
Reviewed-by: Yuke Liao <liaoyuke@chromium.org>
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#512888}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 8db77a10a3b90ef4f079ca1442cd9f6064ad214f
diff --git a/tools/gn/xcode_object.cc b/tools/gn/xcode_object.cc
index 9d8e791..8a31470 100644
--- a/tools/gn/xcode_object.cc
+++ b/tools/gn/xcode_object.cc
@@ -13,8 +13,6 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "tools/gn/filesystem_utils.h"
-#include "tools/gn/source_file.h"
-#include "tools/gn/source_file_type.h"
// Helper methods -------------------------------------------------------------
@@ -155,10 +153,9 @@
return ext == "dart";
}
-bool IsSourceFileForIndexing(const SourceFile& src) {
- const SourceFileType type = GetSourceFileType(src);
- return type == SOURCE_C || type == SOURCE_CPP || type == SOURCE_M ||
- type == SOURCE_MM;
+bool IsSourceFileForIndexing(const base::StringPiece& ext) {
+ return ext == "c" || ext == "cc" || ext == "cpp" || ext == "cxx" ||
+ ext == "m" || ext == "mm";
}
void PrintValue(std::ostream& out, IndentRules rules, unsigned value) {
@@ -695,7 +692,8 @@
PBXNativeTarget* target) {
PBXFileReference* file_reference =
sources_->AddSourceFile(navigator_path, source_path);
- if (!IsSourceFileForIndexing(SourceFile(source_path)))
+ base::StringPiece ext = FindExtension(&source_path);
+ if (!IsSourceFileForIndexing(ext))
return;
DCHECK(target);