================
@@ -30,6 +30,17 @@ struct NotLengthExprForStringNode {
                IntegerLiteralSizeNode->getValue().getZExtValue();
       }
 
+      if (const auto *DeclRefNode = Node.get<DeclRefExpr>()) {
+        if (const auto *VD = dyn_cast<VarDecl>(DeclRefNode->getDecl())) {
+          if (VD->hasInit() && VD->getType().isConstQualified()) {
+            if (const auto *Init = dyn_cast<IntegerLiteral>(VD->getInit())) {
+              return StringLiteralNode->getLength() !=
+                     Init->getValue().getZExtValue();
+            }
+          }
+        }
+      }
+
----------------
nicovank wrote:

I'm not sure exactly, what case is this adding? IMO changing 
`lengthExprForStringNode` can/should happen in subsequent PR; it affects 
existing `compare`/`find`/`rfind` branches as well.

https://github.com/llvm/llvm-project/pull/116033
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to