<commit_before>/*
Copyright 2013-present Barefoot Networks, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef _FRONTENDS_P4_EXTERNINSTANCE_H_
#define _FRONTENDS_P4_EXTERNINSTANCE_H_

#include <boost/optional.hpp>
#include "lib/cstring.h"

namespace IR {
class Expression;
class IAnnotated;
class Type_Extern;
class TypeMap;
template <typename T> class Vector;
}  // namespace IR

namespace P4 {

class ReferenceMap;
class TypeMap;

/**
 * ExternInstance is a utility class that allows you to gather information about
 * an expression that resolves to an extern instance.
 *
 * The name is in analogy to MethodInstance. It provides information about the
 * name of the extern instance, the underlying extern type, the arguments it was
 * instantiated with, and the annotations that we applied to it. It can gather
 * this information from either a reference to a named instance, or from an
 * expression which constructs an anonymous instance.
 */
struct ExternInstance final {
    const boost::optional<cstring> name;  // The instance's name, if any.
    const IR::Expression* expression;     // The original expression passed to resolve().<commit_msg>Add missing forward references for non-unified source build environments (#332)<commit_after>/*
Copyright 2013-present Barefoot Networks, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef _FRONTENDS_P4_EXTERNINSTANCE_H_
#define _FRONTENDS_P4_EXTERNINSTANCE_H_

#include <boost/optional.hpp>
#include "lib/cstring.h"

namespace IR {
class ConstructorCallExpression;
class Expression;
class IAnnotated;
class PathExpression;
class Type_Extern;
class TypeMap;
template <typename T> class Vector;
}  // namespace IR

namespace P4 {

class ReferenceMap;
class TypeMap;

/**
 * ExternInstance is a utility class that allows you to gather information about
 * an expression that resolves to an extern instance.
 *
 * The name is in analogy to MethodInstance. It provides information about the
 * name of the extern instance, the underlying extern type, the arguments it was
 * instantiated with, and the annotations that we applied to it. It can gather
 * this information from either a reference to a named instance, or from an
 * expression which constructs an anonymous instance.
 */
struct ExternInstance final {
    const boost::optional<cstring> name;  // The instance's name, if any.
    const IR::Expression* expression;     // The original expression passed to resolve().
{'fraction_non_alphanumeric': 0.061014960398943975, 'fraction_numerical': 0.007333528894103843, 'mean_word_length': 4.562805872756933, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4413874', 'n_tokens_mistral': 904, 'n_tokens_neox': 871, 'n_words': 436}