kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/proto/metadata.proto (about) 1 /* 2 * Copyright 2019 The Kythe Authors. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 syntax = "proto3"; 17 18 package kythe.proto.metadata; 19 20 option go_package = "kythe.io/kythe/proto/metadata_go_proto"; 21 option java_package = "com.google.devtools.kythe.proto"; 22 23 import "kythe/proto/storage.proto"; 24 25 // Schema for the JSON-encoded Kythe metadata describing the relationship 26 // between source and target code for generated code. 27 message GeneratedCodeInfo { 28 enum Type { 29 NONE = 0; 30 KYTHE0 = 1; // Initial metadata document type. 31 } 32 33 Type type = 1; 34 repeated MappingRule meta = 2; // Only relevant if type == kythe0. 35 } 36 37 // Metadata for a single mapping between a generated source range and a node 38 // in the source language or file. 39 message MappingRule { 40 enum Type { 41 NONE = 0; 42 NOP = 1; // Dummy rule that contains no relevant information. 43 ANCHOR_DEFINES = 2; // Rule describing a generates edge between target 44 // range and source definition. 45 ANCHOR_ANCHOR = 3; // Rule describing an imputes edge between target range 46 // and source range. 47 FILE_DEFINES = 4; // Rule describing a generates edge between 48 // `source_vname` and the described file. Offsets are 49 // ignored. 50 } 51 52 Type type = 1; 53 // If type == anchor_defines, this should generally be a reverse generates 54 // edge, %/kythe/edge/generates, indicating that the specified vname generated 55 // the source range. 56 // If type == anchor_anchor, this should generally be a forward imputes edge, 57 // /kythe/edge/imputes, indicating that the range in the source file produced 58 // the text in the target file. 59 // If semantic is not NONE, this field is ignored and the identified 60 // declaration at the indicated text range is given the associated semantic. 61 string edge = 2; 62 63 // Fields only relevant if type == anchor_defines. 64 kythe.proto.VName vname = 3; // The semantic node in the source language 65 // which generated the text range. 66 uint32 begin = 4; // Beginning of the range to match in the generated text. 67 uint32 end = 5; // End of the range to match in the generated text. 68 69 enum Semantic { 70 SEMA_NONE = 0; 71 SEMA_WRITE = 1; 72 SEMA_READ_WRITE = 2; 73 SEMA_TAKE_ALIAS = 3; 74 }; 75 76 Semantic semantic = 11; 77 78 // Fields only relevant if type == anchor_anchor or type == file_defines. 79 kythe.proto.VName source_vname = 80 6; // Anchor node in the generating source file. 81 // Note: the signature in this vname, if present, 82 // will typically be replaced by the target indexer 83 // using its own anchor-construction rules based on 84 // source_begin and source_end. 85 uint32 source_begin = 7; // loc/start of the anchor node in the source file. 86 uint32 source_end = 8; // loc/end of the anchor node in the source file. 87 uint32 target_begin = 9; // Start of the range in the generated text. 88 uint32 target_end = 10; // End of the range in the generated text. 89 }