================
@@ -28,12 +28,69 @@
 #include "llvm/Support/AtomicOrdering.h"
 #include "llvm/TargetParser/AMDGPUTargetParser.h"
 #include <cstdint>
+#include <optional>
 #include <utility>
 
 namespace clang {
 
 SemaAMDGPU::SemaAMDGPU(Sema &S) : SemaBase(S) {}
 
+namespace {
+
+static std::pair<StringRef, SourceLocation>
+getExplicitAMDGPUSectionName(const VarDecl *D) {
+  if (auto *SA = D->getAttr<SectionAttr>())
+    return {SA->getName(), SA->getLocation()};
+  return {StringRef(), SourceLocation()};
+}
+
+static bool isDependentVarDecl(const VarDecl *D) {
+  if (D->getType()->isDependentType())
+    return true;
+  if (const auto *Init = D->getInit())
+    return Init->isValueDependent();
+  return false;
+}
+
+} // namespace
+
+void SemaAMDGPU::checkConstantAddressSpaceSection(VarDecl *VD) {
+  if (!SemaRef.Context.getTargetInfo().getTriple().isAMDGCN())
+    return;
+  std::optional<StringRef> ConstantSection =
+      SemaRef.Context.getTargetInfo().getConstantAddressSpaceSectionName();
+  if (!ConstantSection)
----------------
shiltian wrote:

I don't understand this whole Sema thing. If this is supposed to be a runtime 
check, how is compiler's sema involved here?

https://github.com/llvm/llvm-project/pull/209679
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to