Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / tools / gn / source_file_type.cc
blob35c87098290b556f75bd601337f55a818824b264
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "tools/gn/source_file_type.h"
7 #include "tools/gn/filesystem_utils.h"
8 #include "tools/gn/source_file.h"
10 SourceFileType GetSourceFileType(const SourceFile& file) {
11 base::StringPiece extension = FindExtension(&file.value());
12 if (extension == "cc" || extension == "cpp" || extension == "cxx")
13 return SOURCE_CC;
14 if (extension == "h")
15 return SOURCE_H;
16 if (extension == "c")
17 return SOURCE_C;
18 if (extension == "m")
19 return SOURCE_M;
20 if (extension == "mm")
21 return SOURCE_MM;
22 if (extension == "rc")
23 return SOURCE_RC;
24 if (extension == "S" || extension == "s" || extension == "asm")
25 return SOURCE_S;
26 if (extension == "o" || extension == "obj")
27 return SOURCE_O;
29 return SOURCE_UNKNOWN;