Commit Graph

3660 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 113387e08e [index] Print and test module import references.
llvm-svn: 262208
2016-02-29 07:56:07 +00:00
Alexey Bataev 005248ac8a [OPENMP 4.5] Codegen for member decls in 'lastprivate' clause.
OpenMP 4.5 allows to privatize non-static member decls in non-static
member functions. Patch captures such decls by reference in general (for
bitfields, by value) and then operates with this capture. For bitfields,
at the end of codegen for lastprivates original bitfield is updated with the value of captured copy.

llvm-svn: 261824
2016-02-25 05:25:57 +00:00
Chris Bieneman 5b21af5222 [CMake] Add install-clang-format target by migrating to add_clang_tool
This change migrates clang-format to add_clang_tool which makes a component-based install target. To support component-based installation the extra installed scripts all need to have the "clang-format" component too.

llvm-svn: 261680
2016-02-23 20:33:15 +00:00
Anton Yartsev 6e135f45a8 [analyzer][scan-build] Non-existing directory for scan-build output.
Makes scan-build successfully accept non-existing output directories provided via "-o" option. The directory is created in this case. This behavior is conforming to the old perl scan-build implementation.
(http://reviews.llvm.org/D17091)

llvm-svn: 261480
2016-02-21 17:04:26 +00:00
Argyrios Kyrtzidis 223838aea2 [c-index-test] CMake: When installing c-index-test to a different prefix directory, add an rpath so that
it can find libclang.

llvm-svn: 261445
2016-02-20 20:34:55 +00:00
Yury Gribov a6560ebe4c [analyzer] Add --force-analyze-debug-code option to scan-build
to force debug build and hopefully enable more precise warnings.

Static Analyzer is much more efficient when built in debug mode
(-UNDEBUG) so we advice users to enable it manually. This may be
inconvenient in case of large complex projects (think about Linux
distros e.g. Android or Tizen). This patch adds a flag to scan-build
which inserts -UNDEBUG automatically.

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

llvm-svn: 261204
2016-02-18 11:08:46 +00:00
Alexey Bataev 417089fc7e [OPENMP 4.5] Codegen support for data members in 'firstprivate' clause.
Added codegen for captured data members in non-static member functions.

llvm-svn: 261089
2016-02-17 13:19:37 +00:00
Chandler Carruth ce55f56fbc [cmake] Revert r260742 (and r260744) to improve order file support.
This appears to be passing '-Wl,-order_file' to Linux link commands,
which then causes the linker to silently, behind the scenes, write the
output to 'rder_file' instead of somewhere else. Will work with Chris to
figure out the proper support for this, but so far there are numerous
people who can't get Clang to update when they build because of this.

llvm-svn: 261054
2016-02-17 02:13:35 +00:00
Alexey Bataev 3392d76081 [OPENMP] Improved handling of pseudo-captured expressions in OpenMP.
Expressions inside 'schedule'|'dist_schedule' clause must be captured in
combined directives to avoid possible crash during codegen. Patch
improves handling of such constructs

llvm-svn: 260954
2016-02-16 11:18:12 +00:00
Argyrios Kyrtzidis d571908445 [AST/index] Introduce an option 'SuppressTemplateArgsInCXXConstructors' in printing policy.
Enable it for USRs and names when indexing.
Forward references can have different template argument names; including them
makes USRs and names unstable, since the name depends on whether we saw a forward reference or not.

llvm-svn: 260866
2016-02-15 01:32:36 +00:00
Saleem Abdulrasool 9b0ac33457 silence -Wreturn-type warnings
These codepaths would generate warnings with GCC on linux even though the switch
was covered.  Add llvm_unreachable markers to indicate that the switch should be
covered.  NFC.

llvm-svn: 260865
2016-02-15 00:36:52 +00:00
Argyrios Kyrtzidis ca741cef3e [index] Factor libclang's functionality to determing the mangled name of symbols into the clangIndex library.
llvm-svn: 260858
2016-02-14 22:30:14 +00:00
Benjamin Kramer 24c2a9a4e4 Don't leak the ASTUnit when done with testing.
Found by lsan.

llvm-svn: 260850
2016-02-14 13:18:06 +00:00
NAKAMURA Takumi 15c4ce4c50 c-index-test: Fix libdeps corresponding to r260841.
llvm-svn: 260847
2016-02-14 09:19:04 +00:00
Argyrios Kyrtzidis 8513ab6080 [c-index-test] Fix a gcc build error.
llvm-svn: 260844
2016-02-14 07:08:31 +00:00
Argyrios Kyrtzidis 3b72d0f333 [index] Fix gcc builds.
llvm-svn: 260843
2016-02-14 06:53:20 +00:00
Argyrios Kyrtzidis 6fdcb9c590 [index] Enhance c-index-test tool and have it link and test the clangIndex library directly.
llvm-svn: 260842
2016-02-14 06:39:11 +00:00
Argyrios Kyrtzidis 469c1367f1 [index] Allow calling createIndexingAction() without passing another action to wrap over.
llvm-svn: 260841
2016-02-14 06:39:03 +00:00
Benjamin Kramer 0772c42385 Reduce the number of implicit StringRef->std::string conversions by threading StringRef through more APIs.
No functionality change intended.

llvm-svn: 260815
2016-02-13 13:42:54 +00:00
NAKAMURA Takumi 93e0200e23 libclang/CMakeLists.txt: Prune IndexingContext.h out of ADDITIONAL_HEADERS. VS IDE uses it.
llvm-svn: 260802
2016-02-13 04:01:49 +00:00
Argyrios Kyrtzidis f4fb85b1c7 [libclang] Separate the underlying indexing functionality of libclang and introduce it into the clangIndex library.
It is a general goodness for libclang itself to mostly be a wrapper of functionality provided by the libraries.

llvm-svn: 260760
2016-02-12 23:10:59 +00:00
Chris Bieneman 3878bc4a33 [CMake] Improve the clang order-file generation workflow
Summary:
This commit re-lands r259862. The underlying cause of the build breakage was an incorrectly written capabilities test. In tools/Driver/CMakeLists.txt I was attempting to check if a linker flag worked, the test was passing it to the compiler, not the linker. CMake doesn't have a linker test, so we have a hand-rolled one.

Original Patch Review: http://reviews.llvm.org/D16896

Original Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

Reviewers: bogner

Subscribers: cfe-commits

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

llvm-svn: 260742
2016-02-12 21:36:55 +00:00
Alexey Bataev 4244be25bd [OPENMP] Rename OMPCapturedFieldDecl to OMPCapturedExprDecl, NFC.
OMPCapturedExprDecl allows caopturing not only of fielddecls, but also
other expressions. It also allows to simplify codegen for several
clauses.

llvm-svn: 260492
2016-02-11 05:35:55 +00:00
Anton Yartsev 5cba8d5fb5 [analyzer] Windows: launch scan-build from an arbitrary location.
The following batch files allow to launch scan-build from an arbitrary location if path to clang\tools\scan-build-py\bin is added to %PATH%.

llvm-svn: 260420
2016-02-10 19:46:41 +00:00
Eugene Zelenko 0a4f3f4373 Fix some Clang-tidy readability-redundant-control-flow warnings; other minor fixes.
Differential revision: http://reviews.llvm.org/D17060

llvm-svn: 260414
2016-02-10 19:11:58 +00:00
Daniel Jasper 36e979af73 clang-format sort include use the source file name to determine the
"main include" that will be the 1st include (category 0).

Because the clang-format visual studio extension does not pass the file
name and use the standard input, sort include cannot find a "main
include":

Testing fix on llvm\tools\clang\lib\Format\Format.cpp:
Original file:
  #include "clang/Format/Format.h"
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Without fix, selecting the includes and running visual studio
clang-format:
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Format/Format.h"
  #include "clang/Lex/Lexer.h"

With fix, selecting the includes and running visual studio clang-format:
  #include "clang/Format/Format.h"
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Test 2 with main header not at the start:
Original file:
  ...
  #include "clang/Format/Format.h"
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Without fix, selecting the includes and running visual studio
clang-format:
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Format/Format.h"
  #include "clang/Lex/Lexer.h"

With fix, selecting the includes and running visual studio clang-format:
  #include "clang/Format/Format.h"
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Patch by Jean-Philippe Dufraigne, thank you.
Review: http://reviews.llvm.org/D16524

llvm-svn: 260378
2016-02-10 12:42:58 +00:00
NAKAMURA Takumi cd4d945525 libclang: Enable skip-parsed-bodies on win32.
I guess it would be working since Rafael's r187619.

llvm-svn: 260344
2016-02-10 01:29:57 +00:00
Argyrios Kyrtzidis ca4ad1937c [libclang] indexing: make sure to not visit init-list expressions twice.
llvm-svn: 260255
2016-02-09 19:07:24 +00:00
Argyrios Kyrtzidis 49385e8bd5 [libclang] indexing: handle 'TopLevelDeclInObjCContainers' at the point where they are reported.
It isn't much benefit and doesn't worth the complexity to try to handle them after the container is encountered.

llvm-svn: 260254
2016-02-09 19:07:21 +00:00
Argyrios Kyrtzidis a4cffec19e [libclang] indexing: for a synthesized property reference have the parent be the ObjC implementation decl.
llvm-svn: 260253
2016-02-09 19:07:19 +00:00
Argyrios Kyrtzidis af75b19736 [libclang] indexing: Have the semantic container of synthesized ObjC getter/setter methods be the implementation decl.
Matches the behavior of other ObjC methods.

llvm-svn: 260250
2016-02-09 19:07:07 +00:00
Aaron Ballman 774e8fe49a Move static functions returning UDTs outside of the extern "C" block. Silences an MSVC warning, and reduces the number of exported symbols.
llvm-svn: 260104
2016-02-08 15:52:13 +00:00
Alexey Bataev 90c228f0ba [OPENMP 4.5] Ccapture/codegen of private non-static data members.
OpenMP 4.5 introduces privatization of non-static data members of current class in non-static member functions.
To correctly handle such kind of privatization a new (pseudo)declaration VarDecl-based node is added. It allows to reuse an existing code for capturing variables in Lambdas/Block/Captured blocks of code for correct privatization and codegen.

llvm-svn: 260077
2016-02-08 09:29:13 +00:00
Saleem Abdulrasool 5e03c655a3 Index: provide adjustment thunk information for C++ manglings
Add support for exposing the adjustment thunk for virtual methods as
appropriate.

llvm-svn: 260011
2016-02-06 22:36:34 +00:00
Chris Bieneman 06d29a2466 [CMake] One more try to make CMake clean up after itself
Seriously... CMake... You're on my list...

llvm-svn: 259873
2016-02-05 03:59:08 +00:00
Chris Bieneman dc76e70b2a Revert "[CMake] Improve the clang order-file generation workflow"
This reverts commit r259862, and attempts to fix builder CMakeCaches.

Will try this again some other time...

Conflicts:

	CMakeLists.txt
	tools/driver/CMakeLists.txt

llvm-svn: 259872
2016-02-05 03:40:37 +00:00
Chris Bieneman 3ab12b144a [CMake] Trying to fix a bot failure I introduced in r259862
CMake caching behavior makes me sad.

llvm-svn: 259864
2016-02-05 01:27:31 +00:00
Chris Bieneman 1681091991 [CMake] Improve the clang order-file generation workflow
Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

Reviewers: bogner

Subscribers: cfe-commits

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

llvm-svn: 259862
2016-02-05 01:22:03 +00:00
Arpith Chacko Jacob 05bebb578a [OpenMP] Parsing + sema for target parallel for directive.
Summary:
This patch adds parsing + sema for the target parallel for directive along with testcases.

Reviewers: ABataev

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

llvm-svn: 259654
2016-02-03 15:46:42 +00:00
Manman Ren 5b786407d0 Class Property: class property and instance property can have the same name.
Add "enum ObjCPropertyQueryKind" to a few APIs that used to only take the name
of the property: ObjCPropertyDecl::findPropertyDecl,
ObjCContainerDecl::FindPropertyDeclaration,
ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass,
ObjCImplDecl::FindPropertyImplDecl, and Sema::ActOnPropertyImplDecl.

ObjCPropertyQueryKind currently has 3 values:
OBJC_PR_query_unknown, OBJC_PR_query_instance, OBJC_PR_query_class

This extra parameter specifies that we are looking for an instance property with
the given name, or a class property with the given name, or any property with
the given name (if both exist, the instance property will be returned).

rdar://23891898

llvm-svn: 259070
2016-01-28 18:49:28 +00:00
Benjamin Kramer 5e45630edf Update for LLVM change.
llvm-svn: 258918
2016-01-27 10:01:30 +00:00
Chris Bieneman 2bf68c6c1c Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

    "This is the way [autoconf] ends
    Not with a bang but a whimper."
    -T.S. Eliot

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: klimek, cfe-commits

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

llvm-svn: 258862
2016-01-26 21:30:40 +00:00
Arpith Chacko Jacob e955b3d3fe [OpenMP] Parsing + sema for target parallel directive.
Summary:
This patch adds parsing + sema for the target parallel directive and its clauses along with testcases.

Reviewers: ABataev

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

Rebased to current trunk and updated test cases.

llvm-svn: 258832
2016-01-26 18:48:41 +00:00
Arpith Chacko Jacob 3cf89040b0 [OpenMP] Parsing + sema for defaultmap clause.
Summary:
This patch adds parsing + sema for the defaultmap clause associated with the target directive (among others).

Reviewers: ABataev

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

llvm-svn: 258817
2016-01-26 16:37:23 +00:00
Daniel Jasper 18b1de3ec6 clang-format-diff: Replace hard-code default for clang-format binary with flag.
Patch by Kwasi Mensah, thank you.

llvm-svn: 258328
2016-01-20 18:55:57 +00:00
Aaron Ballman 01dc157ce8 Silencing several -Wcast-qual warnings; NFC.
llvm-svn: 258317
2016-01-20 15:25:30 +00:00
Chris Bieneman b6a296ca62 [CMake] Creating add_clang_tool macro to wrap add_clang_executable and generate install actions and targets.
This change brings forward the LLVM convention that "executables" are just runnable binaries, and "tools" are executables that are part of the project's install.

Having this abstraction will allow us to simplify some of the tool CMakeLists files, and it will standardize some of the install behaviors.

llvm-svn: 258209
2016-01-19 22:41:51 +00:00
Samuel Antao 7259076032 [OpenMP] Parsing + sema for "target exit data" directive.
Patch by Arpith Jacob. Thanks!

llvm-svn: 258177
2016-01-19 20:04:50 +00:00
Samuel Antao df67fc468e [OpenMP] Parsing + sema for "target enter data" directive.
Patch by Arpith Jacob. Thanks!

llvm-svn: 258165
2016-01-19 19:15:56 +00:00
Argyrios Kyrtzidis 785705b399 [libclang] Introduce APIs for evaluating a cursor and checking if a macro is builtin/function.
rdar://24091595

llvm-svn: 257968
2016-01-16 00:20:02 +00:00
Joerg Sonnenberger 9db01aaf78 Avoid self-assignment of SmallString, trigger UB behavior down the road.
llvm-svn: 257947
2016-01-15 22:29:34 +00:00
Carlo Bertolli b4adf55e0f Add OpenMP dist_schedule clause to distribute directive and related regression tests.
llvm-svn: 257917
2016-01-15 18:50:31 +00:00
Chris Bieneman 9c92d67b78 [CMake] Move the install logic for libclang's headers into the libclang CMakelists
This makes it so if you disable building libclang you won't install the headers as part of the 'install' target.

llvm-svn: 257828
2016-01-14 22:48:45 +00:00
Eugene Zelenko a78996e2e6 Install scan-build and scan-view only if Static Analyzer was enabled.
llvm-svn: 257562
2016-01-13 02:03:50 +00:00
Laszlo Nagy bc68758dd5 D9600: Add scan-build python implementation
llvm-svn: 257533
2016-01-12 22:38:41 +00:00
Xiuli Pan 9c14e28211 [OpenCL] Pipe type support
Summary:
Support for OpenCL 2.0 pipe type.
This is a bug-fix version for bader's patch reviews.llvm.org/D14441


Reviewers: pekka.jaaskelainen, Anastasia

Subscribers: bader, Anastasia, cfe-commits

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

llvm-svn: 257254
2016-01-09 12:53:17 +00:00
Sergey Kalinichev b8d516a8d9 [libclang] Handle AutoType in clang_getTypeDeclaration
Differential Revision: http://reviews.llvm.org/D13001

llvm-svn: 257043
2016-01-07 09:20:40 +00:00
Erik Verbruggen 8f9d180f09 Show inclusions from a preamble in clang_getInclusions.
When reparsing a translation unit with preamble generation turned on,
no includes are found. This is due to the fact that all SLocs from
AST/PCH files are skipped as they are 'loaded', and inclusions from a
preamble are also 'loaded'. So, in case a file has a preamble, it first
needs to process those loaded inclusions, and then check for any local
inclusions. This latter one is for any includes that are not part of the
preamble, like includes half-way through a file.

This fixes PR24748.

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

llvm-svn: 256939
2016-01-06 15:12:51 +00:00
James Y Knight 7281c357b1 [TrailingObjects] Convert OffsetOfExpr.
That necessitated moving the OffsetOfNode class out of OffsetOfExpr.

llvm-svn: 256590
2015-12-29 22:31:18 +00:00
Alexander Kornienko 1a9f184734 Refactor: Simplify boolean conditional return statements in tools/libclang
Summary: Use clang-tidy to simplify boolean conditional return statements.

Reviewers: alexfh

Subscribers: alexfh, chfast, cfe-commits

Patch by Richard Thomson!

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

llvm-svn: 256498
2015-12-28 15:24:08 +00:00
James Y Knight 04ec5bfad8 [TrailingObjects] Convert ASTTemplateKWAndArgsInfo and ASTTemplateArgumentListInfo.
Doing so required separating them so that the former doesn't inherit
from the latter anymore. Investigating that, it became clear that the
inheritance wasn't actually providing real value in any case.

So also:
- Remove a bunch of redundant functions (getExplicitTemplateArgs,
  getOptionalExplicitTemplateArgs) on various Expr subclasses which
  depended on the inheritance relationship.
- Switched external callers to use pre-existing accessors that return the
  data they're actually interested in (getTemplateArgs,
  getNumTemplateArgs, etc).
- Switched internal callers to use pre-existing getTemplateKWAndArgsInfo.

llvm-svn: 256359
2015-12-24 02:59:37 +00:00
David Majnemer 2b9349db38 [clang-cl] Add support for /Brepro
The /Brepro flag controls whether or not the compiler should embed
timestamps into the object file.  Object files which do not embed
timestamps are not suitable for incremental linking but are suitable for
hermetic build systems and staged self-hosts of clang.

A normal clang spelling of this flag has been added,
-mincremental-linker-compatible.

llvm-svn: 256204
2015-12-21 22:09:34 +00:00
Alexander Kornienko fbd33be333 [scan-view] replace deprecated optparse with argparse
Summary: scan-view migrated from optparse deprecated Python module to its replacement (argparse) and resolved few conflicts with pep8

Reviewers: ddunbar, aaron.ballman, dcoughlin, jroelofs, zaks.anna

Subscribers: cfe-commits

Patch by Kirill Bobyrev!

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

llvm-svn: 256150
2015-12-21 12:19:13 +00:00
Benjamin Kramer 5c248d89f3 [libclang] Add a flag to create the precompiled preamble on the first parse.
Summary:
The current default is to create the preamble on the first reparse, aka
second parse. This is useful for clients that do not want to block when
opening a file because serializing the preamble takes a bit of time.
However, this makes the reparse much more expensive and that may be on the
critical path as it's the first interaction a user has with the source code.

YouCompleteMe currently optimizes for the first code interaction by parsing
the file twice when loaded. That's just unnecessarily slow and this flag
helps to avoid that.

Reviewers: doug.gregor, klimek

Subscribers: cfe-commits

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

llvm-svn: 255635
2015-12-15 09:30:31 +00:00
Alexey Bataev 28c75417b2 [OPENMP 4.5] Parsing/sema for 'hint' clause of 'critical' directive.
OpenMP 4.5 adds 'hint' clause to critical directive. Patch adds parsing/semantic analysis for this clause.

llvm-svn: 255625
2015-12-15 08:19:24 +00:00
Carlo Bertolli 6200a3d0f3 Add parse and sema of OpenMP distribute directive with all clauses except dist_schedule
llvm-svn: 255498
2015-12-14 14:51:25 +00:00
Saleem Abdulrasool 8aa0b80ec7 libclang: expose dllexport, dllimport attributes
These attributes were previously unexposed.  Expose them through the libclang
interfaces.  Add tests that cover both the MSVC spelling and the GNU spelling.

llvm-svn: 255273
2015-12-10 18:45:18 +00:00
Saleem Abdulrasool d5af8ae17f libclang: correct inverted logic
The complete dtor is only emitted when there is a virtual destructor.  The test
itself was incorrect, so the issue in the code was not noticed.

llvm-svn: 255225
2015-12-10 06:30:23 +00:00
NAKAMURA Takumi 2d5c6ddf74 Revert r255001, "Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule."
It causes memory leak. Some tests in test/OpenMP would fail.

llvm-svn: 255094
2015-12-09 04:35:57 +00:00
Hans Wennborg d0edbdfad1 Update clang-format-vs README
VS2013 is requried after r231084.

llvm-svn: 255029
2015-12-08 17:54:27 +00:00
Alexey Bataev 382967a2e4 [OPENMP 4.5] Parsing/sema for 'num_tasks' clause.
OpenMP 4.5 adds directives 'taskloop' and 'taskloop simd'. These directives support clause 'num_tasks'. Patch adds parsing/semantic analysis for this clause.

llvm-svn: 255008
2015-12-08 12:06:20 +00:00
Carlo Bertolli b9bfa75b28 Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule.
llvm-svn: 255001
2015-12-08 04:21:03 +00:00
Alexey Bataev 1fd4aed26b [OPENMP 4.5] parsing/sema support for 'grainsize' clause.
OpenMP 4.5 adds 'taksloop' and 'taskloop simd' directives, which have 'grainsize' clause. Patch adds parsing/sema analysis of this clause.

llvm-svn: 254903
2015-12-07 12:52:51 +00:00
Alexey Bataev b825de17b7 [OPENMP 4.5] parsing/sema support for 'nogroup' clause.
OpenMP 4.5 adds 'taskloop' and 'taskloop simd' directives. These directives have new 'nogroup' clause. Patch adds basic parsing/sema support for this clause.

llvm-svn: 254899
2015-12-07 10:51:44 +00:00
Alexey Bataev 0a6ed84a0d [OPENMP 4.5] Parsing/sema support for 'omp taskloop simd' directive.
OpenMP 4.5 adds directive 'taskloop simd'. Patch adds parsing/sema analysis for 'taskloop simd' directive and its clauses.

llvm-svn: 254597
2015-12-03 09:40:15 +00:00
Alexey Bataev a056935a2f [OPENMP 4.5] Parsing/sema analysis for 'priority' clause.
OpenMP 4.5 defines new clause 'priority' for 'task', 'taskloop' and 'taskloop simd' directives. Added parsing and sema analysis for 'priority' clause in 'task' and 'taskloop' directives.

llvm-svn: 254398
2015-12-01 10:17:31 +00:00
Alexey Bataev 49f6e78d71 [OPENMP 4.5] Parsing/sema analysis for 'taskloop' directive.
Adds initial parsing and semantic analysis for 'taskloop' directive.

llvm-svn: 254367
2015-12-01 04:18:41 +00:00
Kelvin Li a15fb1a110 [OpenMP] Parsing and sema support for thread_limit clause.
http://reviews.llvm.org/D15029

llvm-svn: 254207
2015-11-27 18:47:36 +00:00
Alexey Bataev f763027f04 [MSVC] 'property' with an empty array in array subscript expression.
MSVC supports 'property' attribute and allows to apply it to the declaration of an empty array in a class or structure definition.
For example:
```
__declspec(property(get=GetX, put=PutX)) int x[];
```
The above statement indicates that x[] can be used with one or more array indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b), and p->x[a][b] = i will be turned into p->PutX(a, b, i);
Differential Revision: http://reviews.llvm.org/D13336

llvm-svn: 254067
2015-11-25 12:01:00 +00:00
Richard Smith a205719319 Teach RAV to pass its DataRecursionQueue to derived classes if they ask for it,
to allow them to explicitly opt into data recursion despite having overridden
Traverse*Stmt or Traverse*Expr. Use this to reintroduce data recursion to the
one place that lost it when DataRecursiveASTVisitor was removed.

llvm-svn: 254041
2015-11-24 23:50:47 +00:00
Kelvin Li 099bb8c65d [OpenMP] Parsing and sema support for num_teams clause
http://reviews.llvm.org/D14802

llvm-svn: 254019
2015-11-24 20:50:12 +00:00
Richard Smith 50668455a7 Remove DataRecursiveASTVisitor; it no longer serves any purpose, since it's just an alias for RecursiveASTVisitor.
llvm-svn: 253949
2015-11-24 03:55:01 +00:00
Ehsan Akhgari 93697fa755 Make clang_Cursor_getMangling not mangle if the declaration isn't mangled
Right now clang_Cursor_getMangling will attempt to mangle any
declaration, even if the declaration isn't mangled (extern C).  This
results in a partially mangled name which isn't useful for much. This
patch makes clang_Cursor_getMangling return an empty string if the
declaration isn't mangled.

Patch by Michael Wu <mwu@mozilla.com>.

llvm-svn: 253909
2015-11-23 19:56:46 +00:00
Daniel Jasper b68aabf7fc clang-format: Make moving of the Cursor work properly when sorting #includes.
llvm-svn: 253860
2015-11-23 08:36:35 +00:00
Kelvin Li 0bff7afab5 [OpenMP] Parsing and sema support for map clause
http://reviews.llvm.org/D14134 

llvm-svn: 253849
2015-11-23 05:32:03 +00:00
Chris Bieneman 0502e98c8a Honor system specific paths of MAN pages
Summary: Caught on NetBSD.

Patch by: Kamil Rytarowski (krytarowski)

Reviewers: beanz, jroelofs

Subscribers: cfe-commits, joerg

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

llvm-svn: 253693
2015-11-20 18:49:02 +00:00
Argyrios Kyrtzidis a3e2ff19e5 [libclang] Make sure to use the raw module format for libclang parsing.
Fixes crash when passing '-gmodules' in the compiler options.
rdar://23588717

llvm-svn: 253645
2015-11-20 03:36:21 +00:00
Benjamin Kramer c02670ed50 [libclang] Add entry points that take a full command line including argv[0].
This provides both a more uniform interface and makes libclang behave like
clang tooling wrt relative paths against argv[0]. This is necessary for
finding paths to a c++ standard library relative to a clang binary given
in a compilation database. It can also be used to find paths relative to
libclang.so if the full path to it is passed in.

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

llvm-svn: 253466
2015-11-18 16:14:27 +00:00
Reid Kleckner 356be39f65 Try to fix leak in CXStringSet from r252853
llvm-svn: 253418
2015-11-18 01:06:39 +00:00
Daniel Jasper da44677082 clang-format: Enable #include sorting by default.
This has seen quite some usage and I am not aware of any issues. Also
add a style option to enable/disable include sorting. The existing
command line flag can from now on be used to override whatever is set
in the style.

llvm-svn: 253202
2015-11-16 12:38:56 +00:00
Sergey Kalinichev 8f3b187e21 [libclang] Visit TypeAliasTemplateDecl
This makes TypeAliasTemplateDecl accessible via LibClang and python bindings

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

llvm-svn: 253166
2015-11-15 13:48:32 +00:00
Sergey Kalinichev c015120b53 [libclang] Expose AutoType
Expose the AutoType via LibClang and python bindings

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

llvm-svn: 253165
2015-11-15 13:10:10 +00:00
Sergey Kalinichev 43ed98b9dd Remove some trailing whitespace
llvm-svn: 253164
2015-11-15 12:37:01 +00:00
Argyrios Kyrtzidis f10158c025 [CMake] Don't install c-index-test when LLVM_INSTALL_TOOLCHAIN_ONLY=ON.
llvm-svn: 253099
2015-11-13 22:41:14 +00:00
Jonathan Roelofs 534c4eec48 Fix build... again
llvm-svn: 253081
2015-11-13 21:04:14 +00:00
Jonathan Roelofs 814aa25a92 [scan-build] Make scan-build work whether it's installed or not
llvm-svn: 253074
2015-11-13 20:34:15 +00:00
Jonathan Roelofs 80df3d262d [scan-build] Move non user-facing utilities to share
llvm-svn: 253068
2015-11-13 19:56:07 +00:00
NAKAMURA Takumi 624922ad87 scan-build: Fix install.
llvm-svn: 253016
2015-11-13 06:48:02 +00:00
Argyrios Kyrtzidis 2cab8eec74 [CMake] If 'INTERNAL_INSTALL_PREFIX' is set, use it for determining the install destination of c-index-test and the libclang headers.
llvm-svn: 253001
2015-11-13 01:46:18 +00:00
Jonathan Roelofs 7c297074d4 Fix build
llvm-svn: 252991
2015-11-13 01:23:40 +00:00
Jonathan Roelofs 2ec2acb03e [scan-build] Create share directory similar to scan-view's
llvm-svn: 252981
2015-11-13 00:32:54 +00:00
Jonathan Roelofs 5e20518443 [scan-view] Rename 'Resources' --> 'share'
llvm-svn: 252977
2015-11-13 00:25:04 +00:00
Aaron Ballman a85d3f85df Silencing an MSVC warning about linkage specifications and C-incompatible UDTs by moving a function definition out of an extern "C" block.
llvm-svn: 252900
2015-11-12 15:25:06 +00:00
Ismail Donmez 19a17c3a16 Fix c-index-test install path
llvm-svn: 252890
2015-11-12 13:47:35 +00:00
Saleem Abdulrasool 6003443b8e libclang: add clang_Cursor_getCXXManglings
This function permits the mangling of a C++ 'structor.  Depending on the ABI and
the declaration, the declaration may contain more than one associated symbol for
a given declaration.  This allows the consumer to retrieve all of the associated
symbols for the declaration the cursor points to.

llvm-svn: 252853
2015-11-12 03:57:22 +00:00
Saleem Abdulrasool 5d92eaeb17 libclang: add new StringSet type
This allows the return of a set of CXStrings from libclang.  This is setup work
for an upcoming change to permit returning multiple mangled symbols.

llvm-svn: 252852
2015-11-12 03:57:16 +00:00
Argyrios Kyrtzidis e053d44309 [CMake] Setup an install component for libclang and c-index-test.
Also don't create libclang dylib symlinks on darwin.

llvm-svn: 252836
2015-11-12 00:46:57 +00:00
Devin Coughlin 932d88ca05 [analyzer] Fix scan-build to handle missing output directories.
Cwd::abs_path has a somewhat tricky semantics: if it's operand directory does not exist,
it'll return undefined (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=257568).
This may cause scan-build to silently ignore output directory (specified with -o) and
use /tmp instead of trying to create directory. This tiny patch fixes the problem.

A patch by Yury Gribov!

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

llvm-svn: 252797
2015-11-11 20:39:03 +00:00
Aaron Ballman 8f3f6347aa Hiding the scan-build and scan-view projects under the Misc folder in IDEs instead of having them at the root view.
llvm-svn: 252771
2015-11-11 18:13:42 +00:00
Jonathan Roelofs a3219a70be Fix build
llvm-svn: 252667
2015-11-10 22:59:18 +00:00
Jonathan Roelofs 1ff9c63204 Implement post-commit review feedback on r252662
llvm-svn: 252664
2015-11-10 22:48:11 +00:00
Jonathan Roelofs 467ab05291 Implement the fix that r252641 should have been
llvm-svn: 252662
2015-11-10 22:38:59 +00:00
Jonathan Roelofs 2a439a104b Fix missing CMake dependency introduced in r252474
llvm-svn: 252641
2015-11-10 20:01:22 +00:00
Aaron Ballman 4960df0db3 No longer creating the install-clang target for IDEs, as it was never meant for those.
llvm-svn: 252601
2015-11-10 12:51:25 +00:00
Jonathan Roelofs 9c0d3f5e6f Fix the cmake build after r252474 broke it
llvm-svn: 252489
2015-11-09 16:47:09 +00:00
Jonathan Roelofs e961432ae7 Create install targets for scan-build and scan-view
http://reviews.llvm.org/D14403

llvm-svn: 252474
2015-11-09 16:12:56 +00:00
David Majnemer d9b1a4fb71 [Sema] Implement __make_integer_seq
This new builtin template allows for incredibly fast instantiations of
templates like std::integer_sequence.

Performance numbers follow:
My work station has 64 GB of ram + 20 Xeon Cores at 2.8 GHz.

__make_integer_seq<std::integer_sequence, int, 90000> takes 0.25
seconds.

std::make_integer_sequence<int, 90000> takes unbound time, it is still
running.  Clang is consuming gigabytes of memory.

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

llvm-svn: 252036
2015-11-04 03:40:30 +00:00
Anton Yartsev 522ccb9d80 [analyzer] Preserve the order checkers were enabled/disabled.
In addition to r251524: preserve the order the checkers were enabled/disabled to be deterministic.
Additionally return the number of arguments read by 'ProcessArgs' - for debug purpose.

llvm-svn: 251552
2015-10-28 20:43:39 +00:00
Anton Yartsev 5d381bc775 [analyzer] Make inclusion/exclusion of checkers less ambiguous.
A checker may be enabled/disabled multiple times via -enable-checker and -disable-checker scan-build arguments. Currently the conflicting and repetitive arguments are passed to the analyzer as is.
With this patch only the last enable/disable of a particular checker is accepted and passed to the analyzer.
This change is mostly done for the upcoming 'config for scan-build' patch when multiple inclusions/exclusions of a checker are expected to be more common.

llvm-svn: 251524
2015-10-28 16:28:57 +00:00
Saleem Abdulrasool 6ea75dbeb0 Index: expose is_mutable_field
Expose isMutable via libClang and python bindings.

Patch by Jonathan B Coe!

llvm-svn: 251410
2015-10-27 15:50:22 +00:00
Richard Smith 9f690bd80b [coroutines] Creation of promise object, lookup of operator co_await, building
of await_* calls, and AST representation for same.

llvm-svn: 251387
2015-10-27 06:02:45 +00:00
Devin Coughlin 8e850d45e4 [analyzer] ccc-analyzer: Fix -isystem value passing.
The regex for -isystem matching is broken. -[D,I,Usystem] matches "-D", "-,",
"-I", "-U", "-s" "-y", etc. Besides that, "-isystem /foo" gets interpreted as
"-i" with a non-empty value "system" and thus the next "/foo" argument is not
read. This patch corrects the regex.

This fixes PR13237 <https://llvm.org/bugs/show_bug.cgi?id=13237>.

A patch by Peter Wu!

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

llvm-svn: 251312
2015-10-26 17:19:51 +00:00
Devin Coughlin 26c5df2c21 [analyzer] scan-build: Teach ccc-analyzer about -Xclang.
Update ccc-analyzer to forward both -Xclang and its following argument to the
the compiler driver. Previously we were dropping -Xclang and forwarding the
argument on its own if it matched other forwarding criteria. This caused the
argument to be interpreted as a driver rather than a frontend option.

llvm-svn: 251218
2015-10-25 01:30:18 +00:00
Chris Bieneman 0eb2d8794e [CMake] Make clang/tools subdirectories controlled via options
Setting CLANG_TOOL_*_BUILD=Off on the CMake command line will disable inclusion of a clang/tools subdirectory.

llvm-svn: 250840
2015-10-20 18:12:12 +00:00
Angel Garcia Gomez 637d1e6694 Roll-back r250822.
Summary: It breaks the build for the ASTMatchers

Subscribers: klimek, cfe-commits

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

llvm-svn: 250827
2015-10-20 13:23:58 +00:00
Angel Garcia Gomez b5250d3448 Apply modernize-use-default to clang.
Summary: Replace empty bodies of default constructors and destructors with '= default'.

Reviewers: bkramer, klimek

Subscribers: klimek, alexfh, cfe-commits

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

llvm-svn: 250822
2015-10-20 12:52:55 +00:00
Marek Kurdej e5c485c70b Added new options to ClangFormat VSIX package.
Summary:
Added new options to ClangFormat VSIX package:
* fallback-style
* assume-filename
* sort-includes.
Changed version to 1.1 (otherwise one couldn't update).

Fixed clang-format escaping of XML reserved characters.

Reviewers: hans, aaron.ballman, klimek, rnk, zturner

Subscribers: djasper, cfe-commits

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

llvm-svn: 250694
2015-10-19 10:08:35 +00:00
Nico Weber 373ee96e73 Update list of languages advertised in OVERVIEW: A tool to format C/C++/Java/JavaScript/Objective-C/Protobuf code.
If no arguments are specified, it formats the code from standard input
and writes the result to the standard output.
If <file>s are given, it reformats the files. If -i is specified
together with <file>s, the files are edited in-place. Otherwise, the
result is written to the standard output.

USAGE: clang-format [options] [<file> ...]

OPTIONS:
  -assume-filename=<string> - When reading from stdin, clang-format assumes this
                              filename to look for a style config file (with
                              -style=file) and to determine the language.
  -cursor=<uint>            - The position of the cursor when invoking
                              clang-format from an editor integration
  -dump-config              - Dump configuration options to stdout and exit.
                              Can be used with -style option.
  -fallback-style=<string>  - The name of the predefined style used as a
                              fallback in case clang-format is invoked with
                              -style=file, but can not find the .clang-format
                              file to use.
                              Use -fallback-style=none to skip formatting.
  -help                     - Display available options (-help-hidden for more)
  -i                        - Inplace edit <file>s, if specified.
  -length=<uint>            - Format a range of this length (in bytes).
                              Multiple ranges can be formatted by specifying
                              several -offset and -length pairs.
                              When only a single -offset is specified without
                              -length, clang-format will format up to the end
                              of the file.
                              Can only be used with one input file.
  -lines=<string>           - <start line>:<end line> - format a range of
                              lines (both 1-based).
                              Multiple ranges can be formatted by specifying
                              several -lines arguments.
                              Can't be used with -offset and -length.
                              Can only be used with one input file.
  -offset=<uint>            - Format a range starting at this byte offset.
                              Multiple ranges can be formatted by specifying
                              several -offset and -length pairs.
                              Can only be used with one input file.
  -output-replacements-xml  - Output replacements as XML.
  -sort-includes            - Sort touched include lines
  -style=<string>           - Coding style, currently supports:
                                LLVM, Google, Chromium, Mozilla, WebKit.
                              Use -style=file to load style configuration from
                              .clang-format file located in one of the parent
                              directories of the source file (or current
                              directory for stdin).
                              Use -style="{key: value, ...}" to set specific
                              parameters, e.g.:
                                -style="{BasedOnStyle: llvm, IndentWidth: 8}"
  -version                  - Display the version of this program output.

llvm-svn: 250671
2015-10-19 01:03:19 +00:00
Daniel Jasper f39757d0c0 clang-format: Basic escaping when outputting XML.
llvm-svn: 250440
2015-10-15 18:39:31 +00:00
Chris Bieneman 767828b7bb [CMake] Add LLVM_VERSION_PATCH to the -current_version flag for libclang.
This is to match autoconf where LLVM_SUBMIT_SUBVERSION is usually set to ${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}.

llvm-svn: 250278
2015-10-14 07:50:47 +00:00
Chris Bieneman 658beb930e [CMake]Getting rid of references to LLVM_SUBMIT_VERSION and LLVM_SUBMIT_SUBVERSION in favor of LLVM_VERSION_MAJOR and LLVM_VERSION_MINOR.
LLVM_SUBMIT_VERSION and LLVM_SUBMIT_SUBVERSION are commonly used variable names in the autoconf build system. They seem to have leeched into clang's CMake in a few places, and should just be replaced by the LLVM_VERSION_* variables where appropriate.

llvm-svn: 250246
2015-10-13 23:03:54 +00:00
Douglas Katzman 722bcb08f1 Always pass a -dwarf-version argument to integrated as.
This removes the default of 3 hidden in the assembler previously.

Fixes breakage caused by r249655, reported by vsukharev.

llvm-svn: 250173
2015-10-13 16:22:51 +00:00
Alexey Bataev f24e7b1f60 [OPENMP 4.1] Codegen for array sections/subscripts in 'reduction' clause.
OpenMP 4.1 adds support for array sections/subscripts in 'reduction' clause. Patch adds codegen for this feature.

llvm-svn: 249672
2015-10-08 09:10:53 +00:00
Douglas Katzman 3459ce2e5e Stop messing with the 'g' group of options in CompilerInvocation.
With this change, most 'g' options are rejected by CompilerInvocation.
They remain only as Driver options. The new way to request debug info
from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}"
and "-dwarf-version={2|3|4}". In the absence of a command-line option
to specify Dwarf version, the Toolchain decides it, rather than placing
Toolchain-specific logic in CompilerInvocation.

Also fix a bug in the Windows compatibility argument parsing
in which the "rightmost argument wins" principle failed.

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

llvm-svn: 249655
2015-10-08 04:24:12 +00:00
Craig Topper 416421c9b4 Fix a -Wdeclaration-after-statement warning.
llvm-svn: 249652
2015-10-08 03:37:36 +00:00
Ehsan Akhgari f8d44de143 Make clang_Cursor_getMangling not mangle if the declaration isn't mangled
Right now clang_Cursor_getMangling will attempt to mangle any
declaration, even if the declaration isn't mangled (extern C).  This
results in a partially mangled name which isn't useful for much. This
patch makes clang_Cursor_getMangling return an empty string if the
declaration isn't mangled.

Patch by Michael Wu <mwu@mozilla.com>.

llvm-svn: 249639
2015-10-08 00:01:20 +00:00
Daniel Jasper db125cb326 clang-format: Add include sorting capabilities to sublime, emacs and
clang-format-diff.py.

llvm-svn: 249567
2015-10-07 17:00:20 +00:00
Hans Wennborg dcfba33481 Fix Clang-tidy modernize-use-nullptr warnings in source directories; other minor cleanups
Patch by Eugene Zelenko!

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

llvm-svn: 249484
2015-10-06 23:40:43 +00:00
Ehsan Akhgari c9d174fae5 Revert r249437
llvm-svn: 249440
2015-10-06 18:53:12 +00:00
Ehsan Akhgari 9d1f05aef8 Make clang_Cursor_getMangling don't mangle if the declaration isn't mangled
Right now clang_Cursor_getMangling will attempt to mangle any
declaration, even if the declaration isn't mangled (extern "C").  This
results in a partially mangled name which isn't useful for much. This
patch makes clang_Cursor_getMangling return an empty string if the
declaration isn't mangled.

Patch by Michael Wu <mwu@mozilla.com>.

llvm-svn: 249437
2015-10-06 18:24:33 +00:00
Benjamin Kramer 2e2351adce [VFS] Transition clang-format to use an in-memory FS.
Apart from being cleaner this also means that clang-format no longer has
access to the host file system. This isn't necessary because clang-format
never reads includes :)

Includes minor tweaks and bugfixes found in the VFS implementation while
running clang-format tests.

llvm-svn: 249385
2015-10-06 10:04:08 +00:00
Craig Topper e335f25949 SourceRanges are small and trivially copyable, don't them by reference.
llvm-svn: 249259
2015-10-04 04:53:55 +00:00
Yaron Keren 8b563665c3 Replace double negation of !FileID.isInvalid() with FileID.isValid().
+couple more of double-negated !SourceLocation.isInvalid() unfixed in r249228.

llvm-svn: 249235
2015-10-03 10:46:20 +00:00
Kostya Serebryany e39fec5b06 [libFuzzer] make LLVMFuzzerTestOneInput (the fuzzer target function) return int instead of void. (following llvm r249214)
llvm-svn: 249215
2015-10-02 23:34:37 +00:00
Daniel Jasper 0a63c6bffe clang-format: Add clangRewrite dependency to fix cmake build.
llvm-svn: 248929
2015-09-30 19:28:47 +00:00
Anastasia Stulova bcea69669f [OpenCL 2.0] Enable program scope variables, Section 6.5.1.
- Remove virtual SC_OpenCLWorkGroupLocal storage type specifier
as it conflicts with static local variables now and prevents
diagnosing static local address space variables correctly.

 - Allow static local and global variables (OpenCL2.0 s6.8 and s6.5.1).

 - Improve diagnostics of allowed ASes for variables in different scopes:
(i) Global or static local variables have to be in global
or constant ASes (OpenCL1.2 s6.5, OpenCL2.0 s6.5.1);
(ii) Non-kernel function variables can't be declared in local
or constant ASes (OpenCL1.1 s6.5.2 and s6.5.3).

http://reviews.llvm.org/D13105

llvm-svn: 248906
2015-09-30 14:08:20 +00:00
Daniel Jasper 867a938246 clang-format: Use Rewriter again to write the output files.
This has two advantages:
1. Atomic writes.
2. Proper handling of line endings (hopefully solving llvm.org/PR24999

llvm-svn: 248904
2015-09-30 13:59:29 +00:00
Hans Wennborg 59dbe86325 Fix Clang-tidy modernize-use-nullptr warnings in headers and generated files; other minor cleanups.
By Eugene Zelenko!

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

llvm-svn: 248828
2015-09-29 20:56:43 +00:00
Daniel Jasper 85c472dccd clang-format: Extend #include sorting functionality
Recognize the main module header as well as different #include categories.
This should now mimic the behavior of llvm/utils/sort_includes.py as
well as clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp very
closely.

llvm-svn: 248782
2015-09-29 07:53:08 +00:00
Alexey Bataev d14d1e6f25 [OPENMP 4.1] Add 'simd' clause for 'ordered' directive.
Parsing and sema analysis for 'simd' clause in 'ordered' directive.
Description
If the simd clause is specified, the ordered regions encountered by any thread will use only a single SIMD lane to execute the ordered
regions in the order of the loop iterations.
Restrictions
An ordered construct with the simd clause is the only OpenMP construct that can appear in the simd region

llvm-svn: 248696
2015-09-28 06:39:35 +00:00
Manuel Klimek 8e3a7ede94 Fix bug on reporting availability of deleted methods in libclang.
Patch by Sergey Kalinichev.

llvm-svn: 248596
2015-09-25 17:53:16 +00:00
Eric Christopher 74a7c5dc16 The Clang gcc-compatible driver (clang/tools/driver/driver.cpp) has some
logic to select an alternate target based on the executable it was
called as. For instance, if you symlink i686-linux-android-gcc to clang
and invoke it, the driver will act as though it were called with another
argument ("-target i686-linux-android"). This leads to visible effects
even in syntax-only compilations (like the ANDROID preprocessor symbol
being defined).

This behavior is not replicated for tool invocations--for instance,
clang::createInvocationFromCommandLine will not choose an alternate
target based on ArgList[0]. This means that configurations stored in
compilation databases aren't accurately replayed.

This patch separates the logic for selecting a mode flag and target from
the executable name into a new member function on ToolChain. It should
have no functional effects (but will allow other code to reuse the
target/mode selection logic).

Patch by Luke Zarko!

llvm-svn: 248592
2015-09-25 17:44:31 +00:00
Alexey Bataev 346265e3bc [OPENMP 4.1] Add 'threads' clause for '#pragma omp ordered'.
OpenMP 4.1 extends format of '#pragma omp ordered'. It adds 3 additional clauses: 'threads', 'simd' and 'depend'.
If no clause is specified, the ordered construct behaves as if the threads clause had been specified. If the threads clause is specified, the threads in the team executing the loop region execute ordered regions sequentially in the order of the loop iterations.
The loop region to which an ordered region without any clause or with a threads clause binds must have an ordered clause without the parameter specified on the corresponding loop directive.

llvm-svn: 248569
2015-09-25 10:37:12 +00:00
Daniel Jasper d89ae9d3ac clang-format: Add initial #include sorting capabilities.
To implement this nicely, add a function that merges two sets of
replacements that are meant to be done in sequence. This functionality
will also be useful for other applications, e.g. formatting the result
of clang-tidy fixes.

llvm-svn: 248367
2015-09-23 08:30:47 +00:00
Hans Wennborg e4c11cfa8a Add msbuild-bin/cl to CLANG_LINKS_TO_CREATE
This got lost in r248043 which refactored the symlink creation.

llvm-svn: 248221
2015-09-21 22:44:57 +00:00
Chris Bieneman cd53780cd4 [CMake] Refactoring and cleaning up clang symlink generation.
Generation of clang symlinks now uses add_clang_symlink macro which uses add_llvm_symlink. Also the list of symlinks to generate is configurable via CLANG_LINKS_TO_CREATE.

This re-lands r248015, with fixes for clang symlinks to always be generated as part of the clang and install-clang targets.

llvm-svn: 248043
2015-09-18 21:15:54 +00:00
Chris Bieneman f41fe8b6f8 Revert "[CMake] Refactoring and cleaning up clang symlink generation."
This reverts commit r248015, because it broke bots. I'll revise and recommit.

llvm-svn: 248025
2015-09-18 19:59:51 +00:00
Chris Bieneman 8a1030db9f [CMake] Refactoring and cleaning up clang symlink generation.
Generation of clang symlinks now uses add_clang_symlink macro which uses add_llvm_symlink. Also the list of symlinks to generate is configurable via CLANG_LINKS_TO_CREATE.

llvm-svn: 248015
2015-09-18 18:09:15 +00:00
Joerg Sonnenberger 924f6ad63d Pass the relocation model to LLVM for assembler files.
llvm-svn: 247981
2015-09-18 11:13:43 +00:00
Chris Bieneman 0792636eec [CMake] Add install-clang target to install just the clang executable
For the llvm-tools we're generating install-${tool} targets which are very useful. We should have one for clang too.

llvm-svn: 247912
2015-09-17 18:30:20 +00:00
Anton Yartsev c647a6df72 [analyzer] Improved behavior if Clang was not found, part II
- scan-build help: display 'Could not query Clang for the list of available checkers.' + the reason why it happened so if clang was not found.
- display requested/forced help in case of --use-analyzer=Xcode.

llvm-svn: 247828
2015-09-16 18:12:15 +00:00
Daniel Sanders 50f17235dd Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Eric has replied and has demanded the patch be reverted.

llvm-svn: 247702
2015-09-15 16:17:27 +00:00
Daniel Sanders 153010c52d Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).

For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.

This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.

This commit also contains a trivial patch to clang to account for the C++ API
change. Thanks go to Pavel Labath for fixing LLDB for me.

Reviewers: rengolin

Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin

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

llvm-svn: 247692
2015-09-15 14:08:28 +00:00
Daniel Sanders c40de48041 Revert r247684 - Replace Triple with a new TargetTuple ...
LLDB needs to be updated in the same commit.

llvm-svn: 247686
2015-09-15 13:46:21 +00:00
Daniel Sanders 18d4b0dab7 Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).

For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.

This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.

This commit also contains a trivial patch to clang to account for the C++ API
change.

Reviewers: rengolin

Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin

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

llvm-svn: 247683
2015-09-15 13:17:40 +00:00
Alexey Bader 9c8453fb4b [OpenCL] Add new types for OpenCL 2.0.
Patch by Pedro Ferreira.
Reviewers: pekka.jaaskelainen
Differential Revision: http://reviews.llvm.org/D12855

llvm-svn: 247676
2015-09-15 11:18:52 +00:00
Ted Kremenek 04d7b95ef3 Use -f instead of -d flag for testing existing of clang executable (http://reviews.llvm.org/D12827).
llvm-svn: 247510
2015-09-12 16:01:34 +00:00
Argyrios Kyrtzidis 74bcd21e34 [tooling] In CompileCommand, Expose the 'file' that was associated with the command.
llvm-svn: 247468
2015-09-11 20:43:05 +00:00
Anton Yartsev f54d6796e3 [analyzer] Improve behavior if Clang not found.
- Eliminate 'No such file or directory at scan-build line ...' error if '$RealBin/bin/clang' or '$RealBin/clang' directory does not exist.
- Eliminate 'Use of uninitialized value $Clang in concatenation (.) or string at scan-build line ...' error if help is displayed while $Clang was not found.

llvm-svn: 247466
2015-09-11 20:41:09 +00:00
Argyrios Kyrtzidis e260227c43 [libclang] Add missing clang_CompileCommand_* functions in libclang.exports.
llvm-svn: 247176
2015-09-09 18:54:16 +00:00
Ted Kremenek 3a0678e33c [analyzer] Apply whitespace cleanups by Honggyu Kim.
llvm-svn: 246978
2015-09-08 03:50:52 +00:00
Saleem Abdulrasool 79c6971cdf Index: expose visibility attribute
Expose the previously unexposed visibility attribute via the python and C
bindings.

llvm-svn: 246931
2015-09-05 18:53:43 +00:00
Manuel Klimek e0495d987c [libclang] Return deduced type for auto type, not the one written in the source.
It used to work, but was accidentally broken by r179769.
The issue with decayed types was fixed by r190796.
So this patch partially reverts r179769, and adds more tests.

This also fixes PR 18669.

Patch by Sergey Kalinichev.

llvm-svn: 246778
2015-09-03 16:11:10 +00:00
Anton Yartsev 9550590711 [analyzer] Refactoring: bring together scan-build options and environment variables.
Full list of changes:
- all scan-build command-line arguments are now kept in %Options hash.
- most of environment variables scan-build operates with are stored in %EnvVars hash.
- moved processing of command-line arguments to the ProcessArgs subroutine.

llvm-svn: 246710
2015-09-02 21:01:59 +00:00
Adrian Prantl 6b21ab21d1 Add a -gmodules option to the driver and a -dwarf-ext-refs to cc1
to enable the use of external type references in the debug info
(a.k.a. module debugging).

The driver expands -gmodules to "-g -fmodule-format=obj -dwarf-ext-refs"
and passes that to cc1. All this does at the moment is set a flag
codegenopts.

http://reviews.llvm.org/D11958

llvm-svn: 246192
2015-08-27 19:46:20 +00:00
Alexey Bataev 1a3320e463 [OPENMP 4.0] Initial support for array sections.
Adds parsing/sema analysis/serialization/deserialization for array sections in OpenMP constructs (introduced in OpenMP 4.0).
Currently it is allowed to use array sections only in OpenMP clauses that accepts list of expressions.
Differential Revision: http://reviews.llvm.org/D10732

llvm-svn: 245937
2015-08-25 14:24:04 +00:00
Argyrios Kyrtzidis 6c61288716 [libclang] For convenience to clients, make sure that nullability and __kindof annotations do not hide
the underlying type.

rdar://22063577

llvm-svn: 245867
2015-08-24 19:50:45 +00:00
Alexey Bataev 66b15b505f [OPENMP 4.1] Initial support for 'simdlen' clause.
Add parsing/sema analysis for 'simdlen' clause in simd directives. Also add check that if both 'safelen' and 'simdlen' clauses are specified, the value of 'simdlen' parameter is less than the value of 'safelen' parameter.

llvm-svn: 245692
2015-08-21 11:14:16 +00:00
Anton Yartsev c971a1a6d5 [analyzer] Fix for PR24112 (scan-build doesn't work with --use-analyzer="path to clang++.exe").
Don't derive the path_to_clang++ from the path_to_clang if the path_to_clang is really the path_to_clang++.

llvm-svn: 245621
2015-08-20 21:52:39 +00:00
Chandler Carruth 9ae6adfa3b Update to reflect the library set in LLVM changing.
llvm-svn: 245320
2015-08-18 17:59:33 +00:00
Alexey Bataev bd9fec1eaa [OPENMP 4.1] Allow variables with reference types in private clauses.
OpenMP 4.1 allows to use variables with reference types in all private clauses (private, firstprivate, lastprivate, linear etc.). Patch allows to use such variables and fixes codegen for linear variables with reference types.

llvm-svn: 245268
2015-08-18 06:47:21 +00:00
Yaron Keren 556b21aa10 Remove and forbid raw_svector_ostream::flush() calls.
After r244870 flush() will only compare two null pointers and return,
doing nothing but wasting run time. The call is not required any more
as the stream and its SmallString are always in sync.

Thanks to David Blaikie for reviewing.

llvm-svn: 244928
2015-08-13 18:12:56 +00:00
Rafael Espindola 817d962ef0 Update for llvm api change.
llvm-svn: 244855
2015-08-13 01:07:06 +00:00
Anton Yartsev 8be92ef3a1 [analyzer] Incorrect env variable replaced.
llvm-svn: 244673
2015-08-11 21:24:19 +00:00
David Majnemer 3a4f95867f [clang-cl] Add support for CL and _CL_ environment variables
cl uses 'CL' and '_CL_' to prepend and append command line options to
the given argument vector.  There is an additional quirk whereby '#' is
transformed into '='.

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

llvm-svn: 244473
2015-08-10 18:16:32 +00:00
Ted Kremenek 0270a08ebf [Static Analyzer] Add --analyzer-target option to scan-build.
When interposing on a compiler doing cross-compilation, scan-build
does not infer the target triple needed to pass to clang for
doing static analysis.  The --analyzer-target option allows one
to manually specify the target triple used during static analysis
(and only static analysis) for such cases.

Patch by Honggyu Kim!

Reviewed in http://reviews.llvm.org/D10356.

llvm-svn: 244400
2015-08-08 17:58:47 +00:00
Michael Wong e710d5459e This patch commits OpenMP 4 target device clauses
This is committed on behalf of Kelvin Li
http://reviews.llvm.org/D11469?id=31227

llvm-svn: 244325
2015-08-07 16:16:36 +00:00
Eric Christopher 964a5f3b5c Rename DescriptionString -> DataLayoutString as it matches the actual
use of the string.

llvm-svn: 244178
2015-08-05 23:48:05 +00:00
Chandler Carruth 9ade6a9a74 Fix a tiny bug in -no-canonical-prefixes that somehow we have never
noticed until now.

The code for setting up the driver's InstalledDir didn't respect
-no-canonical-prefixes. Because of this, there are a few places in the
driver where we would unexpectedly form absolute paths, notably when
searching for and finding GCC installations to use, etc. The fix is
straightforward, and I've added this path to '-v' both so we can test it
sanely and so that it will be substantially more obvious the next time
someone has to debug something here.

Note that there is another bug that we don't actually *canonicalize* the
installed directory! I don't really want to fix that because I don't
have a realistic way to test the usage of this mode. I suspect that
folks using the shared module cache would care about getting this right
though, and so they might want to address it. I've left the appropriate
FIXMEs so that it is clear what to change, and I've updated the test
code to make it clear what is happening here.

llvm-svn: 244065
2015-08-05 17:07:33 +00:00
Chandler Carruth 6ac555fb71 [UB] Avoid a really broken call to realloc that would later result in
a bad call to memcpy.

When we only have a buffer from one of the two reparse calls, we can
just return that buffer rather than going through the realloc/memcpy
dance.

Found with UBsan.

llvm-svn: 243950
2015-08-04 03:53:04 +00:00
Argyrios Kyrtzidis 0ce08b890e Remove unused header include.
llvm-svn: 243938
2015-08-04 01:44:13 +00:00
Pete Cooper 57d3f14502 Use llvm::reverse to make a bunch of loops use foreach. NFC.
In llvm commit r243581, a reverse range adapter was added which allows
us to change code such as

  for (auto I = Fields.rbegin(), E = Fields.rend(); I != E; ++I) {

in to

  for (const FieldDecl *I : llvm::reverse(Fields))

This commit changes a few of the places in clang which are eligible to use
this new adapter.

llvm-svn: 243663
2015-07-30 17:22:52 +00:00
Alexey Bataev 10e775f4a8 [OPENMP 4.1] Initial support for extended 'ordered' clause.
OpenMP 4.1 introduces optional argument '(n)' for 'ordered' clause, where 'n' is a number of loops that immediately follow the directive.
'n' must be constant positive integer expressions and it must be less or equal than the number of the loops in the resulting loop nest.
Patch adds parsing and semantic analysis for this optional argument.

llvm-svn: 243635
2015-07-30 11:36:16 +00:00
Benjamin Kramer 11a9cd956a [libclang] Use lambdas instead of explicit structs when storing arguments.
This boilerplate code was necessary to move arguments between threads in
C++98, lambdas make this much easier. No functionality change intended.

llvm-svn: 243227
2015-07-25 20:55:44 +00:00
Steven Wu ae480ecaec Fix the cc1as crash when it outputs assembly
In clang cc1as_main, when the output file type is “asm”, AsmStreamer
owns a formatted_raw_ostream which has a reference to FDOS
(raw_ostream), so AsmStreamer must be closed before FDOS is closed.

llvm-svn: 243085
2015-07-24 02:12:43 +00:00
Michael Wong 65f367fcbb Commit for http://reviews.llvm.org/D10765
for OpenMP 4 target data directive parsing and sema.
This commit is on behalf of Kelvin Li.

llvm-svn: 242785
2015-07-21 13:44:28 +00:00
Adrian Prantl d5aae9351b Fix clang-fuzzer build after r242499.
llvm-svn: 242505
2015-07-17 04:07:47 +00:00
Adrian Prantl fb2398d0c4 Make the clang module container format selectable from the command line.
- introduces a new cc1 option -fmodule-format=[raw,obj]
  with 'raw' being the default
- supports arbitrary module container formats that libclang is agnostic to
- adds the format to the module hash to avoid collisions
- splits the old PCHContainerOperations into PCHContainerWriter and
  a PCHContainerReader.

Thanks to Richard Smith for reviewing this patch!

llvm-svn: 242499
2015-07-17 01:19:54 +00:00
Reid Kleckner e2d03448ba [clang-cl] Use the Windows response file tokenizer
We were still using the Unix response file tokenizer for all driver
modes. This was difficult to get right in the beginning because there is
a circular dependency. The Driver class also can't officially determine
its mode until it can see all possible --driver-mode= flags, and those
flags could come from the response file.

Now we use the Windows parsing algorithm if the program name looks like
clang-cl, or if the --driver-mode=cl flag is present on the main command
line.

Fixes PR23709.

Reviewers: hans

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

llvm-svn: 242346
2015-07-15 22:42:37 +00:00
Artem Belevich 0ff05cd165 [cuda] Driver changes to compile and stitch together host and device-side CUDA code.
NOTE: reverts r242077 to reinstate r242058, r242065, 242067
        and includes fix for OS X test failures.

  - Changed driver pipeline to compile host and device side of CUDA
    files and incorporate results of device-side compilation into host
    object file.

  - Added a test for cuda pipeline creation in clang driver.

  New clang options:
  --cuda-host-only   - Do host-side compilation only.
  --cuda-device-only - Do device-side compilation only.

  --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side
    compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more
    than once in which case one device-compilation will be done per
    unique specified GPU architecture.

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

llvm-svn: 242085
2015-07-13 23:27:56 +00:00