Author: David Stone Date: 2025-12-16T10:14:57-07:00 New Revision: ba05883304d6f9d1d16ee5d2aebd8381a53c9d43
URL: https://github.com/llvm/llvm-project/commit/ba05883304d6f9d1d16ee5d2aebd8381a53c9d43 DIFF: https://github.com/llvm/llvm-project/commit/ba05883304d6f9d1d16ee5d2aebd8381a53c9d43.diff LOG: [clang][NFC] In `CFGStmtMap`, remove mutable `getBlock` overload. (#172364) The mutable version of the overload is not used. The way we implemented code sharing in the const vs. mutable overloads had a const-correctness violation, anyway. Added: Modified: clang/include/clang/Analysis/CFGStmtMap.h clang/lib/Analysis/CFGStmtMap.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Analysis/CFGStmtMap.h b/clang/include/clang/Analysis/CFGStmtMap.h index 93cd9cfc5bdff..842059daf7560 100644 --- a/clang/include/clang/Analysis/CFGStmtMap.h +++ b/clang/include/clang/Analysis/CFGStmtMap.h @@ -40,11 +40,7 @@ class CFGStmtMap { /// are terminators, the CFGBlock is the block they appear as a terminator, /// and not the block they appear as a block-level expression (e.g, '&&'). /// CaseStmts and LabelStmts map to the CFGBlock they label. - CFGBlock *getBlock(Stmt * S); - - const CFGBlock *getBlock(const Stmt * S) const { - return const_cast<CFGStmtMap*>(this)->getBlock(const_cast<Stmt*>(S)); - } + const CFGBlock *getBlock(const Stmt *S) const; }; } // end clang namespace diff --git a/clang/lib/Analysis/CFGStmtMap.cpp b/clang/lib/Analysis/CFGStmtMap.cpp index 028e62ba89b79..a2b213e01cc14 100644 --- a/clang/lib/Analysis/CFGStmtMap.cpp +++ b/clang/lib/Analysis/CFGStmtMap.cpp @@ -24,9 +24,9 @@ static SMap *AsMap(void *m) { return (SMap*) m; } CFGStmtMap::~CFGStmtMap() { delete AsMap(M); } -CFGBlock *CFGStmtMap::getBlock(Stmt *S) { +const CFGBlock *CFGStmtMap::getBlock(const Stmt *S) const { SMap *SM = AsMap(M); - Stmt *X = S; + const Stmt *X = S; // If 'S' isn't in the map, walk the ParentMap to see if one of its ancestors // is in the map. _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
