================
@@ -847,11 +869,104 @@ static bool areExprsMacroAndNonMacro(const Expr
*&LhsExpr,
if (!LhsExpr || !RhsExpr)
return false;
- SourceLocation LhsLoc = LhsExpr->getExprLoc();
- SourceLocation RhsLoc = RhsExpr->getExprLoc();
+ const SourceLocation LhsLoc = LhsExpr->getExprLoc();
+ const SourceLocation RhsLoc = RhsExpr->getExprLoc();
return LhsLoc.isMacroID() != RhsLoc.isMacroID();
}
+
+static bool areStringsSameIgnoreSpaces(const llvm::StringRef *Left,
+ const llvm::StringRef *Right) {
+ if (Left == Right)
+ return true;
+ if (Left->compare(*Right) == 0) {
+ return true;
+ }
+ // Do running index comparison
+ size_t LIdx = 0;
+ size_t RIdx = 0;
+ const char *LData = Left->data();
+ const char *RData = Right->data();
+ while (LIdx < Left->size() && RIdx < Right->size()) {
----------------
earnol wrote:
I see. StringRef drop_front is calling substr version
(https://llvm.org/doxygen/SimplifyLibCalls_8cpp_source.html#l00356) not doing
string duplication, so this approach should have the same the same efficiency.
https://github.com/llvm/llvm-project/pull/122841
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits