Commit Graph

396 Commits

Author SHA1 Message Date
Chandler Carruth 575bc3ba62 [cleanup] Re-sort the #include lines using llvm/utils/sort_includes.py
No functionality changed, this is a purely mechanical cleanup to ensure
the #include order remains consistent across the project.

llvm-svn: 225975
2015-01-14 11:23:58 +00:00
Alexander Kornienko 41c247a677 Make DiagnosticsEngine::takeClient return std::unique_ptr<>
Summary:
Make DiagnosticsEngine::takeClient return std::unique_ptr<>. Updated
callers to store conditional ownership using a pair of pointer and unique_ptr
instead of a pointer + bool. Updated code that temporarily registers clients to
use the non-owning registration (+ removed extra calls to takeClient).

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: cfe-commits

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

llvm-svn: 222193
2014-11-17 23:46:02 +00:00
Michael J. Spencer b011d48282 Fix style.
llvm-svn: 221546
2014-11-07 21:30:32 +00:00
Michael J. Spencer 04162eaced [llvm-api-change] Use findProgramByName.
llvm-svn: 221222
2014-11-04 01:30:55 +00:00
Justin Bogner 5a6a2fcdee Driver: Include driver diagnostics when we --serialize-diagnostics
Currently, when --serialize-diagnostics is passed this only includes
the diagnostics from clang -cc1, and driver diagnostics are
dropped. This causes issues for tools that use the serialized
diagnostics, since stderr is lost and these diagnostics aren't seen at
all.

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

Fixes rdar://problem/10585062

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

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

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

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

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

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

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

And I wish I had polymorphic lambdas.

llvm-svn: 219938
2014-10-16 17:23:58 +00:00
Hans Wennborg 0abd4c4ed2 Use array_lengthof; NFC.
llvm-svn: 219935
2014-10-16 16:54:36 +00:00
Rafael Espindola d465be8ebd Update for llvm api change.
llvm-svn: 219800
2014-10-15 16:12:57 +00:00
David Majnemer 3349872cf3 driver: Map closed standard file descriptors to /dev/null
Utilize Process::FixupStandardFileDescriptors, introduced in r219170, to
guard against files from being treated as one of the standard file
descriptors.

llvm-svn: 219174
2014-10-06 23:52:23 +00:00
Rafael Espindola 611505f758 Use the simpler version of llvm::sys::fs::exists.
In all these cases it looks like the intention was to handle error in a similar
way to the file not existing.

llvm-svn: 217614
2014-09-11 18:10: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 3c13a7f8bb One other BuryPointer of a unique_ptr cleanup.
llvm-svn: 216743
2014-08-29 17:02:26 +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
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
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 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
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
Rafael Espindola 2d2b420ab9 Update for llvm api change.
llvm-svn: 212408
2014-07-06 17:43:24 +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
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
Craig Topper 69186e731f [C++11] Use 'nullptr'. Tools edition.
llvm-svn: 210422
2014-06-08 08:38:04 +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
Oliver Stannard 9b2a7d4f2d Pass -gdwarf-N options to integrated assembler
llvm-svn: 209124
2014-05-19 13:39:13 +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
Rafael Espindola 9b74ec415b Update for llvm api change.
llvm-svn: 208206
2014-05-07 13:00:49 +00:00
Evgeniy Stepanov eeb820f572 Update Target::createMCAsmParser calls for the LLVM interface change.
Patch by Yuri Gorshenin.

llvm-svn: 206970
2014-04-23 11:15:49 +00:00