Commit Graph
16 Commits
Author SHA1 Message Date
Jon Meow d7b2c9b580 Remove uses of rules_cc (#776)
Per https://github.com/bazelbuild/rules_cc this still isn't necessary. There's no build-time enforcement, so usage is inconsistent/incorrect. Rather than letting this linger, remove it pending Bazel tooling enforcing it.
2021-08-24 08:55:17 -07:00
Jon Meow 6fa42a7f3c For-range in replacement logic (#631)
This replaces GetAstMatcher with AddMatcher because cxxForRangeStmt is a StatementMatcher. addMatcher has multiple definitions (https://clang.llvm.org/doxygen/classclang_1_1ast__matchers_1_1MatchFinder.html) and so this approach allows using the right addMatcher without writing per-call overloads.

To handle the `var`, I'm considering something like moving VarDecl logic into a VarMatcherBase so that I can just use CXXForRangeStmt's getLoopVariable. The problem is a for-range statement has multiple VarDecls, and getLoopVariable may be the easiest way to identify the real one.
2021-07-12 16:20:44 -07:00
Jon Meow 3082d05f80 Handle var initialization. (#628) 2021-07-09 11:29:38 -07:00
Jon Meow 4f1b2198ff Refactor Matcher code to reduce per-Matcher boilerplate (#615)
This is in part to eliminate the "sm" and "lang_opts" variables that received comment, but also cuts back on the use of auto.
2021-07-08 12:42:24 -07:00
Jon MeowandGeoff Romer e7a1093eb9 Fix fn placement around keywords (#613)
Co-authored-by: Geoff Romer <gromer@google.com>
2021-07-01 09:43:14 -07:00
Jon MeowandChandler Carruth 1071ec52b7 Head further towards reconstructing the type as written. (#612)
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2021-06-30 14:42:37 -07:00
Jon Meow 8e31e46c66 Don't use VarDecl replacements on range for loops. (#604) 2021-06-29 09:41:15 -07:00
Chandler CarruthandJon Meow 1057eda8f7 Fix formatting by removing a comment. (#608)
Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
2021-06-28 16:39:28 -07:00
Jon MeowandChandler Carruth 2d95993bd5 Improve handling for let and auto (#599)
Range-based for loops remain messed up -- I'm just disabling the test here and turning a blind eye.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2021-06-28 10:03:17 -07:00
Jon Meow 9bdabda851 Insert fn for void functions (#596) 2021-06-24 10:16:21 -07:00
Jon Meow 2344a52e24 Start handling variable declarations (#571)
TODOs in the test for known issues.

I may switch the approach to getting the variable type (on examination, this isn't working quite as well as I'd thought) but for now I think it's okay. I had an earlier approach though that may work better overall -- I'd been thinking this would work better, but as you can see in the null check for type information, I think I missed a key point.

Anyways, what'd really been vexing me was `int i, j` which I think I handle passably well now. There's obviously room for improvement, but given I've been going at this for a couple days now, I thought it best to checkpoint where I was.

This also includes some related framework changes to fix bumps I was running into. Overall the tool should operate a bit more smoothly with these changes. There are still issues with overlapping replacements, but I think it's primarily with range-based for loops which I just need to take some time to fix.
2021-06-23 10:58:32 -07:00
Jon Meow f180c64454 Change how replacements are filtered (#541)
This replaces the use of `isExpansionInMainFile` with instead taking the list of input files, and only touching them. This doesn't keep `isExpansionInMainFile` because it should be redundant, and as such it'd be easy to forget. Unless it starts being a performance issue, it's probably better to omit.
2021-06-03 16:35:55 -07:00
Chandler Carruth 4034fa223d Update LLVM (and llvm-bazel). (#550)
This picks up a newer version of LLVM and the LLVM Bazel integration.
The big change here is that we can configure the LLVM targets that are
built, which allows us to dramatically reduce the build costs by
focusing on a couple of CPUs for the time being.

There are a few API updates needed as well.

This also rotates the cache version so we start with a clean Bazel cache
from here. Otherwise we'd potentially pay the cost of carrying around
stale bits of LLVM endlessly.
2021-05-25 15:21:57 -07:00
Jon Meow 29bf305539 Add tests to the cpp_refactoring tool. (#539)
This refactors the main.cpp out into a file structure that should make it easier to add more matchers/tests.
2021-05-17 16:55:50 -07:00
Jon Meow 82f5c4224b Small fixes from #530 (#537) 2021-05-14 13:23:10 -07:00
Jon Meow 6f544494b3 Use AST to start inserting fn (#530) 2021-05-13 14:58:32 -07:00