Commit Graph

107 Commits

Author SHA1 Message Date
Fangrui Song
40233104a6 Fix GCC __wur 2018-02-19 19:06:48 -08:00
Fangrui Song
3f4b727b4b Remove -xc -xc++; add -std=gnu11 -std=gnu++14 only in .cquery mode and when --driver-mode is unspecified 2018-02-19 18:23:30 -08:00
Fangrui Song
e83fce65c2 Add loose mode in project.cc 2018-02-19 17:19:50 -08:00
Fangrui Song
f9d7361953 Add Config::compilationDatabaseCommand
If specified, this is an external command that provides the JSON compilation database, instead of compile_commands.json
2018-02-19 16:20:02 -08:00
Boris Staletic
be4d37dac3 Fix integer sign comparison 2018-02-18 09:10:27 -08:00
Fangrui Song
7e45983d6d Don't store -fsyntax-only in compilation entries
There is a FIXME about the usage of -fsyntax-only in clang::createInvocationFromCommandLine
2018-02-14 23:02:37 -08:00
Jacob Dufault
aba38a9da1 Ask user for relevant diagnostics when clang translation unit creation fails.
Closes issue #450.
2018-02-13 21:23:35 -08:00
Fangrui Song
9b0256355e Address ODR violation spot by @Riatre and work around .o .a in compile_commands.json 2018-02-07 10:27:30 -08:00
Riatre Foo
54c587a700 Look for .cquery in any directory above the source file in the hierarchy. (#409)
* Look for .cquery in any directory above the source file in the hierarchy.

Currently cquery only reads compiler arguments (.cquery) from project
root. Under some circumstances (e.g. remote compiling), generating a
compilation database with correct path in it is non-trivial, and
allowing per directory compile arguments usually helps.

* unused var buf
2018-02-03 13:16:38 -08:00
Jacob Dufault
a392301be3 Format 2018-01-29 16:27:43 -08:00
Jacob Dufault
3f4866208f Fix unit tests properly 2018-01-24 10:42:09 -08:00
Fangrui Song
549f4f3674 Fix --test-unit 2018-01-24 10:26:01 -08:00
Snibod
69d439ae8d Detect Windows absolute paths in LoadCompilationEntriesFromDirectory 2018-01-21 07:44:35 -08:00
Fangrui Song
bc28bfef45 Cleanup 2018-01-20 22:55:29 -08:00
Fangrui Song
b305beb419 Address nitpicking 2018-01-19 19:05:26 -08:00
Fangrui Song
9b8a0b01e6 Recognize .exe in GetCompilationEntryFromCompileCommandEntry 2018-01-18 09:12:55 -08:00
Fangrui Song
98fb9ee821 . 2018-01-15 17:38:28 -08:00
Fangrui Song
22aa939d3d Fix null pointer dereference but .cquery + header only still does not work 2018-01-15 17:30:26 -08:00
Jacob Dufault
b2672c6009 Fix a new file in the session not generating an index. 2018-01-10 21:27:58 -08:00
Jacob Dufault
7de2a733c8 Fix windows path normalization 2018-01-10 20:07:50 -08:00
Jacob Dufault
54394ed868 Format 2018-01-10 18:43:01 -08:00
Jacob Dufault
5605dfbb00 Always normalize project file entry when passing it to clang.
This makes clang_codeCompleteAt much faster.
2018-01-10 18:33:36 -08:00
Fangrui Song
71ca687252 Change Config->enableComments from to int
"enableComments": 0  // don't index comments
"enableComments": 1  // index Doxygen comment markers
"enableComments": 2  // -fparse-all-comments
2018-01-09 00:46:37 -08:00
Fangrui Song
53134b679c Simplify wscript and remove -x c++-header 2018-01-08 20:55:09 -08:00
Walter Erquinigo
2494c24332 Delete wrong comment 2018-01-08 13:31:20 -08:00
Fangrui Song
63178468eb -x c++-header has implicit -std=c++14 2018-01-07 21:18:02 -08:00
Fangrui Song
a2faa0c519 Treat source filenames with no dot as -x c++-header 2018-01-07 21:13:12 -08:00
Jacob Dufault
78dc0c4341 Fix unit tests 2018-01-07 14:34:30 -08:00
Jacob Dufault
2e20c8b655 Use c++14 by default if no language is specified. 2018-01-07 13:37:40 -08:00
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