tools/clang/lib/SPIRV/SPIRVEmitter.cpp
/// Returns the referenced variable's DeclContext if the given expr is
/// a DeclRefExpr referencing a ConstantBuffer/TextureBuffer. Otherwise,
/// returns nullptr.
Returns the referenced variable's DeclContext if the given expr is
a DeclRefExpr referencing a ConstantBuffer/TextureBuffer. Otherwise,
returns nullptr.
Returns the referenced variable ' s DeclContext if the given expr is a DeclRefExpr referencing a ConstantBuffer / TextureBuffer . Otherwise returns nullptr .
const DeclContext *isConstantTextureBufferDeclRef(const Expr *expr) {
  if (const auto *declRefExpr = dyn_cast<DeclRefExpr>(expr->IgnoreParenCasts()))
    if (const auto *varDecl = dyn_cast<VarDecl>(declRefExpr->getFoundDecl()))
      if (const auto *bufferDecl =
              dyn_cast<HLSLBufferDecl>(varDecl->getDeclContext()))
        if (bufferDecl->isConstantBufferView())
          return varDecl->getType()->getAs<RecordType>()->getDecl();
  return nullptr;
}
const DeclContext * isConstantTextureBufferDeclRef ( const Expr * expr ) { if ( const auto * declRefExpr = dyn_cast < DeclRefExpr > ( expr -> IgnoreParenCasts ( ) ) ) if ( const auto * varDecl = dyn_cast < VarDecl > ( declRefExpr -> getFoundDecl ( ) ) ) if ( const auto * bufferDecl = dyn_cast < HLSLBufferDecl > ( varDecl -> getDeclContext ( ) ) ) if ( bufferDecl -> isConstantBufferView ( ) ) return varDecl -> getType ( ) -> getAs < RecordType > ( ) -> getDecl ( ) ; return nullptr ; }
Returns the referenced variable's DeclContext if the given expr is
a DeclRefExpr referencing a ConstantBuffer/TextureBuffer.
Returns the referenced variable ' s DeclContext if the given expr is a DeclRefExpr referencing a ConstantBuffer / TextureBuffer .
// Make sure we are not returning true for VarDecls inside // cbuffer/tbuffer.