Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #import <Foundation/Foundation.h> | |
| 6 | |
| 7 extern "C" void __llvm_profile_set_filename(const char* name); | |
| 8 | |
| 9 namespace coverage_util { | |
| 10 | |
| 11 void SetupIfNecessary() { | |
| 12 #if !defined(NDEBUG) // && defined(ENABLE_TEST_CODE_COVERAGE) | |
|
baxley
2017/04/03 17:18:53
nit: do we want the commented out condition?
| |
| 13 static dispatch_once_t once_token; | |
| 14 dispatch_once(&once_token, ^{ | |
| 15 // Writes the profraw file to the Documents directory, where the app has | |
| 16 // write rights. | |
| 17 NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, | |
| 18 NSUserDomainMask, YES); | |
| 19 NSString* documents_directory = [paths firstObject]; | |
| 20 NSString* file_name = [documents_directory | |
| 21 stringByAppendingPathComponent:@"coverage.profraw"]; | |
| 22 | |
| 23 // For documentation, see: | |
| 24 // http://clang.llvm.org/docs/SourceBasedCodeCoverage.html | |
| 25 __llvm_profile_set_filename([file_name UTF8String]); | |
| 26 | |
| 27 // Print the path for easier retrieval. | |
| 28 NSLog(@"Coverage data at %@.", file_name); | |
| 29 }); | |
| 30 #endif | |
| 31 } | |
| 32 | |
| 33 } // namespace coverage_util | |
| OLD | NEW |