Skip to content

Replace std::regex in codecomplete to use llvm::regex #424

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

aaronj0
Copy link
Collaborator

@aaronj0 aaronj0 commented Jan 9, 2025

@alexander-penev We ran into an issue with torchlib that is triggered by the loading of std::regex. I have replaced the usage with llvm::Regex that fi xes it. Can you verify if this works with your usecases when developing the feature? The unittests for codecomplete pass but I am not sure if it is extensive enough.
.

  • Bug fix
  • New feature
  • Requires documentation updates

Copy link
Contributor

github-actions bot commented Jan 9, 2025

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

github-actions bot commented Jan 9, 2025

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

github-actions bot commented Jan 9, 2025

clang-tidy review says "All clean, LGTM! 👍"

// remove <# #> to keep only the type
r = std::regex_replace(r, std::regex("\\<\\#([^#>]*)\\#\\>"), "$1");
r = removeTags.sub("$1", r, &error);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check the error variable and fail if there is something in it?

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.96%. Comparing base (2c6c6b1) to head (a73a539).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #424   +/-   ##
=======================================
  Coverage   70.96%   70.96%           
=======================================
  Files           9        9           
  Lines        3541     3541           
=======================================
  Hits         2513     2513           
  Misses       1028     1028           
Files with missing lines Coverage Δ
lib/Interpreter/Compatibility.h 88.28% <ø> (ø)
Files with missing lines Coverage Δ
lib/Interpreter/Compatibility.h 88.28% <ø> (ø)

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@aaronj0 aaronj0 requested a review from vgvassilev January 16, 2025 08:57
@@ -163,17 +166,45 @@ inline void codeComplete(std::vector<std::string>& Results,
std::vector<std::string> results;
size_t column = complete_column;
I.codeComplete(code, column, results);
std::string error;
llvm::Error Err;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
llvm::Error Err;
llvm::Error Err = llvm::Error::success();

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aaronj0 aaronj0 merged commit d858914 into compiler-research:main Jan 16, 2025
47 checks passed
@aaronj0 aaronj0 deleted the llvm-regex branch April 22, 2025 08:27
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants