Commit Graph

3178 Commits

Author SHA1 Message Date
Manuel Klimek 7a95ce4399 Make clang-format work in emacs buffers with unicode characters.
Emacs functions by default use character positions; convert characters
to offsets when handing parameters to clang-format and convert byte
offsets we get from clang-format back to character positions.
Reworked the code a bit so the 0-based to 1-based offset calculations
are done in the same place where we do the multi-byte to offset mapping.

llvm-svn: 226445
2015-01-19 10:48:04 +00:00
Chandler Carruth 575bc3ba62 [cleanup] Re-sort the #include lines using llvm/utils/sort_includes.py
No functionality changed, this is a purely mechanical cleanup to ensure
the #include order remains consistent across the project.

llvm-svn: 225975
2015-01-14 11:23:58 +00:00
Manuel Klimek 1ba46c661c Update clang-format.el to use xml output and patch in the returned chunks.
This leads to better undo behavior and avoids window content jumping
around.

Patch by Johann Klähn.

llvm-svn: 225777
2015-01-13 08:35:34 +00:00
Manuel Klimek 949ff4d9f2 Add the shifted cursor position to XML output, so it can be used by editor integrations.
llvm-svn: 225516
2015-01-09 10:03:47 +00:00
Manuel Klimek 295b7b6800 Improve clang-format.el.
- includes header/footer as required by MELPA
- correctly handles buffers that are not associated with a file
- displays stderr and exit code of clang-format process
- customizable via the emacs customization interface and file-/directory-
  local variables

Patch by Johann Klähn.

llvm-svn: 225447
2015-01-08 15:29:03 +00:00
Ted Kremenek 67978556a5 [analyzer] Include a couple more comments on using xcrun to query the SDK.
llvm-svn: 225039
2014-12-31 08:19:08 +00:00
Ted Kremenek 398f46f8f2 [analyzer] Change ccc-analyzer to mimick behavior on OSX Mavericks/Yosemite to automatically infer the SDK location.
llvm-svn: 225038
2014-12-31 07:44:51 +00:00
Daniel Jasper 7c627a0d24 clang-format: Make clang-format-diff.py format java files.
llvm-svn: 223685
2014-12-08 19:39:03 +00:00
Anton Yartsev a466a93ffe [analyzer] Eliminated endless loop.
llvm-svn: 223426
2014-12-05 00:59:07 +00:00
Alexander Kornienko 74e1c46a50 Make ArgumentsAdjuster an std::function.
Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D6505

llvm-svn: 223248
2014-12-03 17:53:02 +00:00
Anton Yartsev 0a18fca007 [analyzer] Indented code within the DisplayHelp sub.
llvm-svn: 222851
2014-11-26 21:53:39 +00:00
David Blaikie 3c8c46efd7 clang-format a recent commit I made
llvm-svn: 222317
2014-11-19 05:48:40 +00:00
David Blaikie 13156b689e Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.
llvm-svn: 222306
2014-11-19 03:06:06 +00:00
Alexander Kornienko 41c247a677 Make DiagnosticsEngine::takeClient return std::unique_ptr<>
Summary:
Make DiagnosticsEngine::takeClient return std::unique_ptr<>. Updated
callers to store conditional ownership using a pair of pointer and unique_ptr
instead of a pointer + bool. Updated code that temporarily registers clients to
use the non-owning registration (+ removed extra calls to takeClient).

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6294

llvm-svn: 222193
2014-11-17 23:46:02 +00:00
Daniel Jasper c670688add clang-format: Give clang-format-diff.py a -v option.
With it, it prints the file being formatted. Apparently people are
formatting thousands of files and some progress indication is helpful.

llvm-svn: 221990
2014-11-14 13:27:28 +00:00
Argyrios Kyrtzidis cde7069ce4 [libclang] Make sure to visit the body of a CXXForRangeStmt.
llvm-svn: 221881
2014-11-13 09:50:19 +00:00
Argyrios Kyrtzidis 998912453d [liblang] Handle CXXForRangeStmt during AST visitation.
llvm-svn: 221874
2014-11-13 09:03:21 +00:00
Argyrios Kyrtzidis 6cc5f73e38 [libclang] When initializing an ObjC object via the "[[ClassName alloc] init*]" pattern,
report the 'init*' invocation as non-dynamic via clang_Cursor_isDynamicCall.

Of course it is dynamic at runtime, but for purposes of indexing we can treat as an invocation to ClassName's init*.

Addresses rdar://18916871.

llvm-svn: 221641
2014-11-10 23:21:35 +00:00
Nico Weber 337f5b27ad clang-format: Document that --assume-filename affects the language.
llvm-svn: 221606
2014-11-10 16:14:54 +00:00
Richard Smith 0f0af19b05 [c++1z] N4295: fold-expressions.
This is a new form of expression of the form:

  (expr op ... op expr)

where one of the exprs is a parameter pack. It expands into

  (expr1 op (expr2onwards op ... op expr))

(and likewise if the pack is on the right). The non-pack operand can be
omitted; in that case, an empty pack gives a fallback value or an error,
depending on the operator.

llvm-svn: 221573
2014-11-08 05:07:16 +00:00
Michael J. Spencer b011d48282 Fix style.
llvm-svn: 221546
2014-11-07 21:30:32 +00:00
Rafael Espindola 8cbf4a0b5d Support LLVM_BUILD_STATIC.
llvm-svn: 221346
2014-11-05 14:04:25 +00:00
Justin Bogner 12b50a95c9 clang-format: Make it possible to (require 'clang-format)
This makes the emacs integration ``provide`` a clang-format feature,
so that a .emacs can ``require`` it.

llvm-svn: 221330
2014-11-05 04:32:54 +00:00
Daniel Jasper 20bc4b0f5c clang-format: Fix vim integration if g:clang_format_binary doesn't exist
llvm-svn: 221254
2014-11-04 10:40:26 +00:00
Alexander Kornienko 616860994d [clang-tidy] Move -extra-arg handling to CommonOptionsProvider
Summary:
Handle -extra-arg and -extra-arg-before options in the
CommonOptionsProvider so they can be used in all clang tools. Adjust arguments
in a CompilationDatabase wrapper instead of adding ArgumentsAdjuster to the
tool.

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D6073

llvm-svn: 221248
2014-11-04 08:51:24 +00:00
Michael J. Spencer 04162eaced [llvm-api-change] Use findProgramByName.
llvm-svn: 221222
2014-11-04 01:30:55 +00:00
Saleem Abdulrasool 4d195ed4b2 clang-format: permit setting the path to clang in vimrc
If g:clang_format_path is set in the vimrc, that path will take precedence over
the hard coded path (which is reliant on the PATH environment variable).  This
provides an easy mechanism for switching the selected clang-format binary during
development.

llvm-svn: 221108
2014-11-02 21:27:59 +00:00
Saleem Abdulrasool 8bbed0b63a docs: remove double carriage-return
The double carriage return would silence a warning due to a missing
.clang-format.  Permit the error to bubble through.

llvm-svn: 221107
2014-11-02 21:27:52 +00:00
NAKAMURA Takumi ed1173e5a0 [autoconf] Add clangToolingCore.a to Makefile(s) for static build w/o libclang.dll.
llvm-svn: 220904
2014-10-30 10:31:29 +00:00
NAKAMURA Takumi 9f99a7a417 [CMake] Prune redundant libdeps.
llvm-svn: 220893
2014-10-30 01:37:44 +00:00
NAKAMURA Takumi dc872ed908 [CMake] Add dependencies on clangToolingCore.
llvm-svn: 220890
2014-10-30 00:44:01 +00:00
Daniel Jasper 06dbac4be9 clang-format: Cut more clangAST dependencies.
Hopefully fixing windows builds.

llvm-svn: 220878
2014-10-29 22:42:53 +00:00
Daniel Jasper cb3e6188bc Refactor libTooling to reduce required dependencies.
This moves classes for storing and applying replacements to separate
files. These classes specifically are used by clang-format which doesn't
have any other dependencies on clangAST. Thereby, the size of
clang-format's binary can be cut roughly in half and its build time sped
up.

llvm-svn: 220867
2014-10-29 18:55:09 +00:00
Fariborz Jahanian 9ad94aa280 Objective-C. revert patch for rdar://17554063.
llvm-svn: 220812
2014-10-28 18:28:16 +00:00
Kaelyn Takata e1f49d545d Add the initial TypoExpr AST node for delayed typo correction.
llvm-svn: 220692
2014-10-27 18:07:20 +00:00
Saleem Abdulrasool 1f060a8552 clang-format: improve vim integration docs
Improve the documentation for vim integration of clang-format.  Prefer the use
of <c-o> to do the normal mode command execution to avoid side-effects of the
escape and re-insertion (cursor movement).  Tweak the macros to use a double
return to avoid having to manually return control to the editor from the
subprocess.

llvm-svn: 220685
2014-10-27 17:13:33 +00:00
Reid Kleckner d7857f05f4 Add frontend support for __vectorcall
Wire it through everywhere we have support for fastcall, essentially.

This allows us to parse the MSVC "14" CTP headers, but we will
miscompile them because LLVM doesn't support __vectorcall yet.

Reviewed By: Aaron Ballman

Differential Revision: http://reviews.llvm.org/D5808

llvm-svn: 220573
2014-10-24 17:42:17 +00:00
Justin Bogner 5a6a2fcdee Driver: Include driver diagnostics when we --serialize-diagnostics
Currently, when --serialize-diagnostics is passed this only includes
the diagnostics from clang -cc1, and driver diagnostics are
dropped. This causes issues for tools that use the serialized
diagnostics, since stderr is lost and these diagnostics aren't seen at
all.

We handle this by merging the diagnostics from the CC1 process and the
driver diagnostics into a single file when the driver invokes CC1.

Fixes rdar://problem/10585062

llvm-svn: 220525
2014-10-23 22:20:11 +00:00
Richard Smith feb54b6ded Refactor implementation of 'exclude header'.
This was not a real header role, and was never exposed to clients of ModuleMap.
Remove the enumeration value for it and track it as marking the header as
'known' rather than creating an extra KnownHeader entry that *every single*
client ignores.

llvm-svn: 220460
2014-10-23 02:01:19 +00:00
Alexey Bataev 03b340a3a5 [OPENMP] Codegen for 'private' clause in 'parallel' directive.
This patch generates some helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by default (with the default constructor, if any). In outlined function references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables and implicit barier is set by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D4752

llvm-svn: 220262
2014-10-21 03:16:40 +00:00
Justin Bogner e1a33d1e4c Driver: Make FailingCommand mandatory for generateCompilationDiagnostics
We currently use a null FailingCommand when generating crash reports
as an indication that the cause is FORCE_CLANG_DIAGNOSTICS_CRASH, the
environment variable that exists to test crash dumps. This means that
our tests don't actually cover real crashes at all, and adds a more
complicated code path that's only used in the tests.

Instead, we can have the driver synthesize that every command failed
and just call generateCompilationDiagnostics normally.

llvm-svn: 220234
2014-10-20 21:02:05 +00:00
Hans Wennborg 1a27e04af9 Driver: support detecting driver mode when clang has a version suffix without dash (PR21094)
Clang would previously not get into C++ mode when invoked as 'clang++3.6'
(though clang++-3.6 would work).

I found the previous loop logic in this function confusing; hopefully this
makes it a little clearer.

Differential Revision: http://reviews.llvm.org/D5833

llvm-svn: 220052
2014-10-17 17:07:59 +00:00
Hans Wennborg 1e46ef4e08 Speculatively fix GCC 4.7 build after r219938
llvm-svn: 219941
2014-10-16 17:57:41 +00:00
David Blaikie 92c8c95943 Use iterators and algorithms to possibly make this code a bit tidier
(also, the code executed once the element was found was split half
inside the loop and half after it - now put it all together after the
find operation)

I'm a bit concerned that this code is rather untested (commenting out
this whole function and running check-clang doesn't fail any tests)...

And I wish I had polymorphic lambdas.

llvm-svn: 219938
2014-10-16 17:23:58 +00:00
Hans Wennborg 0abd4c4ed2 Use array_lengthof; NFC.
llvm-svn: 219935
2014-10-16 16:54:36 +00:00
Kaelyn Takata ab61e702bd Add llvm_unreachable after switch to avoid warnings about a missing
return.

Forgot to add this in r219818.

llvm-svn: 219820
2014-10-15 18:03:26 +00:00
Kaelyn Takata b2e71de23e Drop unneccessary default case from switch introduced in r219809
This silences:
../tools/clang/tools/libclang/CIndex.cpp:6451:3: warning: default label
in switch which covers all enumeration values [-Wcovered-switch-default]

llvm-svn: 219818
2014-10-15 17:46:18 +00:00
Anton Yartsev 39323f95cc [analyzer] Perl scripts are run differently from makefiles. Sometimes additional utilities are involved, e.g. 'env' utility that present in MSYS but is missing in MinGW. The patch unifies launch of "c++-analyzer" and "ccc-analyzer".
llvm-svn: 219812
2014-10-15 17:13:02 +00:00
Argyrios Kyrtzidis 4e0854f23c [libclang] Add function to retrieve storage class in libclang.
Patch by guibufolo!

llvm-svn: 219809
2014-10-15 17:05:31 +00:00
Rafael Espindola d465be8ebd Update for llvm api change.
llvm-svn: 219800
2014-10-15 16:12:57 +00:00