// // Copyright 2017 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // Symbol.h: Symbols representing variables, functions, structures and interface blocks. //
// Note that we can't have a virtual destructor in order to support constexpr symbols. Data is // either statically allocated or pool allocated.
~TSymbol() = default;
// Calling name() for empty symbols (symbolType == SymbolType::Empty) generates a similar name // as for internal variables.
ImmutableString name() const; // Don't call getMangledName() for empty symbols (symbolType == SymbolType::Empty).
ImmutableString getMangledName() const;
// We use this instead of having virtual functions for querying the class in order to support // constexpr symbols. const SymbolClass mSymbolClass : 4;
};
// Variable. // May store the value of a constant variable of any type (float, int, bool or struct). class TVariable : public TSymbol
{ public:
TVariable(TSymbolTable *symbolTable, const ImmutableString &name, const TType *type,
SymbolType symbolType,
TExtension ext = TExtension::UNDEFINED);
// Struct type. class TStructure : public TSymbol, public TFieldListCollection
{ public:
TStructure(TSymbolTable *symbolTable, const ImmutableString &name, const TFieldList *fields,
SymbolType symbolType);
// The char arrays passed in must be pool allocated or static. void createSamplerSymbols(constchar *namePrefix, const TString &apiNamePrefix,
TVector<const TVariable *> *outputSymbols,
TMap<const TVariable *, TString> *outputSymbolsToAPINames,
TSymbolTable *symbolTable) const;
// TODO(zmo): Find a way to get rid of the const_cast in function // setName(). At the moment keep this function private so only // friend class RegenerateStructNames may call it. friendclass RegenerateStructNamesTraverser; void setName(const ImmutableString &name);
bool mAtGlobalScope;
};
// Interface block. Note that this contains the block name, not the instance name. Interface block // instances are stored as TVariable. class TInterfaceBlock : public TSymbol, public TFieldListCollection
{ public:
TInterfaceBlock(TSymbolTable *symbolTable, const ImmutableString &name, const TFieldList *fields, const TLayoutQualifier &layoutQualifier,
SymbolType symbolType,
TExtension extension = TExtension::UNDEFINED);
// Note that we only record matrix packing on a per-field granularity.
};
// Parameter class used for parsing user-defined function parameters. struct TParameter
{ // Destructively converts to TVariable. // This method resets name and type to nullptrs to make sure // their content cannot be modified after the call. const TVariable *createVariable(TSymbolTable *symbolTable)
{ const ImmutableString constName(name); const TType *constType = type;
name = nullptr;
type = nullptr; returnnew TVariable(symbolTable, constName, constType,
constName.empty() ? SymbolType::Empty : SymbolType::UserDefined);
}
constchar *name; // either pool allocated or static.
TType *type;
};
// The function sub-class of a symbol. class TFunction : public TSymbol
{ public: // User-defined function
TFunction(TSymbolTable *symbolTable, const ImmutableString &name,
SymbolType symbolType, const TType *retType, bool knownToNotHaveSideEffects);
typedef TVector<const TVariable *> TParamVector;
TParamVector *mParametersVector; const TVariable *const *mParameters; const TType *const returnType; mutable ImmutableString mMangledName;
size_t mParamCount : 32; const TOperator mOp; // Only set for built-ins booldefined : 1; bool mHasPrototypeDeclaration : 1; bool mKnownToNotHaveSideEffects : 1; // Whether the parameter list of the function starts with void. This is used to generate an // error if any other parameter follows. bool mHasVoidParameter : 1;
};
} // namespace sh
#endif// COMPILER_TRANSLATOR_SYMBOL_H_
Messung V0.5
¤ Dauer der Verarbeitung: 0.30 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.