aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/IdentifierResolver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/IdentifierResolver.cpp')
-rw-r--r--clang/lib/Sema/IdentifierResolver.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/IdentifierResolver.cpp b/clang/lib/Sema/IdentifierResolver.cpp
index 9081714c893f..607dc3111e9d 100644
--- a/clang/lib/Sema/IdentifierResolver.cpp
+++ b/clang/lib/Sema/IdentifierResolver.cpp
@@ -99,7 +99,11 @@ IdentifierResolver::~IdentifierResolver() {
bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx, Scope *S,
bool AllowInlineNamespace) const {
Ctx = Ctx->getRedeclContext();
-
+ // The names for HLSL cbuffer/tbuffers only used by the CPU-side
+ // reflection API which supports querying bindings. It will not have name
+ // conflict with other Decls.
+ if (LangOpt.HLSL && isa<HLSLBufferDecl>(D))
+ return false;
if (Ctx->isFunctionOrMethod() || (S && S->isFunctionPrototypeScope())) {
// Ignore the scopes associated within transparent declaration contexts.
while (S->getEntity() && S->getEntity()->isTransparentContext())
@@ -287,7 +291,7 @@ static DeclMatchKind compareDeclarations(NamedDecl *Existing, NamedDecl *New) {
// If the existing declaration is somewhere in the previous declaration
// chain of the new declaration, then prefer the new declaration.
- for (auto RD : New->redecls()) {
+ for (auto *RD : New->redecls()) {
if (RD == Existing)
return DMK_Replace;