Commit Graph

2627 Commits

Author SHA1 Message Date
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
David Blaikie d4da8728ba Provide operator<< for stream output of DeclarationNames
ASTDumper was already trying to do this & instead got an implicit bool
conversion by surprise (thus printing out 0 or 1 instead of the name of
the declaration). To avoid that issue & simplify call sites, simply make
it the normal/expected operator<<(raw_ostream&, ...) overload & simplify
all the existing call sites. (bonus: this function doesn't need to be a
member or friend, it's just using public API in DeclarationName)

llvm-svn: 181832
2013-05-14 21:04:00 +00:00
Daniel Jasper 6e3506f212 Update clang-format emacs integration.
- Remove free variables
- Add function clang-format-buffer, e.g. for before-save-hooks
- Wrap restoring windows in an unwind-protect

Patch by Stephen Gildea!

llvm-svn: 181766
2013-05-14 08:48:24 +00:00
Rafael Espindola 77056237d7 Update for LLVM interface change in r181680.
llvm-svn: 181681
2013-05-13 01:24:18 +00:00
Rafael Espindola 3ae00052cd Cleanup handling of UniqueExternalLinkage.
This patch renames getLinkage to getLinkageInternal. Only code that
needs to handle UniqueExternalLinkage specially should call this.

Linkage, as defined in the c++ standard, is provided by
getFormalLinkage. It maps UniqueExternalLinkage to ExternalLinkage.

Most places in the compiler actually want isExternallyVisible, which
handles UniqueExternalLinkage as internal.

llvm-svn: 181677
2013-05-13 00:12:11 +00:00
Alexander Kornienko 88a0d939de Reformat clang-format help strings, filter out irrelevant options.
Summary: +updated ClangFormat.rst

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 181617
2013-05-10 18:12:00 +00:00
Alexander Kornienko 70f6b3b631 Updated clang-format help messages for -offset and -length
llvm-svn: 181593
2013-05-10 13:18:17 +00:00
Alexander Kornienko fa94cbb70f Minor clarifications in help messages and a comment.
llvm-svn: 181591
2013-05-10 13:04:20 +00:00
Alexander Kornienko 49149677d9 Config file support for clang-format, part 2.
Summary:
Adds actual config file reading to the clang-format utility.
Configuration file name is .clang-format. It is looked up for each input file
in its parent directories starting from immediate one. First found .clang-format
file is used. When using standard input, .clang-format is searched starting from
the current directory.
Added -dump-config option to easily create configuration files.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, jordan_rose, kimgr

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

llvm-svn: 181589
2013-05-10 11:56:10 +00:00
Argyrios Kyrtzidis 1030f26261 [libclang] Add a null check in CursorVisitor::visitPreprocessedEntities.
rdar://13680583

llvm-svn: 181352
2013-05-07 20:37:17 +00:00
Daniel Jasper ee48c856e2 Further fix to clang-format emacs integration.
This is just a slight improvement for the fix in r181299, which fixes
formatting the very last line of a file.

llvm-svn: 181303
2013-05-07 10:04:47 +00:00
Daniel Jasper f7bec9b4ed Fix clang-format emacs integration in last line.
Emacs seems to have a line that is just past the last character of the
buffers content. This needs to be handled specially so that clang-format
is not called with an invalid -offset.

llvm-svn: 181299
2013-05-07 09:25:29 +00:00
Argyrios Kyrtzidis fe6a01253e Have the RecursiveASTVisitor traverse the type source info of an objc class message.
llvm-svn: 181237
2013-05-06 19:08:57 +00:00
Alexander Kornienko c860266e0f Added Mozilla style, cleaned get*Style methods.
Summary: Patch based on a patch by Ehsan Akhgari.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 181196
2013-05-06 14:11:27 +00:00
Douglas Gregor 30071cead9 Remove DiagnosticConsumer::clone(), a bad idea that is now unused.
llvm-svn: 181070
2013-05-03 23:07:45 +00:00
Argyrios Kyrtzidis 37e48ff547 [Preprocessor] For the MacroExpands preprocessor callback, also pass the MacroArgs object that provides information about
the argument tokens for a function macro.

llvm-svn: 181065
2013-05-03 22:31:32 +00:00
Bill Wendling 952e8dfa8c Remove redundant flag.
llvm-svn: 180968
2013-05-02 22:53:00 +00:00
Bill Wendling 3dfc28782f We don't want FP elimination when doing an Apple-style build.
llvm-svn: 180950
2013-05-02 21:09:11 +00:00
Daniel Jasper 5f99742632 Basic clang-format integration for BBEdit.
Thanks to Avi Drissman!

llvm-svn: 180933
2013-05-02 17:37:36 +00:00