| ... | @@ -2857,7 +2857,7 @@ pub fn addCCArgs( | ... | @@ -2857,7 +2857,7 @@ pub fn addCCArgs( |
| 2857 | try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); | 2857 | try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); |
| 2858 | | 2858 | |
| 2859 | switch (ext) { | 2859 | switch (ext) { |
| 2860 | .c, .cpp, .h => { | 2860 | .c, .cpp, .m, .h => { |
| 2861 | try argv.appendSlice(&[_][]const u8{ | 2861 | try argv.appendSlice(&[_][]const u8{ |
| 2862 | "-nostdinc", | 2862 | "-nostdinc", |
| 2863 | "-fno-spell-checking", | 2863 | "-fno-spell-checking", |
| ... | @@ -3148,6 +3148,7 @@ pub const FileExt = enum { | ... | @@ -3148,6 +3148,7 @@ pub const FileExt = enum { |
| 3148 | c, | 3148 | c, |
| 3149 | cpp, | 3149 | cpp, |
| 3150 | h, | 3150 | h, |
| | 3151 | m, |
| 3151 | ll, | 3152 | ll, |
| 3152 | bc, | 3153 | bc, |
| 3153 | assembly, | 3154 | assembly, |
| ... | @@ -3159,7 +3160,7 @@ pub const FileExt = enum { | ... | @@ -3159,7 +3160,7 @@ pub const FileExt = enum { |
| 3159 | | 3160 | |
| 3160 | pub fn clangSupportsDepFile(ext: FileExt) bool { | 3161 | pub fn clangSupportsDepFile(ext: FileExt) bool { |
| 3161 | return switch (ext) { | 3162 | return switch (ext) { |
| 3162 | .c, .cpp, .h => true, | 3163 | .c, .cpp, .h, .m => true, |
| 3163 | | 3164 | |
| 3164 | .ll, | 3165 | .ll, |
| 3165 | .bc, | 3166 | .bc, |
| ... | @@ -3193,6 +3194,10 @@ pub fn hasCppExt(filename: []const u8) bool { | ... | @@ -3193,6 +3194,10 @@ pub fn hasCppExt(filename: []const u8) bool { |
| 3193 | mem.endsWith(u8, filename, ".cxx"); | 3194 | mem.endsWith(u8, filename, ".cxx"); |
| 3194 | } | 3195 | } |
| 3195 | | 3196 | |
| | 3197 | pub fn hasObjCExt(filename: []const u8) bool { |
| | 3198 | return mem.endsWith(u8, filename, ".m"); |
| | 3199 | } |
| | 3200 | |
| 3196 | pub fn hasAsmExt(filename: []const u8) bool { | 3201 | pub fn hasAsmExt(filename: []const u8) bool { |
| 3197 | return mem.endsWith(u8, filename, ".s") or mem.endsWith(u8, filename, ".S"); | 3202 | return mem.endsWith(u8, filename, ".s") or mem.endsWith(u8, filename, ".S"); |
| 3198 | } | 3203 | } |
| ... | @@ -3229,6 +3234,8 @@ pub fn classifyFileExt(filename: []const u8) FileExt { | ... | @@ -3229,6 +3234,8 @@ pub fn classifyFileExt(filename: []const u8) FileExt { |
| 3229 | return .c; | 3234 | return .c; |
| 3230 | } else if (hasCppExt(filename)) { | 3235 | } else if (hasCppExt(filename)) { |
| 3231 | return .cpp; | 3236 | return .cpp; |
| | 3237 | } else if (hasObjCExt(filename)) { |
| | 3238 | return .m; |
| 3232 | } else if (mem.endsWith(u8, filename, ".ll")) { | 3239 | } else if (mem.endsWith(u8, filename, ".ll")) { |
| 3233 | return .ll; | 3240 | return .ll; |
| 3234 | } else if (mem.endsWith(u8, filename, ".bc")) { | 3241 | } else if (mem.endsWith(u8, filename, ".bc")) { |
| ... | @@ -3252,6 +3259,7 @@ pub fn classifyFileExt(filename: []const u8) FileExt { | ... | @@ -3252,6 +3259,7 @@ pub fn classifyFileExt(filename: []const u8) FileExt { |
| 3252 | | 3259 | |
| 3253 | test "classifyFileExt" { | 3260 | test "classifyFileExt" { |
| 3254 | try std.testing.expectEqual(FileExt.cpp, classifyFileExt("foo.cc")); | 3261 | try std.testing.expectEqual(FileExt.cpp, classifyFileExt("foo.cc")); |
| | 3262 | try std.testing.expectEqual(FileExt.m, classifyFileExt("foo.m")); |
| 3255 | try std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.nim")); | 3263 | try std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.nim")); |
| 3256 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so")); | 3264 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so")); |
| 3257 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1")); | 3265 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1")); |