Commit 8db77a10 authored by Yuke Liao's avatar Yuke Liao Committed by Commit Bot

Revert "[GN] Remove a duplication of a source type check"

This reverts commit 844a031c.

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/747087Reviewed-by: default avatarYuke Liao <liaoyuke@chromium.org>
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512888}
parent bca10ee4
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "tools/gn/filesystem_utils.h" #include "tools/gn/filesystem_utils.h"
#include "tools/gn/source_file.h"
#include "tools/gn/source_file_type.h"
// Helper methods ------------------------------------------------------------- // Helper methods -------------------------------------------------------------
...@@ -155,10 +153,9 @@ bool HasExplicitFileType(const base::StringPiece& ext) { ...@@ -155,10 +153,9 @@ bool HasExplicitFileType(const base::StringPiece& ext) {
return ext == "dart"; return ext == "dart";
} }
bool IsSourceFileForIndexing(const SourceFile& src) { bool IsSourceFileForIndexing(const base::StringPiece& ext) {
const SourceFileType type = GetSourceFileType(src); return ext == "c" || ext == "cc" || ext == "cpp" || ext == "cxx" ||
return type == SOURCE_C || type == SOURCE_CPP || type == SOURCE_M || ext == "m" || ext == "mm";
type == SOURCE_MM;
} }
void PrintValue(std::ostream& out, IndentRules rules, unsigned value) { void PrintValue(std::ostream& out, IndentRules rules, unsigned value) {
...@@ -695,7 +692,8 @@ void PBXProject::AddSourceFile(const std::string& navigator_path, ...@@ -695,7 +692,8 @@ void PBXProject::AddSourceFile(const std::string& navigator_path,
PBXNativeTarget* target) { PBXNativeTarget* target) {
PBXFileReference* file_reference = PBXFileReference* file_reference =
sources_->AddSourceFile(navigator_path, source_path); sources_->AddSourceFile(navigator_path, source_path);
if (!IsSourceFileForIndexing(SourceFile(source_path))) base::StringPiece ext = FindExtension(&source_path);
if (!IsSourceFileForIndexing(ext))
return; return;
DCHECK(target); DCHECK(target);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment