tools/clang/lib/SPIRV/SPIRVEmitter.cpp
/// Returns true if
/// * the given expr is an DeclRefExpr referencing a kind of structured or byte
/// buffer and it is non-alias one, or
/// * the given expr is an CallExpr returning a kind of structured or byte
/// buffer.
///
/// Note: legalization specific code
Returns true if
the given expr is an DeclRefExpr referencing a kind of structured or byte
buffer and it is non-alias one, or
the given expr is an CallExpr returning a kind of structured or byte
buffer.

legalization specific code
Returns true if the given expr is an DeclRefExpr referencing a kind of structured or byte buffer and it is non - alias one or the given expr is an CallExpr returning a kind of structured or byte buffer . legalization specific code
bool isReferencingNonAliasStructuredOrByteBuffer(const Expr *expr) {
  expr = expr->IgnoreParenCasts();
  if (const auto *declRefExpr = dyn_cast<DeclRefExpr>(expr)) {
    if (const auto *varDecl = dyn_cast<VarDecl>(declRefExpr->getFoundDecl()))
      if (TypeTranslator::isAKindOfStructuredOrByteBuffer(varDecl->getType()))
        return isExternalVar(varDecl);
  } else if (const auto *callExpr = dyn_cast<CallExpr>(expr)) {
    if (TypeTranslator::isAKindOfStructuredOrByteBuffer(callExpr->getType()))
      return true;
  }
  return false;
}
bool isReferencingNonAliasStructuredOrByteBuffer ( const Expr * expr ) { expr = expr -> IgnoreParenCasts ( ) ; if ( const auto * declRefExpr = dyn_cast < DeclRefExpr > ( expr ) ) { if ( const auto * varDecl = dyn_cast < VarDecl > ( declRefExpr -> getFoundDecl ( ) ) ) if ( TypeTranslator :: isAKindOfStructuredOrByteBuffer ( varDecl -> getType ( ) ) ) return isExternalVar ( varDecl ) ; } else if ( const auto * callExpr = dyn_cast < CallExpr > ( expr ) ) { if ( TypeTranslator :: isAKindOfStructuredOrByteBuffer ( callExpr -> getType ( ) ) ) return true ; } return false ; }
Returns true if
 the given expr is an DeclRefExpr referencing a kind of structured or byte
buffer and it is non-alias one, or
 the given expr is an CallExpr returning a kind of structured or byte
buffer.
Returns true if the given expr is an DeclRefExpr referencing a kind of structured or byte buffer and it is non - alias one or the given expr is an CallExpr returning a kind of structured or byte buffer .