Commit Graph

184 Commits

Author SHA1 Message Date
Alexander Kornienko 6fbc619ab9 Use DiagnosticRenderer to convert clang diagnostics to clang-tidy ones.
Summary:
This is immediately useful for generating macro expansion notes, and
may be useful for other things later on.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2950

llvm-svn: 203457
2014-03-10 13:11:17 +00:00
Alexander Kornienko 33a0bce133 Deduplicate clang-tidy error messages by file, offset and message.
Summary: Peter, I guess, this can help you in testing your check.

Reviewers: djasper, pcc, klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2989

llvm-svn: 203451
2014-03-10 09:45:49 +00:00
NAKAMURA Takumi 67101a52de clang-tools-extra/test/pp-trace/pp-trace-modules.cpp: Flush module cache to let robust around r203317.
llvm-svn: 203369
2014-03-09 04:10:17 +00:00
NAKAMURA Takumi dc979e8c2c clang-tools-extra/test/pp-trace/pp-trace-modules.cpp: Use [[@LINE]].
llvm-svn: 203368
2014-03-09 04:10:05 +00:00
Alexander Kornienko b4a8079bf0 Use more specific checks filter in the test.
llvm-svn: 203097
2014-03-06 08:31:03 +00:00
Alexander Kornienko 9de3a98c4e Fixed a crash when handling diagnostics without a valid file location, e.g. 'error reading <file>'.
llvm-svn: 202987
2014-03-05 15:44:36 +00:00
Alexander Kornienko 31219d3abd Added a naive NOLINT implementation.
Summary:
Added a naive NOLINT implementation. It doesn't care about specific
linter categories, just the "// NOLINT" on the same line as a diagnostic.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2896

llvm-svn: 202452
2014-02-28 00:27:50 +00:00
Peter Collingbourne b549019c3c Add a makefile for clang-query. Patch by Alex Horn!
While at it, have cmake build and test the tool if libedit is not installed,
as this dependency is now optional.

llvm-svn: 201599
2014-02-18 19:46:01 +00:00
Alexander Kornienko d1afc70795 Consume checker names from clang static analyzer.
Summary: This patch depends on patches D2556 and D2557.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits, jordan_rose, krememek

Differential Revision: http://llvm-reviews.chandlerc.com/D2620

llvm-svn: 201221
2014-02-12 09:52:07 +00:00
Alexander Kornienko 6d129d5454 Fix crash when handling an argument parsing-related warning.
Summary: Don't crash on warnings coming before the translation unit starts.

Reviewers: klimek, djasper

Reviewed By: djasper

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2676

llvm-svn: 200702
2014-02-03 15:55:35 +00:00
NAKAMURA Takumi 298a161927 check-clang-tools: Also it doesn't require neither llvm_src_root nor llvm_obj_root.
llvm-svn: 200148
2014-01-26 12:40:18 +00:00
Alp Toker 65dfc8ce09 Attempt to stabilize the Windows builder
llvm-svn: 200076
2014-01-25 13:09:12 +00:00
NAKAMURA Takumi c28a9a2c33 [CMake] Deprecate CLANG_RUNTIME_OUTPUT_INTDIR and CLANG_LIBRARY_OUTPUT_INTDIR.
LLVM_*_OUTPUT_INTDIR should be available everywhere. It was my mistake when I introduced INTDIR stuff.

llvm-svn: 199597
2014-01-19 13:00:01 +00:00
NAKAMURA Takumi ba496ff394 check-clang-tools: Fixup for r199583.
- Forgot to tweak autoconf's Makefile.
  - Apply lit's param to config.clang_tools_dir.

llvm-svn: 199589
2014-01-19 12:07:45 +00:00
NAKAMURA Takumi 5d942f2229 [CMake] Import CLANG_TOOLS_DIR from check-clang into check-clang-tools for standalone clang.
llvm-svn: 199583
2014-01-19 11:19:07 +00:00
Alexander Kornienko 41bfe8dde1 Add the check name to the clang-tidy diagnostic output.
Summary:
Pass check names all the way from ClangTidyModule through
ClangTidyCheck and ClangTidyContext to ClangTidyError, and output it in
handleErrors. This allows to find mis-behaving check and disable it easily.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2534

llvm-svn: 199094
2014-01-13 10:50:51 +00:00
John Thompson e0756452a3 Initial checkin of new module-map-checker tool.
llvm-svn: 198693
2014-01-07 15:22:08 +00:00
NAKAMURA Takumi 4c141c3ef8 Make lit.site.cfg Py3-compatible. Copied from r188041.
llvm-svn: 198204
2013-12-30 06:18:08 +00:00
NAKAMURA Takumi 21bf7a11b9 check-clang-tools: Prune 'clang' stuff. Clang is not used here.
llvm-svn: 196804
2013-12-09 19:27:46 +00:00
John Thompson 87f9fef5a5 Changed ConditionValue argument to PPCallbacks If and Elif callbacks to be a 3-state enum.
llvm-svn: 196648
2013-12-07 08:41:15 +00:00
NAKAMURA Takumi 0d62c78c20 clang-tools-extra/test/clang-modernize/HeaderReplacements/main.cpp: Dequote safe chars rather than hairy quoting.
Thanks to Lang, to let me noticed.

llvm-svn: 196559
2013-12-06 02:00:41 +00:00
NAKAMURA Takumi c69c625dda Revert r196474, "Re-apply r196439, with sed patterns modified to be more DOS-path friendly."
llvm-svn: 196553
2013-12-06 00:34:09 +00:00
Lang Hames 50aa21aedd Re-apply r196439, with sed patterns modified to be more DOS-path friendly.
llvm-svn: 196474
2013-12-05 06:17:42 +00:00
NAKAMURA Takumi 4655681c27 Revert r196439, "If the LLVM OBJ_DIR path contains any characters not listed in the"
Did you expect to break DOS driveletter?

llvm-svn: 196460
2013-12-05 03:05:26 +00:00
Lang Hames b53a85a6f8 If the LLVM OBJ_DIR path contains any characters not listed in the
ScalarSafeChars array in Output::scalarString (See YAMLTraits.cpp line 554 as
of r196428), this test will fail: The path will be single quoted to preserve
the 'unsafe' characters, which doesn't match the expected (unquoted) output.
Notionally "unsafe" characters include fairly innocuous ones like the '+'
symbol (I don't know enough YAML to be sure, but I suspect '+' doesn't really
need to be quoted).

I have added some sed lines to strip leading spaces, and leading and trailing
single quote (') characters from the path. That should make this test slightly
more robust.

If possible, this test should be rewritten to use FileCheck, rather than
diffing against expected output - the latter is likely to brittle, and require
further sed goop in the future.

llvm-svn: 196439
2013-12-05 00:33:58 +00:00
John Thompson 17c357342a Enea Zaffanella's fix for the PPCallbacks Elif callback, with a slight re-org, and an update of the new PPCallbacks test (soon to be moved to clang from extra), rather the unittest.
llvm-svn: 196407
2013-12-04 20:19:30 +00:00
Alp Toker 9a5134e6be Fix a variety of user-visible and comment typos
llvm-svn: 196038
2013-12-01 05:08:12 +00:00
Alp Toker 303a6481cb Add a .clang-format to avoid reflow of test RUN lines
See thread "clang-format turning tests into no-ops"

llvm-svn: 196037
2013-12-01 05:08:00 +00:00
Manuel Klimek 814f9bd93a Make clang's static analyzer checks available through clang-tidy.
This is implemented in a way that the current static analyzer
architecture allows, in the future we might want to revisit this.

With this change static analyzer checks are available from clang-tidy
by specifying -checks=clang-analyzer-<name>.

This change also fixes the use of the compilation database to allow
clang-tidy to be used like any other clang tool.

llvm-svn: 194707
2013-11-14 15:49:44 +00:00
John Thompson c2d8a5c7f5 [extra] pp-trace - Fix for PragmaWarning output, adding tests for the pragma callbacks.
llvm-svn: 194636
2013-11-14 00:18:19 +00:00
John Thompson 13e1cd3a37 Extended moduleImport test to test a module with more than one path component. This required a change to the includes test, because of the change to the headers.
llvm-svn: 194504
2013-11-12 19:50:49 +00:00
John Thompson c1a13f3f20 Fixed moduleImport and ident callbacks. Fixed modules test. Added ident callback test. A better test for moduleExport is coming.
llvm-svn: 194447
2013-11-12 03:12:18 +00:00
John Thompson 0bc443b5c8 [extra] pp-trace - Add test for conditional callbacks.
llvm-svn: 194440
2013-11-12 02:04:53 +00:00
John Thompson da0b753035 [extra] pp-trace - Test for moduleImport.
llvm-svn: 194422
2013-11-11 21:20:02 +00:00
Peter Collingbourne 8b1265b353 Introduce clang-query tool.
This tool is for interactive exploration of the Clang AST using AST matchers.
It currently allows the user to enter a matcher at an interactive prompt
and view the resulting bindings as diagnostics, AST pretty prints or AST
dumps. Example session:

$ cat foo.c
void foo(void) {}
$ clang-query foo.c --
clang-query> match functionDecl()

Match #1:

foo.c:1:1: note: "root" binds here
void foo(void) {}
^~~~~~~~~~~~~~~~~
1 match.

Differential Revision: http://llvm-reviews.chandlerc.com/D2098

llvm-svn: 194227
2013-11-08 00:08:23 +00:00
Dan Gohman cc30af0cef Rename Input to Inputs, for consistency with other tests.
llvm-svn: 193805
2013-10-31 21:29:44 +00:00
NAKAMURA Takumi 125a4171b2 check-clang-tools: Add pp-trace for deps.
llvm-svn: 193745
2013-10-31 12:46:16 +00:00
NAKAMURA Takumi a256eb4038 check-clang-tools: Reorder CLANG_TOOLS_TEST_DEPS.
llvm-svn: 193744
2013-10-31 12:46:10 +00:00
John Thompson 9979454e72 pp-trace - preprocessor tacing and PPCallbacks testing tool
llvm-svn: 193743
2013-10-31 12:23:32 +00:00
John Thompson 5ab4f11152 Added module map generation option.
llvm-svn: 192703
2013-10-15 13:52:33 +00:00
Edwin Vane c0f00b79f7 clang-modernize: Apply replacements using clang-apply-replacements
Summary:
The clang-apply-replacements process is now invoked to apply
replacements between applying transforms. This resulted in a massive
simplification of the tool:
- FileOverrides class no longer needed.
- Change tracking and code formatting no longer needed.
- No more dependency on libclangApplyReplacements.
- Final syntax check is easier to do directly now than with a separate
  header/source pair.

Replacement handling stuff abstracted into a new header/source pair to
de-clutter ClangModernize.cpp somewhat.

Tests updated.

Differential Revision: http://llvm-reviews.chandlerc.com/D1836

llvm-svn: 192032
2013-10-05 12:15:58 +00:00
Edwin Vane 59d93af4a5 clang-apply-replacements: Add code formatting functionality
The tool now supports a collection of arguments to turn on and provide settings
for the formatting of code affected by applying replacements:
* --format turns on formatting (default style is LLVM)
* --style controls code style settings
* --style-config allows one to explicitly indicate where a style config file
  lives.

The libclangApplyReplacements interface has a new function to turn Replacements
into Ranges to be used with tooling::reformat().

llvm-svn: 191667
2013-09-30 13:59:21 +00:00
Ariel J. Bernal faa2b3a101 Fixed test for compilation databases.
Fixed test that was previously failing due to concurrency.

llvm-svn: 191215
2013-09-23 19:02:25 +00:00
Ariel J. Bernal f50eb0c73c Added tests for testing migration of files in a compilation database.
This patch also fixes the case where a compilation database is autodetected from
source but the file itself cannot be found in the compilation database, it then
ignores the compilation database and transforms the file with c++11 support.

llvm-svn: 191213
2013-09-23 18:37:32 +00:00
John Thompson a2b66875d3 Added colon to make proper error message prefix.
llvm-svn: 191092
2013-09-20 14:44:20 +00:00
John Thompson 740839260b Check for #include in extern and namespace blocks.
llvm-svn: 190950
2013-09-18 18:19:43 +00:00
NAKAMURA Takumi 4814eaa9ba clang-tools-extra/test/clang-modernize/HeaderReplacements/main.cpp: Tweak sed(1) to let paths with a driveletter quoted in *_expected.yaml.
llvm-svn: 190517
2013-09-11 11:55:59 +00:00
Rui Ueyama 9b866c2312 Fix YAML tests again.
llvm-svn: 190489
2013-09-11 04:51:09 +00:00
Rui Ueyama a53cbc5821 Fix YAML tests.
llvm-svn: 190487
2013-09-11 04:40:12 +00:00
Guillaume Papin 65ec930557 clang-modernize: Fix bugs in Pass-By-Value transform
- Limit the transform to const-ref and non-const value parameters only.
- Do not generate a replacement when the type is already a value.

See CM-139 for the bugs corresponding to this issue.

llvm-svn: 190212
2013-09-06 22:28:53 +00:00