Commit Graph

3209 Commits

Author SHA1 Message Date
Ed Schouten bf041d975e Use /usr/bin/env python instead of /usr/bin/python.
On operating systems like the BSDs, it is typically the case that
/usr/bin/python does not exist. We should therefore use /usr/bin/env
instead. This is also done in various other scripts in tools/.

llvm-svn: 216945
2014-09-02 20:59:13 +00:00
Craig Topper 8c2a2a0f82 Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>.
llvm-svn: 216824
2014-08-30 16:55:39 +00:00
David Blaikie 759548b5a6 unique_ptrify the diagnostics in CXDiagnosticSetImpl
llvm-svn: 216754
2014-08-29 18:43:24 +00:00
David Blaikie 3c13a7f8bb One other BuryPointer of a unique_ptr cleanup.
llvm-svn: 216743
2014-08-29 17:02:26 +00:00
Alexey Bataev 39c81e2816 [C++11] Support for capturing of variable length arrays in lambda expression.
Differential Revision: http://reviews.llvm.org/D4368

llvm-svn: 216649
2014-08-28 04:28:19 +00:00
Rafael Espindola d87f8d76e0 Update for LLVM api change.
llvm-svn: 216585
2014-08-27 20:03:29 +00:00
Argyrios Kyrtzidis a2a1e53085 [libclang] Fixup the cursor spelling range for C++ destructors, operator overloads, and conversion functions.
Patch by Craig Tenenbaum!

llvm-svn: 216480
2014-08-26 20:23:26 +00:00
Rafael Espindola 6406f7b8e0 Return a std::unique_ptr from getBufferForFile. NFC.
llvm-svn: 216476
2014-08-26 19:54:40 +00:00
Joerg Sonnenberger a43604ad50 Convert MC command line flag for fatal assembler warnings into a proper
flag.

llvm-svn: 216472
2014-08-26 18:40:25 +00:00
Rafael Espindola dae941a6c8 Update for llvm api change.
llvm-svn: 216397
2014-08-25 18:17:04 +00:00
Reid Kleckner af5fd6a4d5 Fix PR17239 by changing the semantics of the RemainingArgsClass Option kind
This patch aims at fixing PR17239.

This bug happens because the /link (clang-cl.exe argument) is marked as
"consume all remaining arguments". However, when inside a response file,
/link should only consume all remaining arguments inside the response
file where it is located, not the entire command line after expansion.
The LLVM side of the patch will change the semantics of the
RemainingArgsClass kind to always consume only until the end of the
response file when the option originally came from a response file.
There are only two options in this class: dash dash (--) and /link.

This is the Clang side of the patch in http://reviews.llvm.org/D4899

Reviewered By: rafael, rnk

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

Patch by Rafael Auler!

llvm-svn: 216281
2014-08-22 19:29:30 +00:00
David Blaikie 9e095d9b6b Update Clang for LLVM API change to use unique_ptr in SourceManager::AddNewSourceBuffer
llvm-svn: 216226
2014-08-21 21:01:00 +00:00
Alexander Musman 3aaab669c8 [OPENMP] Extract common superclass from all the loop directives. No functional changes (having common superclass is convenient for future loop directives CodeGen implementation)
llvm-svn: 215975
2014-08-19 11:27:13 +00:00
Sylvestre Ledru b248256089 Fix a memory leak in one of the test unit. Silent coverity warning CID 1095912
llvm-svn: 215898
2014-08-18 15:18:56 +00:00
Argyrios Kyrtzidis ac3997eb52 [libclang] Introduce clang_File_isEqual for comparing CXFile handles.
llvm-svn: 215796
2014-08-16 00:26:19 +00:00
Sean Silva bcd500e09a Revert "Update for LLVM change (StringSaver)"
This reverts commit r215785 / 170ebf4f19459ae51a9561d0e65c87ee4c9b2c97.

LLD has some StringSavers that need to be updated. One of which takes a
lock and I need to investigate that more closely.

llvm-svn: 215791
2014-08-15 23:39:12 +00:00
Sean Silva 43bd97c77b Update for LLVM change (StringSaver)
There is more cleanup to be done here. Once
llvm::sys::Process::GetArgumentVector is switched over to StringSaver,
we can simplify this code a fair amount.

llvm-svn: 215785
2014-08-15 23:18:49 +00:00
Sean Silva 5d62c26fa0 Rename as suggested by dblaikie
llvm-svn: 215774
2014-08-15 21:40:51 +00:00
Sean Silva 070cd2d9d4 ArrayRef'ize
I've shied away from ArrayRef'izing CompilerInvocation::CreateFromArgs
in this commit because that is a less localized change.

llvm-svn: 215773
2014-08-15 21:38:36 +00:00
Sean Silva 0ee846ff3c Rename this function to better reflect its purpose
Thanks to dblaikie for the impetus to look for a better name.

llvm-svn: 215767
2014-08-15 20:59:03 +00:00
Sean Silva 6a9b0f9008 [cleanup] Rename this function to better reflect its purpose. NFC.
This also suggests some refactoring to simplify this code. Basically, a
ton of complexity in this argument handling code comes from the need to
save const char *'s in stable storage for pushing onto argv.
It seems like llvm:🆑:StringSaver can be improved to cover all the
needs here.

llvm-svn: 215761
2014-08-15 19:23:53 +00:00
Sean Silva bbabefe1b1 [cleanup] Range-for'ify this loop. NFC.
llvm-svn: 215760
2014-08-15 19:23:50 +00:00
Sean Silva 9a6bdf8187 [cleanup] Factor out handling CC1 tools. NFC.
llvm-svn: 215759
2014-08-15 19:23:47 +00:00
Sean Silva b5060477e0 [cleanup] Factor out setting the driver's install dir. NFC.
llvm-svn: 215756
2014-08-15 18:58:15 +00:00
Sean Silva 22b4a3444c [cleanup] Factor out initializing the DianosticOptions. NFC.
llvm-svn: 215755
2014-08-15 18:58:12 +00:00
Sean Silva 965bb99180 [cleanup] Factor out adjusting "cl.exe" to "clang-cl.exe". NFC.
llvm-svn: 215754
2014-08-15 18:58:09 +00:00
Sean Silva 2103c38a99 [cleanup] Factor out some checks. NFC.
The core logic in main() is actually pretty simple, but there's lots of
stuff that has been added over time which obscures the flow of the code.
In upcoming patches, I'll be pulling more stuff out of the main
codepath.

I'm open to naming suggestions for these helper functions.

llvm-svn: 215751
2014-08-15 18:50:00 +00:00
Benjamin Kramer 2f5db8b3db Header guard canonicalization, clang part.
Modifications made by clang-tidy with minor tweaks.

llvm-svn: 215557
2014-08-13 16:25:19 +00:00
Richard Smith 35f986d3cd Modify behavior of -ast-dump-lookups: if -ast-dump is not also provided, dump
anyway. If -ast-dump *is* also provided, then dump the AST declarations as well
as the lookup results. This is invaluable for cross-correlating the lookup
information with the declarations actually found.

llvm-svn: 215393
2014-08-11 22:11:07 +00:00
David Blaikie 6beb6aa8f0 Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)
After post-commit review and community discussion, this seems like a
reasonable direction to continue, making ownership semantics explicit in
the source using the type system.

llvm-svn: 215323
2014-08-10 19:56:51 +00:00
David Blaikie 6f7382ddd1 std::unique_ptr-ify the result of ASTUnit::LoadFromASTFile
llvm-svn: 215320
2014-08-10 19:08:04 +00:00
Sylvestre Ledru 9e0752980c Fix a bug when scan-build is used in a cross-compilation environment with
the --use-cc option.

Instead, we will search in the PATH
For example:
 scan-build --use-cc=arm-none-eabi-gcc -o out make -e

Initially reported as a Debian Bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=748777

llvm-svn: 215229
2014-08-08 17:15:13 +00:00
David Blaikie cdba84c0d3 CompilationDatabase: Sure-up ownership of compilation databases using std::unique_ptr
Diving into the memory leaks fixed by r213851 there was one case of a
memory leak of a CompilationDatabase due to not properly taking
ownership of the result of "CompilationDatabase::autoDetectFromSource".
Given that both implementations and callers have been using unique_ptr
to own CompilationDatabase objects - make this explicit in the API to
reduce the risk of further leaks.

llvm-svn: 215215
2014-08-08 16:06:15 +00:00
Eli Bendersky 9b07147fc9 Expose the CUDA shared attribute to the C API.
Similar to r209767, which exposed other CUDA-related attributes.

Patch by Rob Springer.

llvm-svn: 215208
2014-08-08 14:59:00 +00:00
Benjamin Kramer 12152ab92e Add missing header guards.
llvm-svn: 215202
2014-08-08 13:24:19 +00:00
Fariborz Jahanian 413297c53d Objective-C ARC. First patch toward generating new APIs
for Objective-C's array and dictionary literals.
rdar://17554063. This is wip.

llvm-svn: 214983
2014-08-06 18:13:46 +00:00
NAKAMURA Takumi 70cac04c7f libclang/Makefile: Update LINK_COMPONENTS take #3. Sorry for the noise.
llvm-svn: 214620
2014-08-02 07:24:04 +00:00
NAKAMURA Takumi 3654ce35ae libclang/Makefile: Update LINK_COMPONENTS take #2.
llvm-svn: 214619
2014-08-02 07:16:14 +00:00
NAKAMURA Takumi 090b78c7d2 libclang/Makefile: Restore some components in LINK_COMPONENTS. Clang's Makefile(s) are not transitive on clang libs.
llvm-svn: 214617
2014-08-02 07:05:38 +00:00
NAKAMURA Takumi bef5d81a50 libclang: Update LINK_COMPONENTS.
llvm-svn: 214616
2014-08-02 06:58:39 +00:00
Hans Wennborg 5e6d2b410d Update build instructions for the clang-format VS plugin
llvm-svn: 214529
2014-08-01 17:38:53 +00:00
Eli Bendersky 7975959569 Add IR Mangler for more stable mangling.
llvm-svn: 214520
2014-08-01 15:01:10 +00:00
Eli Bendersky 78e83d8895 Fix a memory leak - dispose of the CXString after printing it in mangling.
Thanks to kcc@ for noticing.

llvm-svn: 214506
2014-08-01 12:55:44 +00:00
Hans Wennborg 05fb383d2b clang-format vs plugin: claim support for VS 14 CTP too
llvm-svn: 214461
2014-08-01 00:02:24 +00:00
Eli Bendersky 44a206f829 Exposes a C API to name mangling for a given cursor.
Inspired by https://gist.github.com/tritao/2766291, and was previously discussed
on cfe-dev: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-June/037577.html

Adding testing capability via c-index-test.

llvm-svn: 214410
2014-07-31 18:04:56 +00:00
Hans Wennborg cbd71cacb0 clang-format vs plugin: include the license
The vsix installer will show the license when it starts, and it
would print an annoying message when there was none.

While we're here, add a MoreInfoUrl.

llvm-svn: 214237
2014-07-29 22:34:53 +00:00
Alexey Bataev 82bad8b026 [OPENMP] Initial parsing and sema analysis for clause 'seq_cst' of 'atomic' directive.
llvm-svn: 213846
2014-07-24 08:55:34 +00:00
Alexey Bataev 459dec0ca2 [OPENMP] Initial parsing and sema analysis for clause 'capture' in 'atomic' directive.
llvm-svn: 213842
2014-07-24 06:46:57 +00:00
Alexey Bataev 67a4f22f12 [OPENMP] Initial parsing and sema analysis for 'update' clause of 'atomic' directive.
llvm-svn: 213735
2014-07-23 10:25:33 +00:00
Alexey Bataev dea4761c06 [OPENMP] Initial parsing an sema analysis for 'write' clause of 'atomic' directive.
llvm-svn: 213728
2014-07-23 07:46:59 +00:00
Alexey Bataev f98b00c33e [OPENMP] Initial parsing and sema analysis for 'read' clause in 'atomic' directive.
llvm-svn: 213717
2014-07-23 02:27:21 +00:00
Alexey Bataev 0162e459ef [OPENMP] Initial parsing and sema analysis for 'atomic' directive.
llvm-svn: 213639
2014-07-22 10:10:35 +00:00
Alexey Bataev 9fb6e647e7 [OPENMP] Initial parsing and sema analysis for 'ordered' directive.
llvm-svn: 213616
2014-07-22 06:45:04 +00:00
Hans Wennborg 586448763e clang-format vs plugin: set version number from cmake (PR20307)
Previously it was hard-coded to 1.0, which meant the installer would
not install the plugin over previous versions.

This commit makes us use LLVM's major.minor.patch version from cmake,
or whatever CLANG_FORMAT_VS_VERSION is set to when configuring the build.

It's pretty dirty to update a configuration file in the source directory
from the cmake build like this. However, the plugin build is already
dirty in this regard since it builds in the source dir when visual studio,
and then copies out the resulting vsix.

llvm-svn: 213584
2014-07-21 21:48:06 +00:00
Alexey Bataev 6125da9258 [OPENMP] Initial parsing and sema analysis for 'flush' directive.
llvm-svn: 213512
2014-07-21 11:26:11 +00:00
Alexander Musman d9ed09f7a5 [OPENMP] Parsing/Sema of the OpenMP directive 'critical'.
llvm-svn: 213510
2014-07-21 09:42:05 +00:00
Alexey Bataev 2df347ad96 [OPENMP] Initial parsing and sema analysis for 'taskwait' directive.
llvm-svn: 213363
2014-07-18 10:17:07 +00:00
Alexey Bataev 4d1dfeabc9 [OPENMP] Initial parsing and sema analysis for 'barrier' directive.
llvm-svn: 213360
2014-07-18 09:11:51 +00:00
Alexey Bataev 68446b7253 [OPENMP] Initial parsing and sema analysis of 'taskyield' directive.
llvm-svn: 213355
2014-07-18 07:47:19 +00:00
David Blaikie 62a56f39b7 Revert "unique_ptr-ify ownership of ASTConsumers"
This reverts commit r213307.

Reverting to have some on-list discussion/confirmation about the ongoing
direction of smart pointer usage in the LLVM project.

llvm-svn: 213325
2014-07-17 22:34:12 +00:00
David Blaikie a51666a4d6 unique_ptr-ify ownership of ASTConsumers
(after fixing a bug in MultiplexConsumer I noticed the ownership of the
nested consumers was implemented with raw pointers - so this fixes
that... and follows the source back to its origin pushing unique_ptr
ownership up through there too)

llvm-svn: 213307
2014-07-17 20:40:36 +00:00
Alexey Bataev 74ba3a5880 [OPENMP] Initial parsing and sema analysis of 'mergeable' clause.
llvm-svn: 213262
2014-07-17 12:47:03 +00:00
Alexey Bataev 7aea99a310 [OPENMP] Initial support for parsing and sema analysis of 'untied' clause.
llvm-svn: 213257
2014-07-17 12:19:31 +00:00
Alexander Musman 80c2289a03 [OPENMP] Parsing/Sema analysis of directive 'master'
llvm-svn: 213237
2014-07-17 08:54:58 +00:00
Sylvestre Ledru c790515c8b Consistency on the tab/space
llvm-svn: 213236
2014-07-17 08:40:35 +00:00
Sylvestre Ledru 6aac507e7d Fix Bug 14061 - scan-build crashes during postprocessing if BUGFILE no longer exists
Experienced with Thunderbird build

Patch by Matti Niemenmaa

llvm-svn: 213235
2014-07-17 08:39:04 +00:00
Alexey Bataev 3778b60176 [OPENMP] Initial parsing and sema analysis for 'final' clause.
llvm-svn: 213232
2014-07-17 07:32:53 +00:00
Alp Toker 0621cb2e7d Make clang's rewrite engine a core feature
The rewrite facility's footprint is small so it's not worth going to these
lengths to support disabling at configure time, particularly since key compiler
features now depend on it.

Meanwhile the Objective-C rewriters have been moved under the
ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still
potentially worth excluding from lightweight builds.

Tests are now passing with any combination of feature flags. The flags
historically haven't been tested by LLVM's build servers so caveat emptor.

llvm-svn: 213171
2014-07-16 16:48:33 +00:00
NAKAMURA Takumi 04b8b37f56 Prune Redundant libdeps in CMake's target_link_libraries and LLVMBuild.txt.
I checked this with Release+Asserts on x86_64-mingw32. Please restore partially if this were overkill.

llvm-svn: 213064
2014-07-15 11:37:03 +00:00
Alp Toker c3a7077068 Define ENABLE_CLANG_ARCMT in the legacy build system too
llvm-svn: 213010
2014-07-14 23:15:48 +00:00
Alp Toker f55a306996 Fix the !CLANG_ENABLE_ARCMT build
llvm-svn: 212995
2014-07-14 22:17:16 +00:00
Alp Toker 958027b698 Fix typos
Also consolidate 'backward compatibility'

llvm-svn: 212974
2014-07-14 19:42:55 +00:00
Alexey Bataev 9c2e8ee72f [OPENMP] Parsing and sema analysis for 'omp task' directive.
llvm-svn: 212804
2014-07-11 11:25:16 +00:00
Alp Toker 532e5b97d4 Remove dead code from r212620
llvm-svn: 212622
2014-07-09 14:09:52 +00:00
Alp Toker 61dad75b10 cc1as: consolidate option flags with cc1 and eliminate duplication
The clang -cc1as options are nearly a strict subset of -cc1. Instead of
duplicating the definitions and documentation, let's go ahead and share the
definitions in a similar way the current handling of combined driver and
frontend flags, eliminating some of the vestigial legacy surrounding the
assembler subcommand.

llvm-svn: 212620
2014-07-09 14:05:11 +00:00
Alexey Bataev 84d0b3efee [OPENMP] Parsing and sema analysis for 'omp parallel sections' directive.
llvm-svn: 212516
2014-07-08 08:12:03 +00:00
Alp Toker 5c53298c1e libclang: pass return code out argument by reference
r212427 formalized the message-passing pattern by making these argument
structures const. This commit changes output arguments to get passed by
reference so we can eliminate mutable fields.

llvm-svn: 212497
2014-07-07 22:42:03 +00:00
Reid Kleckner 3b5c639f48 Driver: Produce crash diagnostics more often on Windows
Assertion failures call abort(), which return an exit code of 3 on
Windows.  The 'not' utility has the same check.

Unfortunately, the crash-report.c test requires a shell, so it does not
run for me locally, so I can only test this manually.

There's still more work to be done here: we should generate a batch
script instead of a shell script on Windows.

llvm-svn: 212481
2014-07-07 20:23:27 +00:00
Alexey Bataev 4acb859fbd [OPENMP] Added initial support for 'omp parallel for'.
llvm-svn: 212453
2014-07-07 13:01:15 +00:00
Alp Toker 03376dc2c5 Switch over a few uses of param_begin() to parameters()
llvm-svn: 212442
2014-07-07 09:02:20 +00:00
Alp Toker 1b070d25ca Peel away old-style file remapping typedefs and cruft
llvm-svn: 212438
2014-07-07 07:47:20 +00:00
Alp Toker 9d85b18f91 libclang: refactor handling of unsaved_files
Consolidate CXUnsavedFile argument handling in API functions to support a wider
cleanup of various file remapping schemes in the frontend.

llvm-svn: 212427
2014-07-07 01:23:14 +00:00
Nico Weber 9b982078e9 Add an AST node for __leave statements, hook it up.
Codegen is still missing (and I won't work on that), but __leave is now
as implemented as __try and friends.

llvm-svn: 212425
2014-07-07 00:12:30 +00:00
Rafael Espindola 2d2b420ab9 Update for llvm api change.
llvm-svn: 212408
2014-07-06 17:43:24 +00:00
Alp Toker 1a86ad21d1 libclang: make darwin pthread hacks conditional on LLVM_ENABLE_THREADS
Although these aren't strictly related to LLVM's core threading, it's
reasonable to avoid pthread usage in clang when building with
LLVM_ENABLE_THREADS disabled.

llvm-svn: 212395
2014-07-06 06:24:00 +00:00
Alp Toker f994cef836 Track IntrusiveRefCntPtr::get() changes from LLVM r212366
llvm-svn: 212369
2014-07-05 03:08:06 +00:00
Alp Toker e8aa4b90f9 driver: add link dependency on CodeGen
Fix the build when no targets are enabled. This dependency is incurred by two
unfortunate entries in LinkAllPasses.h included from cc1_main.cpp:

  llvm::createJumpInstrTablesPass();
  llvm::createCodeGenPreparePass();

llvm-svn: 212084
2014-07-01 02:42:02 +00:00
Craig Topper 00bbdcf9b3 Remove llvm:: from uses of ArrayRef.
llvm-svn: 211987
2014-06-28 23:22:23 +00:00
David Blaikie 66cc07b4f7 Remove 'const' from MemoryBuffers used through the SourceManager
This removes a const_cast added in r211884 that occurred due to an
inconsistency in how MemoryBuffers are handled between some parts of
clang and LLVM.

MemoryBuffers are immutable and the general convention in the LLVM
project is to omit const from immutable types as it's simply
redundant/verbose (see llvm::Type, for example). While this change
doesn't remove "const" from /every/ MemoryBuffer, it at least makes this
chain of ownership/usage consistent.

llvm-svn: 211915
2014-06-27 17:40:03 +00:00
Chandler Carruth 6666074876 Fix a bug in my previous patch by restoring the behavior that the fatal
error handler is only registered once.

To avoid the use of std::call_once (the obvious way to do this) I've
wrapped everything up into a managed static and done the work in
a constructor. Silly, but it should be effective.

Some out-of-tree libclang users reported this to me, and I've asked them
to put together a test case which exhibits this behavior, but I wanted
to fix things ASAP since the nature of the fix is straight forward.

llvm-svn: 211905
2014-06-27 16:37:27 +00:00
Chandler Carruth 37ad2582d6 This fixes libclang to cope with the now compile-time multithreaded
selection re-enabled in r211900 in LLVM.

The approach (unlike r211121) doesn't rely on std::mutex or
std::call_once to avoid breaknig cygwin bots.

llvm-svn: 211901
2014-06-27 15:14:39 +00:00
Alexey Bataev bae9a793fd [OPENMP] Parsing and sema analysis for 'copyprivate' clause.
llvm-svn: 211886
2014-06-27 10:37:06 +00:00
Alexey Bataev d1e40fbfe1 [OPENMP] Initial parsing and sema analysis for 'single' directive.
llvm-svn: 211774
2014-06-26 12:05:45 +00:00
Alexey Bataev 1e0498a92d [OPENMP] Initial parsing and sema analysis for 'section' directive.
llvm-svn: 211767
2014-06-26 08:21:58 +00:00
Alexey Bataev d3f8dd2d15 [OPENMP] Initial support for 'sections' directive.
llvm-svn: 211685
2014-06-25 11:44:49 +00:00
NAKAMURA Takumi 8068b6a2fb Revert r211121 (and r211285), "Change libclang initialization to use std::call_once instead of"
It broke mingw builder and cygwin-clang stage2, possibly lack of tls in <mutex>.

llvm-svn: 211593
2014-06-24 13:50:01 +00:00
Alexey Bataev 236070f20d [OPENMP] Initial support for 'nowait' clause.
llvm-svn: 211352
2014-06-20 11:19:47 +00:00
Alexey Bataev 142e1fc9ea [OPENMP] Initial support for 'ordered' clause.
llvm-svn: 211347
2014-06-20 09:44:06 +00:00
Alexey Bataev 56dafe87c2 [OPENMP] Initial support for 'schedule' clause.
llvm-svn: 211342
2014-06-20 07:16:17 +00:00
Alp Toker b2636c4ae1 diagtool: refactor TreeView to resemble C++
Replace lots of old-school parameter passing with neat class members.
No attempt made yet to modernize loops, but it's a start.

llvm-svn: 211327
2014-06-20 00:06:42 +00:00
Alp Toker 1b3f344713 diagtool: simplify TreeView diagnostic classification
This utility doesn't need to know about the specifics of diagnostic levels.

llvm-svn: 211323
2014-06-19 23:00:52 +00:00
Zachary Turner 10364ca123 Don't call llvm_start_multithreaded() during init. As of LLVM
revision r211277, this function is essentially a no-op.

llvm-svn: 211285
2014-06-19 18:03:56 +00:00
Alexey Bataev f29276edb7 [OPENMP] Initial support for '#pragma omp for' (fixed incompatibility with MSVC).
llvm-svn: 211140
2014-06-18 04:14:57 +00:00
Zachary Turner f68823ba3f Change libclang initialization to use std::call_once instead of
hand rolled once-initialization, and rename the mutex to be more
descriptive of its actual purpose.

llvm-svn: 211121
2014-06-17 19:57:15 +00:00
Rafael Espindola a566efbec9 Revert "[OPENMP] Initial support for '#pragma omp for'."
This reverts commit r211096. Looks like it broke the msvc build:

SemaOpenMP.cpp(140) : error C4519: default template arguments are only allowed on a class template

llvm-svn: 211113
2014-06-17 17:20:53 +00:00
Alexey Bataev c77dd5257a [OPENMP] Initial support for '#pragma omp for'.
llvm-svn: 211096
2014-06-17 11:49:22 +00:00
Sylvestre Ledru bf9effc736 actually, just check if it is a file (including directory or symlink)
llvm-svn: 211053
2014-06-16 20:51:40 +00:00
Sylvestre Ledru c7bc52596f Check that the directory does not exist.
Otherwise, it could allows local users to obtain sensitive information or
overwrite arbitrary files via a symlink attack on temporary directories with
predictable names. 

Reported as CVE-2014-2893 ( https://security-tracker.debian.org/tracker/CVE-2014-2893 )
Found by Jakub Wilk

llvm-svn: 211051
2014-06-16 20:31:15 +00:00
Alexey Bataev c5e025831b [OPENMP] Initial support of 'reduction' clause
llvm-svn: 211007
2014-06-16 07:08:35 +00:00
Sylvestre Ledru ac5a08a56a List the function/method name in the index page of scan-build
llvm-svn: 210971
2014-06-14 08:49:40 +00:00
Sylvestre Ledru 9882e1a52c With the option '-analyzer-config stable-report-filename=true',
instead of report-XXXXXX.html, scan-build/clang analyzer generate
report-<filename>-<function, method name>-<function position>-<id>.html.
(id = i++ for several issues found in the same function/method)

llvm-svn: 210970
2014-06-14 08:45:32 +00:00
Rafael Espindola 8e650d7bf0 Refer to error_code with the std prefix.
llvm-svn: 210817
2014-06-12 20:37:59 +00:00
Rafael Espindola 8a8e554adc Include system_error directly.
llvm-svn: 210802
2014-06-12 17:19:42 +00:00
Rafael Espindola c080917ec2 Replace llvm::error_code with std::error_code.
llvm-svn: 210780
2014-06-12 14:02:15 +00:00
Zachary Turner 18532316f3 Revert "Clang changes to support LLVM removal of runtime multithreading"
This reverts r210601.

llvm-svn: 210604
2014-06-10 23:17:11 +00:00
Zachary Turner 475a76d93a Clang changes to support LLVM removal of runtime multithreading
support (llvm revision r210600).

Reviewers: rnk

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

llvm-svn: 210601
2014-06-10 23:02:10 +00:00
Craig Topper 69186e731f [C++11] Use 'nullptr'. Tools edition.
llvm-svn: 210422
2014-06-08 08:38:04 +00:00
Alp Toker 541d5070bf Avoid dubious IdentifierInfo::getNameStart() uses
These cases in particular were incurring an extra strlen() when we already knew
the length. They appear to be leftovers from when the interfaces worked with C
strings that have continued to compile due to the implicit StringRef ctor.

llvm-svn: 210403
2014-06-07 23:30:53 +00:00
Timur Iskhodzhanov eae19460a7 Fix C++ style // comments in a couple of C files
llvm-svn: 210325
2014-06-06 11:04:46 +00:00
Reid Kleckner e931c06b21 Flush C stdio streams upon process termination
Due to what can only be described as a CRT bug, stdout and amazingly
even stderr are not always flushed upon process termination, especially
when the system is under high threading pressure.  I have found two
repros for this:

1) In lib\Support\Threading.cpp, change sys::Mutex to an
std::recursive_mutex and run check-clang.  Usually between 30 and 40
tests will fail.

2) Add OutputDebugStrings in code that runs during static initialization
and static shutdown.  This will sometimes generate similar failures.

After a substantial amount of troubleshooting and debugging, I found
that I could reproduce this from the command line without running
check-clang.  Simply make the mutex change described in #1, then
manually run the following command many times by running it once, then
pressing Up -> Enter very quickly:

D:\src\llvm\build\vs2013\Debug\bin\c-index-test.EXE -cursor-at=D:\src\llvm\tools\clang\test\Index\targeted-preamble.h:2:15 D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -include D:\src\llvm\build\vs2013\tools\clang\test\Index\Output\targeted-cursor.c.tmp.h -Xclang -error-on-deserialized-decl=NestedVar1      -Xclang -error-on-deserialized-decl=TopVar    | D:\src\llvm\build\vs2013\Debug\bin\FileCheck.EXE D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -check-prefix=PREAMBLE-CURSOR1

Sporadically they will fail, and attaching a debugger to a failed
instance indicates that stdin of FileCheck.exe is empty.

Note that due to the repro in #2, we can rule out a bug in the STL's
mutex implementation, and instead conclude that this is a real flake in
the windows test harness.

Test Plan:
Without patch: Ran check-clang 10 times and saw over 30 Unexpected failures on every run.
With patch: Ran check-clang 10 times and saw 0 unexpected failures across all runs.

Reviewers: rnk

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

Patch by Zachary Turner!

llvm-svn: 210225
2014-06-05 00:13:43 +00:00
Alexander Musman 1bb328cca5 [OPENMP] Parsing/Sema for OMPLasprivateClause.
Parsing this clause, allowing it on directive ‘omp simd’ and semantic checks.

llvm-svn: 210184
2014-06-04 13:06:39 +00:00
Alp Toker 1d257e1d0a Remove the last remaining llvm/Config/config.h includes
This corrects long-standing misuses of LLVM's internal config.h.

In most cases the public llvm-config.h header was intended and we can now
remove the old hacks thanks to LLVM r210144.

The config.h header is private, won't be installed and should no longer be
included by clang or other modules.

llvm-svn: 210145
2014-06-04 03:28:55 +00:00
Alp Toker 4429314aef cc1as: invert return bool to indicate failure
This simplifies code flow and matches the convention used in surrounding code.

No functional change.

llvm-svn: 209936
2014-05-31 00:02:27 +00:00
Alp Toker e98ea7c9b6 cc1as: fix a potential leak and unremoved output file in error conditions
llvm-svn: 209935
2014-05-31 00:02:21 +00:00
Alexander Musman f0d76e7dc3 Parsing/Sema for OMPAlignedClause.
llvm-svn: 209816
2014-05-29 14:36:25 +00:00
Eli Bendersky 2581e66e7a Expose CUDA function attributes to the C interface.
Until now all CUDA-specific attributes were represented with
CXCursor_UnexposedAttr; now they are actually implemented, including the Python
bindings.

llvm-svn: 209767
2014-05-28 19:29:58 +00:00
Alexander Musman 8bd31e69a4 Parsing/Sema for OMPCollapseClause.
Actual usage in Sema for collapsing loops will in some future patch.

llvm-svn: 209660
2014-05-27 15:12:19 +00:00
Sylvestre Ledru e8103abdbc revert "r209526 List the function/method name in the index page of scan-build "
Depends on http://reviews.llvm.org/D3762

llvm-svn: 209527
2014-05-23 16:47:42 +00:00
Sylvestre Ledru 970d3189e6 List the function/method name in the index page of scan-build
llvm-svn: 209526
2014-05-23 16:40:46 +00:00
Sylvestre Ledru df70a7ba99 Replace system() by native perl calls
llvm-svn: 209524
2014-05-23 16:10:00 +00:00
Daniel Jasper c64b09acc3 clang-format: Introduce DisableFormat that prevents formatting.
And "none" pseudo-style indicating that formatting should be not
applied.

(1) Using .clang-format with "DisableFormat: true" effectively prevents
formatting for all files within the folder containing such .clang-format
file.

(2) Using -fallback-style=none together with -style=file prevents
formatting when .clang-format is not found, which can be used in on-save
callback.

Patch by Adam Strzelecki. Thank you!

llvm-svn: 209446
2014-05-22 15:12:22 +00:00
Daniel Jasper 62f73ec1ef clang-format: Fix vim-integration for empty files.
Discovered by Ahmed Charles in http://reviews.llvm.org/D3018.

llvm-svn: 209417
2014-05-22 11:37:05 +00:00
Alp Toker fdafb94f01 RAV reunification: merge Lambda body visitation to DRAV
llvm-svn: 209246
2014-05-20 22:03:39 +00:00
Justin Bogner 9c785294fb VirtualFileSystem: Add YAMLVFSWriter to generate VFS mapping files
This moves the logic to write a JSON VFS mapping from the C api into
VirtualFileSystem, so that we can use it internally.

No functional change.

llvm-svn: 209241
2014-05-20 21:43:27 +00:00
Oliver Stannard 9b2a7d4f2d Pass -gdwarf-N options to integrated assembler
llvm-svn: 209124
2014-05-19 13:39:13 +00:00
Alp Toker 2d57cea256 Provide and use a safe Token::getRawIdentifier() accessor
llvm-svn: 209061
2014-05-17 04:53:25 +00:00
Sylvestre Ledru 3cbaa468c2 Improve a scan-build message
llvm-svn: 208951
2014-05-16 07:03:15 +00:00
Ben Langmuir 5bf828dd34 Switch another write_escaped to yaml::escape
I missed one in r206443.

llvm-svn: 208941
2014-05-16 01:38:59 +00:00
Alp Toker 1761f11801 Eliminate DefaultImageName from the Driver constructor
All callers were passing in "a.out" or garbage so a sensible default works fine
here as a cleanup.

This also brings about the possibility of adapting the value based on the
driver's compatibility mode in future.

The setting can still be changed via Driver::DefaultImageName as needed.

llvm-svn: 208926
2014-05-15 22:26:36 +00:00
Argyrios Kyrtzidis 884337f427 [libclang] Introduce clang_Module_isSystem(), which returns non-zero if the given CXModule is a system one.
llvm-svn: 208846
2014-05-15 04:44:25 +00:00
Argyrios Kyrtzidis f6d49c36b2 [liblang] Introduce clang_getModuleForFile, which given a CXFile header file, returns the module that contains it, if one exists.
llvm-svn: 208822
2014-05-14 23:14:37 +00:00
Daniel Jasper 2e8600c02b clang-format: Add clang-format-diff usage examples for SVN.
llvm-svn: 208766
2014-05-14 09:36:11 +00:00
Jordan Rose 57ee6d2cf7 [scan-build] Pass --sysroot through for both compilation and linking.
PR19704

llvm-svn: 208595
2014-05-12 17:04:44 +00:00
Nico Weber ce5528ac91 c-index-test: Don't leak diagnostic category text.
llvm-svn: 208503
2014-05-11 17:16:59 +00:00
Nico Weber 3fddae75c7 Don't leak CXStrings for replacement fix-its in c-index-test.
The loop body used to contain a switch statement; it looks like r96685 replaced
that with an if/else if/else but accidentally left one of the three break
statements from the switch behind, skipping the clang_disposeString() call
for replacements (and the rest of the loop too, which apparently doesn't make
a differences for the test cases we have).

r96685: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100215/027754.html

This too might possibly the last leak in clang (PR19521).

llvm-svn: 208483
2014-05-10 23:56:43 +00:00
Benjamin Kramer f3ca269839 Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.
Required pulling LambdaExpr::Capture into its own header.
No functionality change.

llvm-svn: 208470
2014-05-10 16:31:55 +00:00
Nico Weber 7dd96c23fd Don't leak the CXStoredDiagnostics returned by clang_codeCompleteGetDiagnostic()
r144269 changed clang_disposeDiagnostic() to be a no-op, but didn't update
code completion diagnostics.  Let CXCodeCompleteResults store all diagnostics
returned by clang_codeCompleteGetDiagnostic() and then free them up in
clang_disposeCodeCompleteResults().

Code completion diagnostics referred to data stored in CXCodeCompleteResults
before already, so it wasn't possible to refer to the results of
clang_codeCompleteGetDiagnostic() after clang_disposeCodeCompleteResults()
before this change already -- hence this should be a safe, backwards-compatible
change.

Leak found by LSan, fixes PR19690.

llvm-svn: 208454
2014-05-09 22:33:11 +00:00
Nikola Smiljanic e08a91ecd2 Enable alternative tokens by default for clang-format.
Patch by Bobby Moretti.

llvm-svn: 208269
2014-05-08 00:05:13 +00:00
Nico Weber df6860279e c-index-test: Don't leak the strings returned by makeClientContainer().
llvm-svn: 208249
2014-05-07 21:09:42 +00:00
Nico Weber 8d19dffbed Make 2 functions static, remove unneeded cast, rewrap. No behavior change.
llvm-svn: 208247
2014-05-07 21:05:22 +00:00