Summary: Weaknesses to be resolved in the following diffs Reviewed By: skcho Differential Revision: D26315739 fbshipit-source-id: 942a981bdmaster
parent
3593e41de1
commit
f6f47cd7c9
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef struct MSpec_t {
|
||||
const char* fileName;
|
||||
} MSpec;
|
||||
|
||||
#define SPEC_FILE_NAME(name) .fileName = (name),
|
||||
|
||||
static const MSpec mSpecs[] = {
|
||||
{SPEC_FILE_NAME("api")},
|
||||
{SPEC_FILE_NAME("graph")},
|
||||
{SPEC_FILE_NAME("disk")},
|
||||
{SPEC_FILE_NAME("io")},
|
||||
};
|
||||
|
||||
void const_struct_field_read_constant_FP() {
|
||||
MSpec spec = mSpecs[0];
|
||||
NSString* fileName =
|
||||
@(spec.fileName); // filename is constant, so this should be O(1)
|
||||
}
|
||||
|
||||
void loop_array_struct_constant() {
|
||||
const MSpec* const endSpec = ((const MSpec*)mSpecs) + ARRAY_COUNT(mSpecs);
|
||||
for (const MSpec* spec = (const MSpec*)mSpecs; spec < endSpec; spec++) {
|
||||
}
|
||||
}
|
Loading…
Reference in new issue