aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaCXXScopeSpec.cpp5
-rw-r--r--clang/lib/Sema/SemaHLSL.cpp13
2 files changed, 13 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp
index c52fc5b..17ae7ca 100644
--- a/clang/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp
@@ -780,6 +780,11 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
if (!Found.empty()) {
const auto *ND = Found.getAsSingle<NamedDecl>();
+ if (!ND) {
+ Diag(IdInfo.IdentifierLoc, diag::err_expected_class_or_namespace)
+ << IdInfo.Identifier << getLangOpts().CPlusPlus;
+ return true;
+ }
if (::ExtendNestedNameSpecifier(*this, SS, ND, IdInfo.IdentifierLoc,
IdInfo.CCLoc)) {
const Type *T = SS.getScopeRep().getAsType();
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index a06c57b..e95fe16 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -3910,12 +3910,15 @@ void SemaHLSL::ActOnVariableDeclarator(VarDecl *VD) {
if (VD->getType()->isHLSLIntangibleType())
collectResourceBindingsOnVarDecl(VD);
- if (isResourceRecordTypeOrArrayOf(VD) ||
- VD->hasAttr<HLSLVkConstantIdAttr>()) {
- // Make the variable for resources static. The global externally visible
- // storage is accessed through the handle, which is a member. The variable
- // itself is not externally visible.
+ if (VD->hasAttr<HLSLVkConstantIdAttr>())
VD->setStorageClass(StorageClass::SC_Static);
+
+ if (isResourceRecordTypeOrArrayOf(VD) &&
+ VD->getStorageClass() != SC_Static) {
+ // Add internal linkage attribute to non-static resource variables. The
+ // global externally visible storage is accessed through the handle, which
+ // is a member. The variable itself is not externally visible.
+ VD->addAttr(InternalLinkageAttr::CreateImplicit(getASTContext()));
}
// process explicit bindings