Commit Graph

128 Commits

Author SHA1 Message Date
Jacob Dufault
a4496b7430 Do not try to load compile_commands.json if there is a .cquery file.
Also give some better diagnostics for .cquery.
2018-01-06 20:27:50 -08:00
Jacob Dufault
cf2103b521 Always normalize --sysroot=.
Clang does not respect -working-dir for this argument.
2018-01-05 13:41:38 -08:00
Fangrui Song
af600d4b90 Recognize clang-4.0 as commands 2018-01-05 11:10:58 -08:00
Fangrui Song
08e856b85a Use nullptr for main source filename in clang_parseTranslationUnit2FullArgv and rely on -working-directory for relative filename resolution 2018-01-05 09:45:46 -08:00
yshui
2a7b593a80 Use gnu11 standard when none is specified (#231)
Reference:

1. https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes
2. https://gcc.gnu.org/onlinedocs/gcc/Standards.html
2018-01-04 11:10:40 -08:00
Fangrui Song
f32d3a6851 Use -working-directory
This is in preparation for https://github.com/jacobdufault/cquery/pull/94
-working-directory allows us to remove relative filename resolution later on.
2017-12-31 14:00:50 -08:00
Fangrui Song
73ba3f0d6f Move -x & -std= options just after compiler driver 2017-12-31 13:37:59 -08:00
Jacob Dufault
9dde5041cb Always use -fparse-all-comments 2017-12-27 07:56:17 -08:00
Jacob Dufault
fb491e6c6d Format using clang format 4.0.0 2017-12-23 08:33:26 -08:00
Jacob Dufault
e1ac3103a8 Add TEXT_REPLACE in index tests.
This allows USRs to vary across platforms in index tests, which is required to
make them pass on all platforms.
2017-12-22 08:48:12 -08:00
Joel Hock
4b420c53d3 add unit test 2017-12-19 08:16:52 -08:00
Joel Hock
bea5b38bc5 /.cquery file parsing fixes
- relative path handling
- first line was being ignored if it was a flag (code assumed it was path to clang binary)
2017-12-19 08:16:52 -08:00
Jacob Dufault
487680e8d1 Fix project.cc unit tests.
-x processing broke.
2017-12-15 21:05:48 -08:00
Walter Erquinigo
5238c50027 objc 2017-12-15 12:02:32 -08:00
Jacob Dufault
9e6d33689f Trim lines when reading from .cquery file.
Otherwise there may be newlines and the like.
2017-12-03 18:25:21 -08:00
Josh Elsasser
82643dc79d Ensure that paths passed to libclang are fully expanded
- "-include" arguments must have their paths resolved
- clang_resource_dir must have its path resolved
2017-12-03 12:53:05 -08:00
Jacob Dufault
cf5f465e9e Add -Wno-unknown-warning-option 2017-12-01 10:11:09 -08:00
Jacob Dufault
b727e36afc Move cleanup_maybe_relative_path to top of func in project.cc 2017-12-01 09:59:28 -08:00
Jacob Dufault
9b44bf7901 Run ./format.sh 2017-12-01 09:55:41 -08:00
Fangrui Song
87f6452b5d Rename clang_args to .cquery 2017-11-27 12:31:54 -05:00
Jacob Dufault
d5951c0e69 Revert "Specify nullptr for source_filename in clang_parseTranslationUnit2 so that we do not need to strip main source filename from args"
This reverts commit 6adc3a28c39a5f6b58a0a57bfae83916051c19f8.
2017-11-27 08:20:42 -08:00
Fangrui Song
2b54296992 Specify nullptr for source_filename in clang_parseTranslationUnit2 so that we do not need to strip main source filename from args 2017-11-27 11:13:07 -05:00
Walter Erquinigo
31d7423490 Rebuild vscode plugin and fix some naming 2017-11-26 12:11:09 -05:00
Walter Erquinigo
3cee3cb775 Support an optional compilation database dir at initialization 2017-11-26 12:11:09 -05:00
Jacob Dufault
6a23c5bace Enable path in args test 2017-11-19 15:46:02 -08:00
Fangrui Song
fb38537f20 Strip main source filename if it is a relative path in GetCompilationEntryFromCompileCommandEntry 2017-11-19 18:30:27 -05:00
Jacob Dufault
261b04a131 Update test once more 2017-11-19 14:48:26 -08:00
Jacob Dufault
475cd6b668 Add failing test for issue #42 2017-11-19 14:46:05 -08:00
Jacob Dufault
97417ecc93 Reformat code 2017-11-19 14:11:54 -08:00
Fangrui Song
297ed1d13e Use indented TEST_SUITE 2017-11-19 14:13:11 -05:00
Jacob Dufault
6a50c48aaa Formatting and a TODO 2017-11-18 09:29:48 -08:00
Jacob Dufault
601af73ca9 Move all libclangmm/* files into src/* directory 2017-11-11 11:41:09 -08:00
Jacob Dufault
7d549f3fdf Move libclangmm/Utility.h into clang_utils.h 2017-11-04 16:02:39 -07:00
Jacob Dufault
1f0c1e922f Fix compile_commands.json parsing when filename is absolute.
Some compile_commands.json generators will emit absolute paths for the
filename, such as cmake.
2017-10-31 15:43:27 -07:00
Jacob Dufault
7734943620 Format all code in src/ 2017-10-31 12:49:19 -07:00
Jacob Dufault
98c701b217 Fix project loading absolute path normalization for clang_args 2017-10-28 14:51:36 -07:00
Jacob Dufault
ccff74a79c Fix performance regression in loading compile_commands.json
Regression was caused by accidental copying.
2017-10-24 19:00:29 -07:00
Jacob Dufault
738b338d47 Emit timings for project loading 2017-10-24 18:39:44 -07:00
Jacob Dufault
58f2107714 Inject -resource-dir automatically. 2017-10-24 18:02:15 -07:00
Jacob Dufault
a155f5b686 Fix a bunch of bugs in argument handling and address some TODOs 2017-10-18 01:24:52 -07:00
Jacob Dufault
0e7c8bdf05 Fix argument handling for chrome 2017-10-18 00:02:33 -07:00
Jacob Dufault
3003385d76 Update clang argument parsing 2017-10-17 23:23:07 -07:00
Jacob Dufault
6b0c3831fa Add project parsing test 2017-09-21 23:50:27 -07:00
Jacob Dufault
bd8582e718 A bit more code cleanup in project.cc 2017-09-21 20:09:11 -07:00
Jacob Dufault
a96be1d6e5 Cleanup how include directories are passed around in project. 2017-09-21 20:02:48 -07:00
Jacob Dufault
f5314b62b1 Reformat to Chromium style. 2017-09-21 18:14:57 -07:00
Jacob Dufault
e771f05f3f Linux build fixes 2017-07-29 21:46:21 -07:00
Jacob Dufault
c37396a36d First pass at logging using loguru 2017-07-27 19:14:46 -07:00
James Cook
0876886c60 Fix build error on Linux for INT_MIN (#10)
* Fix compiler warnings and turn on warnings as errors

* Fix build error on Linux for INT_MIN
2017-06-20 08:17:23 -07:00
Jacob Dufault
36ee8bec47 Consider filename ending when guessing arguments.
This should improve guessing for, ie, test files, like foo_test.cc.
2017-06-19 19:09:15 -07:00
James Cook
5b4986f04b Fix compiler warnings and turn on warnings as errors 2017-06-19 18:30:44 -07:00
Jacob Dufault
8d9374ee59 Disable logging of filtered project paths, but let user enable it in config. 2017-05-21 23:45:47 -07:00
Jacob Dufault
440fa950a0 Use -xc (instead of -xc++) for files ending with .c.
A good chunk of c files will fail to compile under c++ mode.
2017-05-21 23:06:30 -07:00
Jacob Dufault
8910d0a13e Fix warnings (almost all numeric cast-related) 2017-05-21 16:22:00 -07:00
Jacob Dufault
864ff122d8 Scan include directories for include completion candidates. 2017-05-21 12:51:15 -07:00
Jacob Dufault
94bd6fc301 Add #include auto-complete. 2017-05-21 00:37:53 -07:00
Jacob Dufault
cf45c91bcd A bit more work on making a faster compile_commands.json loader 2017-05-18 18:14:53 -07:00
Jacob Dufault
a97bd9d1c4 WIP better command line parsing 2017-05-08 18:21:21 -07:00
Jacob Dufault
fc55589ed3 Infer arguments for files not in the project. 2017-05-06 22:36:29 -07:00
Jacob Dufault
49c687663e Rework some of the command line flag parsing logic. Hopefully make it more robust. 2017-04-25 21:03:22 -07:00
Jacob Dufault
839f3d9968 Try parsing with full argv. Also hide system diagnostics. 2017-04-25 19:57:36 -07:00
Jacob Dufault
145bf87d70 Add 'cquery: Freshen Index' command.
This validates every file is indexed to its current state. It is very useful after, ie, a git checkout.
2017-04-20 21:50:31 -07:00
Jacob Dufault
14b47de1db Cleanup import pipeline, store arguments in indexed file.
We no longer store any runtime state (ie, file arguments) in project.cc; we store it and then query it from the cached index file.
2017-04-20 21:06:15 -07:00
Jacob Dufault
7326b861ac Simplify dependency management when updating index for a file. 2017-04-20 01:05:19 -07:00
Jacob Dufault
1f6da81009 Preserve dependencies across multiple index runs. 2017-04-20 00:53:33 -07:00
Jacob Dufault
4d9567a0c2 Fix reindexing for header files 2017-04-20 00:25:38 -07:00
Jacob Dufault
9338bcfd0e Improvements to loading project.
- Don't reindex the file if the modification time has not changed.
- Import file dependencies before importing other files, which might be a full-on index operation.
2017-04-19 22:46:10 -07:00
Jacob Dufault
2780e18040 CompilationEntry -> Project::Entry 2017-04-19 22:01:36 -07:00
Jacob Dufault
b4fb350140 Include file modification time in index 2017-04-19 21:57:44 -07:00
Jacob Dufault
26c0bfe71d Misc fixes 2017-04-17 13:40:50 -07:00
Jacob Dufault
7f4d902dcf Add alternative compile_commands.json loader using rapidjson.
It may be faster than clang. I haven't tested it yet.
2017-04-17 00:06:01 -07:00
Jacob Dufault
8f1e517c0a Small tweaks 2017-04-14 15:30:33 -07:00
Jacob Dufault
527439b7c2 WIP on updating index; locations still broken 2017-04-09 17:08:54 -07:00
Jacob Dufault
56f0b3a90a Auto-index header files 2017-04-08 15:54:36 -07:00
Jacob Dufault
460a428ced Parse now returns a vector of unique_ptrs 2017-04-08 13:00:08 -07:00
Jacob Dufault
2f61e1b4f4 normalize path in -I flag 2017-04-05 18:12:29 -07:00
Jacob Dufault
5e7008875d unify project loading 2017-03-30 21:21:52 -07:00
Jacob Dufault
404b853d6f code completion works (but is still blocking) 2017-03-26 14:40:34 -07:00