Commit Graph

2645 Commits

Author SHA1 Message Date
James Dennett 9ad9959e51 Bug fix: Make RecursiveASTVisitor<T>::TraverseLambdaExpr call
WalkUpFromLambdaExpr, so that the Visit* functions are called
on that AST node.

llvm-svn: 185277
2013-06-30 03:13:35 +00:00
Alexander Kornienko 1e80887d63 Use lexing mode based on FormatStyle.Standard.
Summary:
Some valid pre-C++11 constructs change meaning when lexed in C++11
mode, e.g.
#define x(_a) printf("foo"_a);
(example from http://llvm.org/bugs/show_bug.cgi?id=16342). "foo"_a is treated as
a user-defined string literal when parsed in C++11 mode.
In order to deal with this correctly, we need to set lexing mode according to
which standard the code conforms to. We already have a configuration value for
this (FormatStyle.Standard), which seems to be appropriate to use in this case
as well.

Reviewers: klimek

CC: cfe-commits, gribozavr

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

llvm-svn: 185149
2013-06-28 12:51:24 +00:00
Rafael Espindola b34c1fdfd4 Don't use PathV1.h in CIndexCodeCompletion.cpp.
llvm-svn: 184940
2013-06-26 12:54:23 +00:00
Rafael Espindola 839f6e8c6d Remove dead include.
llvm-svn: 184939
2013-06-26 12:49:58 +00:00
Rafael Espindola ccc6ea6c0b Don't use PathV1.h in cc1as_main.cpp.
llvm-svn: 184938
2013-06-26 12:48:34 +00:00
Rafael Espindola c888979879 Remove unused header.
llvm-svn: 184937
2013-06-26 12:46:06 +00:00
Rafael Espindola 9678d27140 Use llvm::sys::fs::getMainExecutable.
llvm-svn: 184915
2013-06-26 05:03:40 +00:00
Eric Christopher 89d2b74245 Reorder builds based by ordering.
llvm-svn: 184794
2013-06-25 00:21:29 +00:00
Reid Kleckner 8a36502a60 [AST] Introduce a new DecayedType sugar node
The goal of this sugar node is to be able to look at an arbitrary
FunctionType and tell if any of the parameters were decayed from an
array or function type.  Ultimately this is necessary to implement
Microsoft's C++ name mangling scheme, which mangles decayed arrays
differently from normal pointers.

Reviewers: rsmith

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

llvm-svn: 184763
2013-06-24 17:51:48 +00:00
Matt Beaumont-Gay 4cd3c9adf9 Add some invalid-decl checks to clang_Type_getOffsetOf.
print-size-type.cpp was checking for specific record layout output for invalid
decls; I've removed the checks but left the records as tests for not crashing.

llvm-svn: 184751
2013-06-24 16:12:35 +00:00
Dmitri Gribenko 02489eb406 Comment parsing: allow "\param ..." to describe variadic arguments
Original patch by Fariborz Jahanian; extended by me.

Fixes rdar://14124644

llvm-svn: 184688
2013-06-24 04:41:32 +00:00
Dmitri Gribenko d666293435 Comment parsing: followup to r184610: allow multiple \returns
Remove unneeded member in CommentSema, add a test for the XML schema (the
schema already allowed multiple paragraphs in <ResultDiscussion>, but there
were no tests for that), fix HTML generation (it is not allowed to have <p>
inside <dl>).

llvm-svn: 184652
2013-06-22 23:03:37 +00:00
Fariborz Jahanian fb6f6f61ca [document parsing]: Allow multiple adjacent \return and the like
commands. Render them properly in XML output.
// rdar://14207725

llvm-svn: 184610
2013-06-21 23:49:29 +00:00
Bill Wendling da1e3e737a Update to pass in pointers intead of references.
llvm-svn: 184176
2013-06-18 07:22:05 +00:00
Dmitri Gribenko 3f31bd185a Simplify a loop in ProcessCodeCompleteResults(). Pointed out by David Blaikie
llvm-svn: 184169
2013-06-18 04:41:50 +00:00
Dmitri Gribenko 9fdd7e6d27 ArrayRef'ize CodeCompletionContext::getNumSelIdents()
llvm-svn: 184168
2013-06-18 04:02:26 +00:00
Rafael Espindola 1600a53bc0 Include PathV1.h only where it is used.
llvm-svn: 184090
2013-06-17 17:23:47 +00:00
Reid Kleckner 898229ab4b [Driver] Refactor clang driver to use LLVM's Option library
The big changes are:
- Deleting Driver/(Arg|Opt)*
- Rewriting includes to llvm/Option/ and re-sorting
- 'using namespace llvm::opt' in clang::driver
- Fixing the autoconf build by adding option everywhere

As discussed in the review, this change includes using directives in
header files.  I'll make follow up changes to remove those in favor of
name specifiers.

Reviewers: espindola

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

llvm-svn: 183989
2013-06-14 17:17:23 +00:00
Rafael Espindola dcf73d2275 Don't depend on the transitive inclusion of PathV1.h.
llvm-svn: 183945
2013-06-13 21:09:29 +00:00
Rafael Espindola 18556de316 Use the sys::RemoveFileOnSignal that takes a StringRef.
llvm-svn: 183944
2013-06-13 21:02:40 +00:00
Rafael Espindola cb4bb19070 Use the sys::ExecuteAndWait that takes StringRefs.
Also don't depend on Program.h including PathV1.h.

llvm-svn: 183935
2013-06-13 20:08:52 +00:00
Rafael Espindola 0725a7d972 Update for llvm change.
llvm-svn: 183930
2013-06-13 19:25:45 +00:00
Benjamin Kramer 601a2d847b libclang: Remove clang::RemapFiles, it's dead code.
llvm-svn: 183902
2013-06-13 13:57:48 +00:00
Benjamin Kramer e3868e46fb libclang: Port CIndexer::getClangResourcesPath to PathV2. No functionality change.
llvm-svn: 183901
2013-06-13 13:56:37 +00:00
Richard Smith cc1b96d356 PR12086, PR15117
Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).

This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.

llvm-svn: 183872
2013-06-12 22:31:48 +00:00
Rafael Espindola a3346d8765 Use the global functions instead of the Program methods.
llvm-svn: 183861
2013-06-12 20:44:26 +00:00
Rafael Espindola be5138885d Include PathV1.h in files that use it.
This is preparation for replacing Path.h with PathV2.h.

llvm-svn: 183781
2013-06-11 19:59:07 +00:00
Manuel Klimek c00dd83583 Make it possible to assign clang-format-buffer to a keybinding.
Patch by Chris Gray.

llvm-svn: 183739
2013-06-11 12:00:24 +00:00
Reid Kleckner 99dfe95bdd [clang-format] Don't flash an ugly cmd prompt in Vim on Windows
Reviewers: klimek

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

llvm-svn: 183654
2013-06-10 14:16:26 +00:00
Argyrios Kyrtzidis f7b32a0bd0 [libclang] CMake: add an option to control building libclang as a static library (off by default)
This avoids building libclang twice by default.

llvm-svn: 183437
2013-06-06 19:51:37 +00:00
Hans Wennborg 5752dd46ac clang-check: add missing space in Makefile
llvm-svn: 183406
2013-06-06 13:24:44 +00:00
Benjamin Kramer a2b3b697a3 clang-check: Link the static analyzer in the Makefile build too.
llvm-svn: 183404
2013-06-06 13:16:41 +00:00
Pavel Labath c3282c0b3c Add support for static analysis to clang-check
Summary:
This adds a command line argument '-analyze' to clang-check which runs the
clang static analyzer on the source files.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 183399
2013-06-06 12:35:43 +00:00
Pavel Labath 951ad647a0 clang-check: Enable specification of additional compiler arguments
Summary:
This adds two command-line parameters: -extra-arg and -extra-arg-before, which
enable the user to pass additional parameters to the compiler command.

Reviewers: klimek

CC: cfe-commits

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

llvm-svn: 183320
2013-06-05 16:23:30 +00:00
Argyrios Kyrtzidis 990b386117 [libclang] When annotating tokens, don't override a property annotation with a getter/setter method annotation.
rdar://13764549

llvm-svn: 183242
2013-06-04 18:24:30 +00:00
Anna Zaks 9f53c950df [analyzer] Add --override-compiler option to scan-build.
The new advanced option ensures ccc-analyze is used even when better
interposition methods are available.

llvm-svn: 182981
2013-05-31 02:31:07 +00:00
Daniel Jasper 2714ba03f6 Fix default value of clang-format-diff's -p option.
This way, it has the same default as 'patch' and also the example in the
code makes more sense as it is explicitly setting -p 1.

llvm-svn: 182923
2013-05-30 11:50:20 +00:00
Argyrios Kyrtzidis 55fb21efbb [libclang] When indexing a @synthesize, don't consider that it defines a getter/setter if one is already defined by the user.
Fixes rdar://13925258

llvm-svn: 182895
2013-05-29 23:58:31 +00:00
Roman Divacky 95ad7794a9 Turn CLANG_ENABLE_{ARCMT,REWRITER,STATIC_ANALYZER} into proper options so that
users can disable those. Just like in autoconf generated makefiles.

llvm-svn: 182881
2013-05-29 21:09:18 +00:00
Rafael Espindola 50df3a02be Fix linkage computation for derived types in inline functions.
John noticed that the fix for pr15930 (r181981) didn't handle indirect
uses of local types. For example, a pointer to local struct, or a
function that returns it.

One way to implement this would be to recursively look for local
types. This would look a lot like the linkage computation itself for
types.

To avoid code duplication and utilize the existing linkage cache, this
patch just makes the computation of "type with no linkage but
externally visible because it is from an inline function"  part of the
linkage computation itself.

llvm-svn: 182711
2013-05-25 17:16:20 +00:00
Argyrios Kyrtzidis 2702101a07 [libclang] Add logging for clang_createTranslationUnit.
llvm-svn: 182682
2013-05-24 22:24:07 +00:00
Daniel Jasper e7a500160e clang-format integration for git.
Put this somewhere on your path and use:

git clang-format

Awesome work by Mark Lodato. Many thanks!

llvm-svn: 182596
2013-05-23 17:53:42 +00:00
Jordan Rose d8fb478b36 scan-build: use the xcodebuild specified by the user.
This is important if the user has multiple Xcodes installed on their
system -- we use xcodebuild to do a version check, and therefore we need
to make sure we match the actual build command.

Reported by Howard Ling!

llvm-svn: 182498
2013-05-22 18:09:57 +00:00
Daniel Jasper a3c14575ef Fix off-by-one error in clang-format's emacs integration.
llvm-svn: 182395
2013-05-21 17:05:40 +00:00
Daniel Jasper a8048b8216 Fix behavior of clang-format's -cursor flag.
llvm-svn: 182386
2013-05-21 14:21:46 +00:00
Daniel Jasper 2a250b8b49 Let clang-format move the cursor appropriately.
With this patch, clang-format will try to keep the cursor at the
original code position in editor integrations (implemented for emacs and
vim). This means, after formatting, clang-format will try to keep the
cursor on the same character of the same token.

llvm-svn: 182373
2013-05-21 12:21:39 +00:00
Alexander Kornienko 006b5c89ce Clang-format: allow -style="{yaml/json}" on command line
Summary: + improved handling of default style and predefined styles.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 182205
2013-05-19 00:53:30 +00:00
Dmitri Gribenko 62770bea4b libclang: add a function to check whether a member function is pure virtual
Patch by Seth Fowler.

llvm-svn: 182139
2013-05-17 18:38:35 +00:00
Daniel Jasper 5b38f744e8 Add basic clang-format integration for sublime text.
llvm-svn: 182015
2013-05-16 15:08:25 +00:00
Richard Smith ba71c08523 First pass of semantic analysis for init-captures: check the initializer, build
a FieldDecl from it, and propagate both into the closure type and the
LambdaExpr.

You can't do much useful with them yet -- you can't use them within the body
of the lambda, because we don't have a representation for "the this of the
lambda, not the this of the enclosing context". We also don't have support or a
representation for a nested capture of an init-capture yet, which was intended
to work despite not being allowed by the current standard wording.

llvm-svn: 181985
2013-05-16 06:20:58 +00:00