Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: tools/gn/source_file_type.cc

Issue 440333002: Support more configurability in GN toolchains (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unsigned check Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/source_file_type.h ('k') | tools/gn/string_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/source_file_type.cc
diff --git a/tools/gn/source_file_type.cc b/tools/gn/source_file_type.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b58ecb372f326961a037da774d0d02329ae8a447
--- /dev/null
+++ b/tools/gn/source_file_type.cc
@@ -0,0 +1,31 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tools/gn/source_file_type.h"
+
+#include "tools/gn/filesystem_utils.h"
+#include "tools/gn/source_file.h"
+
+SourceFileType GetSourceFileType(const SourceFile& file) {
+ base::StringPiece extension = FindExtension(&file.value());
+ if (extension == "cc" || extension == "cpp" || extension == "cxx")
+ return SOURCE_CC;
+ if (extension == "h")
+ return SOURCE_H;
+ if (extension == "c")
+ return SOURCE_C;
+ if (extension == "m")
+ return SOURCE_M;
+ if (extension == "mm")
+ return SOURCE_MM;
+ if (extension == "rc")
+ return SOURCE_RC;
+ if (extension == "S" || extension == "s")
+ return SOURCE_S;
+ if (extension == "o" || extension == "obj")
+ return SOURCE_O;
+
+ return SOURCE_UNKNOWN;
+}
+
« no previous file with comments | « tools/gn/source_file_type.h ('k') | tools/gn/string_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698