Author: erichkeane
Date: 2025-04-11T11:33:20-07:00
New Revision: 52ef55864f50077072e083c5582d23a9ec494142

URL: 
https://github.com/llvm/llvm-project/commit/52ef55864f50077072e083c5582d23a9ec494142
DIFF: 
https://github.com/llvm/llvm-project/commit/52ef55864f50077072e083c5582d23a9ec494142.diff

LOG: [OpenACC] Fix source-location on a handful of CIR Directives

Apparently we used the 'end location' instead of 'start' in a few
places.

Added: 
    

Modified: 
    clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp 
b/clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp
index 5e3f826e2fa84..152f996ed0fed 100644
--- a/clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp
@@ -200,7 +200,7 @@ mlir::LogicalResult CIRGenFunction::emitOpenACCOp(
 
 mlir::LogicalResult
 CIRGenFunction::emitOpenACCComputeConstruct(const OpenACCComputeConstruct &s) {
-  mlir::Location start = getLoc(s.getSourceRange().getEnd());
+  mlir::Location start = getLoc(s.getSourceRange().getBegin());
   mlir::Location end = getLoc(s.getSourceRange().getEnd());
 
   switch (s.getDirectiveKind()) {
@@ -223,7 +223,7 @@ CIRGenFunction::emitOpenACCComputeConstruct(const 
OpenACCComputeConstruct &s) {
 
 mlir::LogicalResult
 CIRGenFunction::emitOpenACCDataConstruct(const OpenACCDataConstruct &s) {
-  mlir::Location start = getLoc(s.getSourceRange().getEnd());
+  mlir::Location start = getLoc(s.getSourceRange().getBegin());
   mlir::Location end = getLoc(s.getSourceRange().getEnd());
 
   return emitOpenACCOpAssociatedStmt<DataOp, mlir::acc::TerminatorOp>(
@@ -233,21 +233,21 @@ CIRGenFunction::emitOpenACCDataConstruct(const 
OpenACCDataConstruct &s) {
 
 mlir::LogicalResult
 CIRGenFunction::emitOpenACCInitConstruct(const OpenACCInitConstruct &s) {
-  mlir::Location start = getLoc(s.getSourceRange().getEnd());
+  mlir::Location start = getLoc(s.getSourceRange().getBegin());
   return emitOpenACCOp<InitOp>(start, s.getDirectiveKind(), 
s.getDirectiveLoc(),
                                s.clauses());
 }
 
 mlir::LogicalResult
 CIRGenFunction::emitOpenACCSetConstruct(const OpenACCSetConstruct &s) {
-  mlir::Location start = getLoc(s.getSourceRange().getEnd());
+  mlir::Location start = getLoc(s.getSourceRange().getBegin());
   return emitOpenACCOp<SetOp>(start, s.getDirectiveKind(), s.getDirectiveLoc(),
                               s.clauses());
 }
 
 mlir::LogicalResult CIRGenFunction::emitOpenACCShutdownConstruct(
     const OpenACCShutdownConstruct &s) {
-  mlir::Location start = getLoc(s.getSourceRange().getEnd());
+  mlir::Location start = getLoc(s.getSourceRange().getBegin());
   return emitOpenACCOp<ShutdownOp>(start, s.getDirectiveKind(),
                                    s.getDirectiveLoc(), s.clauses());
 }


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to