[clang] 3c50f0d - Add const information about AST nodes used to construct CFG elements.

Dmitri Gribenko via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 8 03:11:46 PST 2022


Author: Dani Ferreira Franco Moura
Date: 2022-11-08T12:11:38+01:00
New Revision: 3c50f0d879bf73e7cf64c83017ccb442d780aae6

URL: https://github.com/llvm/llvm-project/commit/3c50f0d879bf73e7cf64c83017ccb442d780aae6
DIFF: https://github.com/llvm/llvm-project/commit/3c50f0d879bf73e7cf64c83017ccb442d780aae6.diff

LOG: Add const information about AST nodes used to construct CFG elements.

Most constructors and destructors in CFG.h already specify const arguments, but some are missing this.

Reviewed By: gribozavr2, krasimir

Differential Revision: https://reviews.llvm.org/D137584

Added: 
    

Modified: 
    clang/include/clang/Analysis/CFG.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/CFG.h b/clang/include/clang/Analysis/CFG.h
index 9212276a3f691..96231fe0c2c6d 100644
--- a/clang/include/clang/Analysis/CFG.h
+++ b/clang/include/clang/Analysis/CFG.h
@@ -131,7 +131,7 @@ class CFGElement {
 
 class CFGStmt : public CFGElement {
 public:
-  explicit CFGStmt(Stmt *S, Kind K = Statement) : CFGElement(K, S) {
+  explicit CFGStmt(const Stmt *S, Kind K = Statement) : CFGElement(K, S) {
     assert(isKind(*this));
   }
 
@@ -155,7 +155,8 @@ class CFGStmt : public CFGElement {
 /// this is only used by the analyzer's CFG.
 class CFGConstructor : public CFGStmt {
 public:
-  explicit CFGConstructor(CXXConstructExpr *CE, const ConstructionContext *C)
+  explicit CFGConstructor(const CXXConstructExpr *CE,
+                          const ConstructionContext *C)
       : CFGStmt(CE, Constructor) {
     assert(C);
     Data2.setPointer(const_cast<ConstructionContext *>(C));
@@ -185,7 +186,7 @@ class CFGCXXRecordTypedCall : public CFGStmt {
 public:
   /// Returns true when call expression \p CE needs to be represented
   /// by CFGCXXRecordTypedCall, as opposed to a regular CFGStmt.
-  static bool isCXXRecordTypedCall(Expr *E) {
+  static bool isCXXRecordTypedCall(const Expr *E) {
     assert(isa<CallExpr>(E) || isa<ObjCMessageExpr>(E));
     // There is no such thing as reference-type expression. If the function
     // returns a reference, it'll return the respective lvalue or xvalue
@@ -194,7 +195,7 @@ class CFGCXXRecordTypedCall : public CFGStmt {
            E->getType().getCanonicalType()->getAsCXXRecordDecl();
   }
 
-  explicit CFGCXXRecordTypedCall(Expr *E, const ConstructionContext *C)
+  explicit CFGCXXRecordTypedCall(const Expr *E, const ConstructionContext *C)
       : CFGStmt(E, CXXRecordTypedCall) {
     assert(isCXXRecordTypedCall(E));
     assert(C && (isa<TemporaryObjectConstructionContext>(C) ||
@@ -225,7 +226,7 @@ class CFGCXXRecordTypedCall : public CFGStmt {
 /// list.
 class CFGInitializer : public CFGElement {
 public:
-  explicit CFGInitializer(CXXCtorInitializer *initializer)
+  explicit CFGInitializer(const CXXCtorInitializer *initializer)
       : CFGElement(Initializer, initializer) {}
 
   CXXCtorInitializer* getInitializer() const {
@@ -482,7 +483,7 @@ class CFGMemberDtor : public CFGImplicitDtor {
 /// expression for temporary object.
 class CFGTemporaryDtor : public CFGImplicitDtor {
 public:
-  CFGTemporaryDtor(CXXBindTemporaryExpr *expr)
+  CFGTemporaryDtor(const CXXBindTemporaryExpr *expr)
       : CFGImplicitDtor(TemporaryDtor, expr, nullptr) {}
 
   const CXXBindTemporaryExpr *getBindTemporaryExpr() const {


        


More information about the cfe-commits mailing list