Commit Graph

55818 Commits

Author SHA1 Message Date
Richard Smith 775118a28b Try a different workaround for GCC 4.7.2 lambda capture bug. The previous
workaround took us from wrong-code to ICE.

llvm-svn: 221754
2014-11-12 02:09:03 +00:00
Richard Smith 2e32155b58 Instantiate exception specifications when instantiating function types (other
than the type of a function declaration). We previously didn't instantiate
these at all! This also covers the pathological case where the only mention of
a parameter pack is within the exception specification; this gives us a second
way (other than alias templates) to reach the horrible state where a type
contains an unexpanded pack, but its canonical type does not.


This is a re-commit of r219977:

r219977 was reverted in r220038 because it hit a wrong-code bug in GCC 4.7.2.
(That's gcc.gnu.org/PR56135, and affects any implicit lambda-capture of
'this' within a template.)


r219977 was a re-commit of r217995, r218011, and r218053:

r217995 was reverted in r218058 because it hit a rejects-valid bug in MSVC.
(Incorrect overload resolution in the presence of using-declarations.)
It was re-committed in r219977 with a workaround for the MSVC rejects-valid.

r218011 was a workaround for an MSVC parser bug. (Incorrect desugaring of
unbraced range-based for loop).

llvm-svn: 221750
2014-11-12 02:00:47 +00:00
Richard Smith d8a52a7831 PR21536: Fix a corner case where we'd get confused by a pack expanding into the
penultimate parameter of a template parameter list, where the last parameter is
itself a pack, and build a bogus empty final pack argument.

llvm-svn: 221748
2014-11-12 01:43:45 +00:00
Richard Smith 17c00b4328 Fix this code to follow the coding style regarding anonymous namespaces and
static functions. Make a bunch of file-local functions static. Remove one
unused static function revealed by this.

llvm-svn: 221745
2014-11-12 01:24:00 +00:00
Douglas Gregor 64c7d45292 Make Sema::CollectMultipleMethodsInGlobalPool() public.
It's useful for out-of-tree clients to be able to query the global
Objective-C method pool, and only Sema can do that right now.

llvm-svn: 221744
2014-11-12 01:12:47 +00:00
NAKAMURA Takumi 12fb0057d1 clang/test/CodeGenCXX/debug-info-cxx1y.cpp: Add %itanium_abi_triple for incompatible MS targets.
llvm-svn: 221741
2014-11-11 23:51:53 +00:00
Kostya Serebryany 4133eabb45 [clang/asan] Do not emit memcpy for trivial operator= when -fsanitize-address-field-padding >= 1
Summary: If we've added poisoned paddings to a type do not emit memcpy for operator=.

Test Plan: regression tests.

Reviewers: majnemer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221739
2014-11-11 23:38:13 +00:00
Kaelyn Takata 2e764b83aa Have LookupMemberExprInRecord only call CorrectTypoDelayed, dropping the
code for calling CorrectTypo.

Includes a needed fix for non-C++ code to not choke on TypoExprs (which
also resolves a TODO from r220698).

llvm-svn: 221736
2014-11-11 23:26:58 +00:00
Kaelyn Takata 49d84328d9 Create two helpers for running the typo-correction tree transform.
One takes an Expr* and the other is a simple wrapper that takes an
ExprResult instead, and handles checking whether the ExprResult is
invalid.

Additionally, allow an optional callback that is run on the full result
of the tree transform, for filtering potential corrections based on the
characteristics of the resulting expression once all of the typos have
been replaced.

llvm-svn: 221735
2014-11-11 23:26:56 +00:00
Kaelyn Takata 5c3dc4be08 Replace MemberTypoDiags and MemberExprTypoRecovery with lambdas.
llvm-svn: 221734
2014-11-11 23:26:54 +00:00
Kaelyn Takata 7fe6f03c3a Remove unnecessary semicolon.
llvm-svn: 221732
2014-11-11 23:17:30 +00:00
Daniel Jasper 3eb341c478 clang-format: Improve handling of comments in binary expressions.
Before:
  b = a &&
      // Comment
      b.c &&
      d;

After:
  b = a &&
      // Comment
      b.c && d;

This fixes llvm.org/PR21535.

llvm-svn: 221727
2014-11-11 23:04:51 +00:00
Kaelyn Takata fc8c61a5b8 Make LookupResult be copyable to avoid decomposing an existing one and
initializing a new one every time a copy is needed.

llvm-svn: 221724
2014-11-11 23:00:42 +00:00
Kaelyn Takata e9e4ecfe9e Explicitly exclude keywords from the member validator.
Also simply and remove dead code from MemberExprTypoRecovery.

llvm-svn: 221723
2014-11-11 23:00:40 +00:00
Kaelyn Takata db99de2d15 Fix some formatting prior to refactoring the code.
llvm-svn: 221722
2014-11-11 23:00:38 +00:00
Kostya Serebryany 75b4f9e1e6 Introduce -fsanitize-coverage=N flag
Summary:
This change makes the asan-coverge (formerly -mllvm -asan-coverge)
accessible via a clang flag.
Companion patch to LLVM is http://reviews.llvm.org/D6152

Test Plan: regression tests, chromium

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: cfe-commits

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

llvm-svn: 221719
2014-11-11 22:15:07 +00:00
Alexey Samsonov e396bfc064 Bundle conditions checked by UBSan with sanitizer kinds they implement.
Summary:
This change makes CodeGenFunction::EmitCheck() take several
conditions that needs to be checked (all of them need to be true),
together with sanitizer kinds these checks are for. This would allow
to split one call into UBSan runtime into several calls in case
different sanitizer kinds would have different recoverability
settings.

Tests should be fixed accordingly, I'm working on it.

Test Plan: regression test suite.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221716
2014-11-11 22:03:54 +00:00
Fariborz Jahanian 902edb9a2b Remove this test too.
llvm-svn: 221715
2014-11-11 21:54:53 +00:00
Fariborz Jahanian 3365bfc609 Revert r221702 until I address Richard Trieu's
comments.

llvm-svn: 221714
2014-11-11 21:54:19 +00:00
Alexey Samsonov cfc9d3fe17 Simplify the test by using multiple --check-prefix arguments
llvm-svn: 221713
2014-11-11 21:50:44 +00:00
Duncan P. N. Exon Smith 2b1f278e77 Revert "IR: MDNode => Value: Update for LLVM API change in r221375"
This reverts commit r221376.

The API change was reverted in r221711.

llvm-svn: 221712
2014-11-11 21:31:03 +00:00
David Blaikie 42edade9d9 PR16091 continued: Debug Info for member functions with undeduced return types.
So DWARF5 specs out auto deduced return types as DW_TAG_unspecified_type
with DW_AT_name "auto", and GCC implements this somewhat, but it
presents a few problems to do this with Clang.

GCC's implementation only applies to member functions where the auto
return type isn't deduced immediately (ie: member functions of templates
or member functions defined out of line). In the common case of an
inline deduced return type function, GCC emits the DW_AT_type as the
deduced return type.

Currently GDB doesn't seem to behave too well with this debug info - it
treats the return type as 'void', even though the definition of the
function has the correctly deduced return type (I guess it sees the
return type the declaration has, doesn't understand it, and assumes
void). This means the function's ABI might be broken (non-trivial return
types, etc), etc.

Clang, on the other hand doesn't track this particular case of a
deducable return type that is deduced immediately versus one that is
deduced 'later'. So if we implement the DWARF5 representation, all
deducible return type functions would get adverse GDB behavior
(including deduced return type lambda functions, inline deduced return
type functions, etc).

Also, we can't just do this for auto types that are not deduced -
because Clang marks even the declaration's return type as deduced (&
provides the underlying type) once a definition is seen that allows the
deduction. So we have to ignore even deduced types - but we can't do
that for auto variables (because this representation only applies to
function declarations - variables and function definitions need the real
type so the function can be called, etc) so we'd need to add an extra
flag to the type unwrapping/creation code to indicate when we want to
see through deduced types and when we don't. It's also not as simple as
just checking at the top level when building a function type (for one
thing, we reuse the function type building for building function pointer
types which might also have 'auto' in them - but be the type of a
variable instead) because the auto might be arbitrarily deeply nested
("auto &", "auto (*)()", etc...)

So, with all that said, let's do the simple thing that works in existing
debuggers for now and treat these functions the same way we do function
templates and implicit special members: omit them from the member list,
since they can't be correctly called anyway (without knowing the return
type the ABI isn't know and a function call could put the arguments in
the wrong place) so they're not much use to the user.

At some point in the future, when GDB understands the DWARF5
representation better it might be worth plumbing through the extra type
builder handling to avoid looking through AutoType for some callers,
etc...

llvm-svn: 221704
2014-11-11 20:44:45 +00:00
Fariborz Jahanian c5fd4844da Patch to warn when logical evaluation of operand evalutes to a true value;
That this is a c-only patch. c++ already has this warning.
This addresses rdar://18716393

llvm-svn: 221702
2014-11-11 19:59:16 +00:00
Daniel Jasper 64a328e96f clang-format: Preserve trailing-comma logic even with comments.
Before:
  vector<int> SomeVector = {// aaa
                            1, 2,
  };

After:
  vector<int> SomeVector = {
      // aaa
      1, 2,
  };

llvm-svn: 221699
2014-11-11 19:34:57 +00:00
Richard Smith 57e18ac96d First half of CWG1962: decltype(__func__) should not be a reference type,
because __func__ is supposed to act like a local static variable.

llvm-svn: 221698
2014-11-11 19:30:41 +00:00
Fariborz Jahanian a29986c0b0 This patch fixes a crash after rebuilding call AST of
an __unknown_anytype(...). In this case, we rebuild the
vararg function type specially to convert the call expression
to  something that IRGen can handle. However, FunctionDecl
as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and
results in crash when accessing its params later on. This
patch fixes the crash by rebuilding the FunctionDecl to match
its new resolved type. rdar://15297105.
(patch reapplied after lldb issue was fixed in r221660).

llvm-svn: 221691
2014-11-11 16:56:21 +00:00
Manuel Klimek 6dffa35ddd DiagnosticParseKinds is close to running into DiagnosticASTKinds.
$ grep "def " include/clang/Basic/DiagnosticParseKinds.td |wc -l
396

llvm-svn: 221688
2014-11-11 15:45:49 +00:00
NAKAMURA Takumi cdcbfba3b6 CGOpenMPRuntime.h: Fix a couple of \param(s) introduced in r221663. [-Wdocumentation]
llvm-svn: 221676
2014-11-11 07:58:06 +00:00
Alexey Bataev 9772000a22 [OPENMP] Codegen for threadprivate variables
For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>); 
In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>);
Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info.
Differential Revision: http://reviews.llvm.org/D4002

llvm-svn: 221663
2014-11-11 04:05:39 +00:00
Richard Smith ea97e36dfc Fix parsing of fold-expressions within a cast expression. We parse the
parenthesized expression a bit differently in this case, just in case the
commas have special meaning.

llvm-svn: 221661
2014-11-11 03:28:50 +00:00
Justin Bogner 4cb85f36ca InstrProf: Remove an unnecessary helper function (NFC)
VisitSubStmtRBraceState is really just Visit, as long as
VisitCompoundStatement handles braces correctly.

llvm-svn: 221659
2014-11-11 02:47:05 +00:00
NAKAMURA Takumi 17d6094d14 CGExpr.cpp: Suppress a warning. [-Wunused-variable]
llvm-svn: 221655
2014-11-11 01:36:11 +00:00
Alexey Samsonov a041610f11 [Sanitizer] Refactor sanitizer options in LangOptions.
Get rid of ugly SanitizerOptions class thrust into LangOptions:
* Make SanitizeAddressFieldPadding a regular language option,
  and rely on default behavior to initialize/reset it.
* Make SanitizerBlacklistFile a regular member LangOptions.
* Introduce the helper class "SanitizerSet" to represent the
  set of enabled sanitizers and make it a member of LangOptions.
  It is exactly the entity we want to cache and modify in CodeGenFunction,
  for instance. We'd also be able to reuse SanitizerSet in
  CodeGenOptions for storing the set of recoverable sanitizers,
  and in the Driver to represent the set of sanitizers
  turned on/off by the commandline flags.

No functionality change.

llvm-svn: 221653
2014-11-11 01:26:14 +00:00
Alexey Samsonov e106102176 Move CodeGenOptions constructor out-of-line and add missing headers. NFC.
llvm-svn: 221646
2014-11-11 00:22:12 +00:00
Alexey Samsonov 4ca4b5cea3 Move SanitizerKind class to a separate header. NFC.
llvm-svn: 221645
2014-11-11 00:19:46 +00:00
Argyrios Kyrtzidis 6cc5f73e38 [libclang] When initializing an ObjC object via the "[[ClassName alloc] init*]" pattern,
report the 'init*' invocation as non-dynamic via clang_Cursor_isDynamicCall.

Of course it is dynamic at runtime, but for purposes of indexing we can treat as an invocation to ClassName's init*.

Addresses rdar://18916871.

llvm-svn: 221641
2014-11-10 23:21:35 +00:00
Alexey Samsonov 4c1a96f519 Propagate SanitizerKind into CodeGenFunction::EmitCheck() call.
Make sure CodeGenFunction::EmitCheck() knows which sanitizer
it emits check for. Make CheckRecoverableKind enum an
implementation detail and move it away from header.

Currently CheckRecoverableKind is determined by the type of
sanitizer ("unreachable" and "return" are unrecoverable,
"vptr" is always-recoverable, all the rest are recoverable).
This will change in future if we allow to specify which sanitizers
are recoverable, and which are not by -fsanitize-recover= flag.

No functionality change.

llvm-svn: 221635
2014-11-10 22:27:30 +00:00
Ben Langmuir acb803e807 Validate user headers even if -fmodules-validate-once-per-build-session
is enabled. Unlike system headers, we want to be more careful about
modifications to user headers, because it's still easy to edit a header
while you're building.

llvm-svn: 221634
2014-11-10 22:13:10 +00:00
Tim Northover 642e770f68 AArch64: set all processor features from -arch if nothing else present
Darwin's "-arch arm64" option implies full Cyclone CPU, for both architectural
and tuning purposes. So if neither of the explicit options have been given,
forward that on to the proper invocation.

rdar://problem/18906227

llvm-svn: 221631
2014-11-10 21:17:23 +00:00
Richard Smith 99c464c3f3 Improve diagnostics if _Noreturn is placed after a function declarator. (This sometimes happens when a macro is used that expands to either the GNU noreturn attribute or _Noreturn.)
llvm-svn: 221630
2014-11-10 21:10:32 +00:00
Bob Wilson 95dcc08e82 Remove change to set SDKROOT when building compiler-rt on Darwin.
This reverts the runtime library portion of r194168. As of r221621,
the libclang_rt libraries for Darwin build with explicit SDK options
so there is no need to set SDKROOT here.

llvm-svn: 221625
2014-11-10 20:01:19 +00:00
Richard Smith 8e6923b7f2 Update fold-expression mangling to match cxx-abi-dev discussion.
llvm-svn: 221623
2014-11-10 19:44:15 +00:00
Bob Wilson 94794d08b9 Only build iOS runtime libraries when the iOS SDKs are available.
This was already set up for the iOS simulator ASan dylib simulator,
and this change extends that to the other iOS runtime libraries.
This is in preparation for building all those iOS libraries against
the real SDKs instead of the fake SDKs in compiler-rt.

llvm-svn: 221614
2014-11-10 17:46:55 +00:00
Daniel Jasper 0bd9a19b28 clang-format: Fix pointer formatting.
Before:
  void f(Bar* a = nullptr, Bar * b);
After:
  void f(Bar* a = nullptr, Bar* b);

llvm-svn: 221609
2014-11-10 16:57:30 +00:00
Nico Weber a644d7f39c clang-format: [Java] Never treat @interface as annotation.
'@' followed by any keyword can't be an annotation, but @interface is currently
the only combination of '@' and a keyword that's allowed, so limit it to this
case. `@interface Foo` without a leading `public` was misformatted prior to
this patch.

llvm-svn: 221607
2014-11-10 16:30:02 +00:00
Nico Weber 337f5b27ad clang-format: Document that --assume-filename affects the language.
llvm-svn: 221606
2014-11-10 16:14:54 +00:00
Benjamin Kramer 283afa3f12 Remove unused diagnostic.
llvm-svn: 221605
2014-11-10 16:07:58 +00:00
Alexander Kornienko c48a535a7c [Tooling] Restore current directory after processing each file.
Summary:
If we actually change directory before processing a file, we need to
restore it afterwards. This was broken in r216620.

Added a comment for the changes in r216620.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 221600
2014-11-10 15:42:31 +00:00
Aaron Ballman 0de6a9b5bf Missing testcase from r221581.
llvm-svn: 221582
2014-11-08 17:09:50 +00:00
Aaron Ballman c0ae7dfe75 Updated the wording for a diagnostic to be more grammatically correct, and use a %select. Also ensure that nested namespace definitions are diagnosed properly. Both changes are motivated by post-commit feedback from r221580.
llvm-svn: 221581
2014-11-08 17:07:15 +00:00
Aaron Ballman 730476b50e [c++1z] Support for attributes on namespaces and enumerators.
llvm-svn: 221580
2014-11-08 15:33:35 +00:00
Richard Smith 3e3a705062 [c++1z] Support for u8 character literals.
llvm-svn: 221576
2014-11-08 06:08:42 +00:00
Richard Smith 13307f5f24 [c++1z] Implement nested-namespace-definitions.
This allows 'namespace A::B { ... }' as a shorthand for 'namespace A {
namespace B { ... } }'. We already supported this correctly for error recovery;
promote that support to a full implementation.

This is not the right implementation: we do not maintain source fidelity
because we desugar the nested namespace definition in the parser. This is
tricky to avoid, since the definition genuinely does inject one named
entity per level in the namespace name.

llvm-svn: 221574
2014-11-08 05:37:34 +00:00
Richard Smith 0f0af19b05 [c++1z] N4295: fold-expressions.
This is a new form of expression of the form:

  (expr op ... op expr)

where one of the exprs is a parameter pack. It expands into

  (expr1 op (expr2onwards op ... op expr))

(and likewise if the pack is on the right). The non-pack operand can be
omitted; in that case, an empty pack gives a fallback value or an error,
depending on the operator.

llvm-svn: 221573
2014-11-08 05:07:16 +00:00
Ben Langmuir ed98258482 Check module signature when the module has already been loaded
We may need to verify the signature on subsequent imports as well, just
like we verify the size/modtime:
@import A;
@import B; // imports A
@import C; // imports A

llvm-svn: 221569
2014-11-08 00:34:30 +00:00
Fariborz Jahanian e531d27cd1 Fixed a buildbot failure.
llvm-svn: 221568
2014-11-08 00:23:55 +00:00
Ben Langmuir 264ea15e19 Fix unintended fallthrough in ASTReader
llvm-svn: 221567
2014-11-08 00:06:39 +00:00
Fariborz Jahanian 05e77f8349 [Objective-C Sema]. Issue availability/deprecated warning when
there is a uinque method found when message is sent to receiver 
of 'id' type. // rdar://18848183

llvm-svn: 221562
2014-11-07 23:51:15 +00:00
Tim Northover 5a1558ec31 ARM ABI: simplify decisions on whether args can be expanded.
Homogeneous aggregates on AAPCS_VFP ARM need to be passed *without* being
flattened (e.g. [2 x float] rather than "float, float") for various weird ABI
reasons. However, this isn't the case for anything else; further, we know at
the ABIArgInfo::getDirect callsites whether this flattening is allowed.

So, we can get more unified ARM code, with a simpler Clang, by just using that
knowledge directly.

llvm-svn: 221559
2014-11-07 22:30:50 +00:00
Alexey Samsonov edf99a92c0 Introduce a SanitizerKind enum to LangOptions.
Use the bitmask to store the set of enabled sanitizers instead of a
bitfield. On the negative side, it makes syntax for querying the
set of enabled sanitizers a bit more clunky. On the positive side, we
will be able to use SanitizerKind to eventually implement the
new semantics for -fsanitize-recover= flag, that would allow us
to make some sanitizers recoverable, and some non-recoverable.

No functionality change.

llvm-svn: 221558
2014-11-07 22:29:38 +00:00
Kuba Brecka ea0a4dfd27 Use @rpath for ASan dylib in Makefiles
Reviewed at http://reviews.llvm.org/D6176

llvm-svn: 221557
2014-11-07 22:27:43 +00:00
Michael J. Spencer b011d48282 Fix style.
llvm-svn: 221546
2014-11-07 21:30:32 +00:00
Samuel Antao c909c9918f Fix clash of gcc toolchains in hexagon driver regression tests.
If clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by -ccc-install-dir. This causes several regression tests to fail as they will be using an unexpected path. Adding the switch --gcc-toolchain="" in each test command is not enough as the hexagon toolchain implementation in the driver is not evaluating this argument. This commit modifies the hexagon toolchain to take the --gcc-toolchain="" argument into account when deciding the toolchain path, similarly to what is already done for other targets toolchains. Additionally, the faulty regression tests are modified in order to --gcc-toolchain="" be passed to the commands.

llvm-svn: 221535
2014-11-07 17:48:03 +00:00
Fariborz Jahanian c48f7e76fa Revert r221404 which caused lldb to not display
vararg expressions.

llvm-svn: 221533
2014-11-07 16:47:05 +00:00
Timur Iskhodzhanov 5750f56a2b Improve comments in vtordisp tests: fix a typo, add a bit more clarity
llvm-svn: 221524
2014-11-07 14:11:14 +00:00
David Majnemer 1fb1a044e5 CodeGen, Itanium: Properly dllimport RTTI data
We would blindly assume that RTTI data should have the same linkage as
the vtable because we didn't think the RTTI data was external.  This
oversight stemmed because we didn't take dllimport into account.

This fixes PR21512.

llvm-svn: 221511
2014-11-07 07:26:38 +00:00
Frederic Riss 442293e83f Return a DIDescriptor from CGDebugInfo::getDeclarationOrDefinition...
... instead of a DIScope that might wrap something that's not actually
a DIScope (eg. a DIGlobalVariable);

llvm-svn: 221481
2014-11-06 21:12:06 +00:00
Charlie Turner 2919cbdb6c Remove references to the cortex-a9-mp CPU.
This CPU definition is redundant. The Cortex-A9 is defined as
supporting multiprocessing extensions. Remove references to this CPU.

This CPU was recently removed from LLVM. See http://reviews.llvm.org/D6057

Change-Id: I62ae7cc656fcae54fbaefc4b6976e77e694a8678
llvm-svn: 221458
2014-11-06 14:59:30 +00:00
Rafael Espindola 8b27bdb6c2 Don't manually insert L prefixes.
Simply marking the symbol private conveys the desire to hide them to LLVM.

llvm-svn: 221451
2014-11-06 13:30:38 +00:00
Andrea Di Biagio 9760a44d1a [X86] Slightly refactor default features for AMD bdver cpus (NFC). Also add missing checks to test for target features.
This patch simplifies how default target features are set for AMD bdver2
and bdver1. In particular, method 'getDefaultFeatures' now implements a
fallthrough from case 'CK_BDVER2' to case 'CK_BDVER1'.
That is because 'bdver2' has the same features available in bdver1 plus
BMI, FMA, F16C and TBM.

This patch also adds missing checks for predefined macros in test
predefined-arch-macros.c. In the case of BTVER2, the test now also checks 
for F16C, BMI and PCLMUL. In the case of BDVER3 and BDVER4, the test now
also checks for the presence of FSGSBASE.

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

llvm-svn: 221449
2014-11-06 12:08:57 +00:00
Alexey Bataev 73983918c4 Fix for exception specification mismatch in explicit instantiation.
According to C++ standard if an exception-specification is specified in an explicit instantiation directive, it shall be compatible with the exception-specifications of other declarations of that function. This patch adds checks for this.
Differential Revision: http://reviews.llvm.org/D5822

llvm-svn: 221448
2014-11-06 10:10:50 +00:00
Craig Topper db4dc08630 [X86] Use fallthroughs to reduce the number of calls to setFeatureEnabled for different CPUs.
llvm-svn: 221437
2014-11-06 05:52:19 +00:00
Rafael Espindola ee2b96b230 Use FileCheck.
llvm-svn: 221435
2014-11-06 04:56:05 +00:00
Rafael Espindola 3be19cefa4 Delete dead test.
llvm-svn: 221434
2014-11-06 04:48:05 +00:00
Fariborz Jahanian 5a29e6aadb Patch for small addition to availability attribute.
This is to accept "NA" in place of vesion number for availability
attribute. Used on introduced=NA to mean unavailable
and deprecated=NA to mean nothing (not deprecated).
rdar://18804883

llvm-svn: 221417
2014-11-05 23:58:55 +00:00
Reid Kleckner 7bfd8bccb5 cmake: Only export targets in the standalone build
Trying to fix bots that didn't like the fact that I exported targets
that depended on LLVM without exporting targets from LLVM.

llvm-svn: 221415
2014-11-05 23:51:45 +00:00
Reid Kleckner ed8bca4f42 Make it easier to build against a pre-built Clang package with CMake
Installing <prefix>/share/clang/cmake/ClangConfig.cmake makes CMake's
builtin find_package() utility work with Clang. This also allows
downstream consumers of Clang to statically link against libraries like
clangAST and have that pull in dependencies like clangBasic and
LLVMSupport.

See the CMake docs on packages:
http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html

llvm-svn: 221411
2014-11-05 23:14:59 +00:00
DeLesley Hutchins 6d41f38c74 Thread Safety Analysis: move warnings on range-based for loops out of beta
and into -Wthread-safety.

llvm-svn: 221410
2014-11-05 23:09:28 +00:00
Fariborz Jahanian 1839abdabe This patch fixes a crash after rebuilding call AST of
an __unknown_anytype(...). In this case, we rebuild the
vararg function type specially to convert the call expression
to  something that IRGen can handle. However, FunctionDecl
as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and
results in crash when accessing its params later on. This
patch fixes the crash by rebuilding the FunctionDecl to match
its new resolved type. rdar://15297105.
John McCall, please review post-commit. 

llvm-svn: 221404
2014-11-05 21:50:22 +00:00
Reid Kleckner dd43a5c41f cmake: Conditionalize CodeGen's dependency on intrinsics_gen
Custom targets in cmake cannot be exported, and this dependency is only
needed in the combined build to ensure that Intrinsics.gen is created
before compiling CodeGen. In the standalone, all of LLVM is build first.

llvm-svn: 221391
2014-11-05 20:30:55 +00:00
Frederic Riss b1ab28c949 [DebugInfo] Do not record artificial global initializer functions in the DeclCache.
When we are generating the global initializer functions, we call
CGDebugInfo::EmitFunctionStart() with a valid decl which is describing
the initialized global variable. Do not update the DeclCache with this
key as it will overwrite the the cached variable DIGlobalVariable with
the newly created artificial DISubprogram.

One could wonder if we should put artificial subprograms in the DIE tree
at all (there are vaild uses for them carrying line information though).

llvm-svn: 221385
2014-11-05 19:19:04 +00:00
Duncan P. N. Exon Smith 2b049767b3 IR: MDNode => Value: Update for LLVM API change in r221375
llvm-svn: 221376
2014-11-05 18:16:35 +00:00
Daniel Jasper e551bb70a3 Revert "clang-format: [js] Updates to Google's JavaScript style."
This reverts commit eefd2eaad43c5c2b17953ae7ed1e72b28e696f7b.

Apparently, this change was a bit premature.

llvm-svn: 221365
2014-11-05 17:22:31 +00:00
Ben Langmuir 6caebfda78 Remove superceded warning warn_forgotten_module_header
This DefaultIgnore warning under -Wincomplete-module was firing on
any module map files that happened to be parsed (it's only supposed to
fire on headers), and it has been superceded by
-Wnon-modular-include-in-module anyway.

For compatibility, I rewired -Wincomplete-module to imply
-Wnon-modular-include-in-module.

llvm-svn: 221357
2014-11-05 16:43:18 +00:00
Rafael Espindola 8cbf4a0b5d Support LLVM_BUILD_STATIC.
llvm-svn: 221346
2014-11-05 14:04:25 +00:00
Will Wilson 5f38367c72 MS ABI: Correctly mangle CV qualifiers from typedefs
llvm-svn: 221344
2014-11-05 13:54:21 +00:00
Daniel Jasper 502fac38e9 clang-format: Add test to prevent regression in r221125.
llvm-svn: 221339
2014-11-05 10:55:36 +00:00
Daniel Jasper 680b09ba88 clang-format: Improve free-standing macro detection.
Before:
  SOME_WEIRD_LOG_MACRO
  << "Something long enough to cause a line break";

After:
  SOME_WEIRD_LOG_MACRO
      << "Something long enough to cause a line break";

llvm-svn: 221338
2014-11-05 10:48:04 +00:00
NAKAMURA Takumi ee5e690c0a Mark darwin-debug-flags.c as REQUIRES:shell, due to quoting issue.
llvm-svn: 221332
2014-11-05 05:04:00 +00:00
Justin Bogner 12b50a95c9 clang-format: Make it possible to (require 'clang-format)
This makes the emacs integration ``provide`` a clang-format feature,
so that a .emacs can ``require`` it.

llvm-svn: 221330
2014-11-05 04:32:54 +00:00
Adrian Prantl 65d5d00cb7 Debug info: Emit the correct type for the __FuncPtr field in a block
descriptor.

rdar://problem/15984431

llvm-svn: 221326
2014-11-05 01:01:30 +00:00
Kaelyn Takata 445b0657a5 Filter out non-static class members when correcting non-member-references.
llvm-svn: 221319
2014-11-05 00:09:29 +00:00
Kuba Brecka e899e799b5 Fix the test failure on Windows introduced by r221279.
http://reviews.llvm.org/D6018

llvm-svn: 221316
2014-11-04 23:38:57 +00:00
Bob Wilson d5aad2a1e0 Use backslashes to escape spaces and other backslashes in -dwarf-debug-flags.
The command line options are specified in a space-separated list that is an
argument to -dwarf-debug-flags, so that breaks if there are spaces in the
options. This feature came from Apple's internal version of GCC, so I went back
to check how llvm-gcc handled this and matched that behavior.
rdar://problem/18775420

llvm-svn: 221309
2014-11-04 22:28:48 +00:00
Benjamin Kramer 7111b91ee7 Make helper function static. NFC.
llvm-svn: 221290
2014-11-04 20:26:01 +00:00
Roman Divacky 5cd8df6d1d Since the file has both ppc and ppc64 tests in it rename it.
llvm-svn: 221285
2014-11-04 18:49:15 +00:00
Roman Divacky c294022900 Rewrite the test to not require asserts.
llvm-svn: 221284
2014-11-04 18:48:20 +00:00
Kuba Brecka 9ff912db22 Use @rpath as LC_ID_DYLIB for ASan dylib on OS X
Change the LC_ID_DYLIB of ASan's dynamic libraries on OS X to be set to "@rpath/libclang_rt.asan_osx_dynamic.dylib" and similarly for iossim. Clang driver then sets the "-rpath" to be the real path to where clang currently has the dylib (because clang uses the relative path to its current executable). This means if you move the compiler or install the binary release, -fsanitize=address will link to the proper library.

Reviewed at http://reviews.llvm.org/D6018

llvm-svn: 221279
2014-11-04 17:35:17 +00:00
Yaron Keren 3c4c9fed08 Re-enable this test on Windows since it passes with GnuWin32 env.exe.
llvm-svn: 221271
2014-11-04 14:54:37 +00:00
NAKAMURA Takumi 06ac98299f Remove "REQUIRES:shell" from tests. They work for me.
llvm-svn: 221269
2014-11-04 13:41:33 +00:00
NAKAMURA Takumi 69e32f4562 clang/test/Tooling: Remove mention to PR15590 out of a couple of tests. They are suppressed with another issue.
llvm-svn: 221267
2014-11-04 13:32:29 +00:00
NAKAMURA Takumi 83910ae5b6 clang/test/Tooling: [PR15590] Avoid backslashes in JSON. Should work on win32.
llvm-svn: 221266
2014-11-04 13:32:17 +00:00
NAKAMURA Takumi cf15c170d5 clang/test/VFS/umbrella-mismatch.m: Let it work on win32 to avoid backslashes in yaml.
FIXME: Is it intentional? s;OUT_DIR;%/S/Inputs;
llvm-svn: 221264
2014-11-04 13:05:23 +00:00
NAKAMURA Takumi bf37ee795c clang/test/Coverage/html-diagnostics.c: Use find(1) to avoid globbing.
llvm-svn: 221263
2014-11-04 13:05:10 +00:00
NAKAMURA Takumi ed7e1cbc4c clang/test/Modules: Remove "REQUIRES:shell" since they work for me.
llvm-svn: 221261
2014-11-04 12:59:18 +00:00
Daniel Jasper d0ec0d62d6 clang-format: Use identifier table for keywords in other languages.
Slightly easier to write, more efficient and prevents bugs by
misspelling them.

No functional changes intended.

llvm-svn: 221259
2014-11-04 12:41:02 +00:00
Daniel Jasper 58fcf6df65 clang-format: [Java] Fix class declaration line breaks.
Before:
  @SomeAnnotation()
  abstract
      class aaaaaaaaa<a> extends bbbbbbbbbbbb<b> implements cccccccccccc {
  }

After:
  @SomeAnnotation()
  abstract class aaaaaaaaa<a> extends bbbbbbbbbbbb<b>
      implements cccccccccccc {
  }

llvm-svn: 221256
2014-11-04 10:53:14 +00:00
Daniel Jasper 20bc4b0f5c clang-format: Fix vim integration if g:clang_format_binary doesn't exist
llvm-svn: 221254
2014-11-04 10:40:26 +00:00
David Majnemer 7b2e22cec4 Driver: Pass some std::strings by reference instead of value
No functional change intended. This fixes PR21463.

llvm-svn: 221249
2014-11-04 08:55:13 +00:00
Alexander Kornienko 616860994d [clang-tidy] Move -extra-arg handling to CommonOptionsProvider
Summary:
Handle -extra-arg and -extra-arg-before options in the
CommonOptionsProvider so they can be used in all clang tools. Adjust arguments
in a CompilationDatabase wrapper instead of adding ArgumentsAdjuster to the
tool.

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 221248
2014-11-04 08:51:24 +00:00
Michael J. Spencer 04162eaced [llvm-api-change] Use findProgramByName.
llvm-svn: 221222
2014-11-04 01:30:55 +00:00
Reid Kleckner 8cd0079d16 Use the new LLVM_END_WITH_NULL name
llvm-svn: 221217
2014-11-04 01:13:43 +00:00
Reid Kleckner 06ea7d6213 Lower __builtin_fabs* to @llvm.fabs.*
mingw64's headers implement fabs by calling __builtin_fabs, so using the
library call results in an infinite loop. If the backend legalizes
@llvm.fabs as a call to fabs later, things should work out, as the crt
provides a definition.

llvm-svn: 221206
2014-11-03 23:52:09 +00:00
Reid Kleckner 4cad00abf3 Remove dead AST type argument to EmitFAbs
llvm-svn: 221205
2014-11-03 23:51:40 +00:00
Rafael Espindola 234d3bce01 Remove local handling of ASAN_OPTIONS and UBSAN_OPTIONS.
They are now forwarded by TestingConfig.py.

llvm-svn: 221200
2014-11-03 23:09:25 +00:00
Reid Kleckner 899baf3625 Move the no-prototype calling conv check after decl merging
Now we don't warn on this code:
  void __stdcall f(void);
  void __stdcall f();

My previous commit regressed this functionality because I didn't update
the relevant test case which used a definition.

llvm-svn: 221188
2014-11-03 21:56:03 +00:00
Reid Kleckner 1eaa844f3e Don't diagnose no-prototype callee-cleanup function definitions
We already have a warning on the call sites of code like this:
  void f() { }
  void g() { f(1, 2, 3); }
t.c:2:21: warning: too many arguments in call to 'f'

We can limit ourselves to diagnosing unprototyped forward declarations
of f to cut down on noise.

llvm-svn: 221184
2014-11-03 21:24:50 +00:00
Roman Divacky 1ae35b902b Require asserts to unbreak the buildbots.
llvm-svn: 221174
2014-11-03 19:50:48 +00:00
Fariborz Jahanian e3db7784b6 Further restrict issuance of 'override' warning if method
is argument to a macro which is defined in system header.

llvm-svn: 221172
2014-11-03 19:46:18 +00:00
Roman Divacky 8a12d84264 Implement vaarg lowering for ppc32. Lowering of scalars and aggregates
is supported. Complex numbers are not.

llvm-svn: 221170
2014-11-03 18:32:54 +00:00
Fariborz Jahanian d6efd3e0d0 This patch reverts r220496 which issues warning on comparing
parameters with nonnull attribute when comparison is always
true/false. Patch causes false positive when parameter is
modified in the function.

llvm-svn: 221163
2014-11-03 17:03:07 +00:00
Matt Arsenault 3f6469b4c6 Emit OpenCL local global variables without zeorinitializer
Local variables are not initialized, and every target has
been (incorrectly) ignoring the unnecessary request for
zero initialization.

llvm-svn: 221162
2014-11-03 16:51:53 +00:00
Hans Wennborg 8313c76836 Don't allow dllimport/export on classes with internal linkage (PR21399)
Trying to import or export such classes doesn't make sense, and Clang
would assert trying to export vtables for them.

This is consistent with how we treat functions with internal linkage,
but it is stricter than MSVC so we may have to back down if it breaks
real code.

llvm-svn: 221160
2014-11-03 16:09:16 +00:00
Daniel Jasper 82f9df9eb4 Revert "clang-format: [Java] Allow trailing semicolons after enums."
This reverts commit b5bdb2ef59ab922bcb4d6e843fffaee1f7f68a8c.

This doesn't really seem necessary on second though and causes problems
with C++ enum formatting.

llvm-svn: 221158
2014-11-03 15:42:11 +00:00
Hans Wennborg 606bd6dcc5 Don't dllimport inline functions when targeting MinGW (PR21366)
It turns out that MinGW never dllimports of exports inline functions.
This means that code compiled with Clang would fail to link with
MinGW-compiled libraries since we might try to import functions that
are not imported.

To fix this, make Clang never dllimport inline functions when targeting
MinGW.

llvm-svn: 221154
2014-11-03 14:24:45 +00:00
Craig Topper 54535fb069 [x86] Add cx16 feature to KNL, SKX, and CoreAVXi CPUs.
llvm-svn: 221132
2014-11-03 07:05:28 +00:00
Craig Topper 8dbc58436b [x86] Realphabetize the feature string decoding function since it was mostly in alphabetical order.
llvm-svn: 221131
2014-11-03 07:05:26 +00:00
Craig Topper 8c7f251e98 Add FSGSBASE intrinsics to x86 intrinsic headers.
llvm-svn: 221130
2014-11-03 06:51:41 +00:00
Craig Topper 554797f255 Remove definitions from Intrin.h that already exist in one of the other x86 intrinsic headers. Add a run line with Broadwell as the cpu type to ms-intrin.cpp test to catch some of these in the future.
llvm-svn: 221127
2014-11-03 04:19:58 +00:00
Daniel Jasper 5f2764d886 clang-format: [Java] Allow trailing semicolons after enums.
Before:
  enum SomeThing { ABC, CDE }
  ;

After:
  enum SomeThing { ABC, CDE };

llvm-svn: 221125
2014-11-03 03:00:42 +00:00
Daniel Jasper f056f45b77 clang-format: [Java] Fix more generics formatting.
Before:
  < T extends B > T getInstance(Class<T> type);

After:
  <T extends B> T getInstance(Class<T> type);

llvm-svn: 221124
2014-11-03 02:45:58 +00:00
Daniel Jasper db9a7a2f5f clang-format: [Java] Fix static generic methods.
Before:
  public static<R> ArrayList<R> get() {}

After:
  public static <R> ArrayList<R> get() {}

llvm-svn: 221122
2014-11-03 02:35:14 +00:00
Daniel Jasper 39af6cd5a4 clang-format: [Java] Fix class declaration formatting.
Before:
  @SomeAnnotation()
  abstract
      class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb implements cccccccccccc {
  }

After:
  @SomeAnnotation()
  abstract class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb
      implements cccccccccccc {
  }

llvm-svn: 221121
2014-11-03 02:27:28 +00:00
Daniel Jasper 8022226db7 clang-format: Fix false positive in lambda detection.
Before:
  delete [] a -> b;

After:
  delete[] a->b;

This fixes part of llvm.org/PR21419.

llvm-svn: 221114
2014-11-02 22:46:42 +00:00
Daniel Jasper df2ff002f0 clang-format: [Java] Support enums without trailing semicolon.
Before:
  class SomeClass {
    enum SomeThing { ABC, CDE } void f() {
    }
  }

After:
  class SomeClass {
    enum SomeThing { ABC, CDE }
    void f() {
    }
  }

This fixed llvm.org/PR21458.

llvm-svn: 221113
2014-11-02 22:31:39 +00:00
Daniel Jasper 5e7be1d536 clang-format: [Java] Don't break imports.
This fixes llvm.org/PR21453.

llvm-svn: 221112
2014-11-02 22:13:03 +00:00
Daniel Jasper b9d3db6b1b clang-format: [Java] Add space between "synchronized" and "(".
Before:
  synchronized(mData) {
    // ...
  }

After:
  synchronized (mData) {
    // ...
  }

This fixes llvm.org/PR21455.

llvm-svn: 221110
2014-11-02 22:00:57 +00:00
Daniel Jasper 7bd618f5aa clang-format: [Java] Support generics with "?".
Before:
  @Override
  public Map < String,
          ? > getAll() {
    // ...
  }

After:
  @Override
  public Map<String, ?> getAll() {
    // ...
  }

This fixes llvm.org/PR21454.

llvm-svn: 221109
2014-11-02 21:52:57 +00:00
Saleem Abdulrasool 4d195ed4b2 clang-format: permit setting the path to clang in vimrc
If g:clang_format_path is set in the vimrc, that path will take precedence over
the hard coded path (which is reliant on the PATH environment variable).  This
provides an easy mechanism for switching the selected clang-format binary during
development.

llvm-svn: 221108
2014-11-02 21:27:59 +00:00
Saleem Abdulrasool 8bbed0b63a docs: remove double carriage-return
The double carriage return would silence a warning due to a missing
.clang-format.  Permit the error to bubble through.

llvm-svn: 221107
2014-11-02 21:27:52 +00:00
Daniel Jasper a3ddf86dd4 clang-format: [Java] Support try/catch/finally blocks.
llvm-svn: 221104
2014-11-02 19:21:48 +00:00
Daniel Jasper 50b4bd7c0e clang-format: [Java] Don't break after extends/implements.
Before:
  abstract class SomeClass extends SomeOtherClass implements
      SomeInterface {}

After:
  abstract class SomeClass extends SomeOtherClass
      implements SomeInterface {}

llvm-svn: 221103
2014-11-02 19:16:41 +00:00
Bill Schmidt e6e9d15d5f [PowerPC] Change PPCTargetInfo::hasFeature() to use StringSwitch
Implement post-commit comment on r220989 from Eric Christopher.

llvm-svn: 221099
2014-11-02 14:56:41 +00:00
Craig Topper e1c664b136 Add _lzcnt_u32 and _lzcnt_u64 to lzcntintrin.h to match Intel documentation names for these intrinsics.
llvm-svn: 221066
2014-11-01 22:50:57 +00:00
Craig Topper a52e0d7cc0 Avoid undefined behavior in the x86 bmi header file by explicitly checking for 0 before calling __builtin_ctz. Without this the optimizers may take advantage of the undefined behavior and produce incorrect results. LLVM itself still needs to be taught to merge the zero check into the llvm.cttz with defined zero behavior.
llvm-svn: 221065
2014-11-01 22:50:54 +00:00
Craig Topper 3ca55d9c41 Avoid undefined behavior in the x86 lzcnt header file by explicitly checking for 0 before calling __builtin_clz. Without this the optimizers may take advantage of the undefined behavior and produce incorrect results. LLVM itself still needs to be taught to merge the zero check into the llvm.ctlz with defined zero behavior.
llvm-svn: 221064
2014-11-01 22:25:23 +00:00
David Majnemer 0868137ac8 CodeGen: Declutter the emitVirtualObjectDelete interface
No functionality change intended.

llvm-svn: 221043
2014-11-01 07:37:17 +00:00
David Majnemer b9bd6fb397 CodeGen: Virtual dtor thunks shouldn't have this marked as 'returned'
The ARM ABI virtual destructor thunks cannot be marked as 'returned'
because they return undef.

llvm-svn: 221042
2014-11-01 05:42:23 +00:00
NAKAMURA Takumi 8c89496d47 clang/lib/CodeGen/TargetInfo.cpp: Fix a couple of warnings. [-Winconsistent-missing-override]
llvm-svn: 221039
2014-11-01 01:32:27 +00:00
Richard Trieu 46847425c5 Fix a bug where -Wuninitialized would skip arguments to a function call.
llvm-svn: 221030
2014-11-01 00:46:54 +00:00
Reid Kleckner c311aba247 Silence a warning from MSVC "14" by making an enum unsigned
It says there is a narrowing conversion when we assign it to an unsigned
3 bit bitfield.

Also, use unsigned instead of size_t for the Size field of the struct in
question. Otherwise they won't run together in MSVC or clang-cl.

llvm-svn: 221019
2014-10-31 23:33:56 +00:00
Kaelyn Takata 4e43de4fad Fix an accidental self-assignment using std::move in r220723.
llvm-svn: 221008
2014-10-31 22:25:09 +00:00
Reid Kleckner 80944df6f4 Implement IRGen for the x86 vectorcall convention
The most complex aspect of the convention is the handling of homogeneous
vector and floating point aggregates.  Reuse the homogeneous aggregate
classification code that we use on PPC64 and ARM for this.

This convention also has a C mangling, and we apparently implement that
in both Clang and LLVM.

Reviewed By: majnemer

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

llvm-svn: 221006
2014-10-31 22:00:51 +00:00
Fariborz Jahanian a6556f7295 Objective-C SDK modernization tool. Use its own option
,-objcmt-migrate-property-dot-syntax, when migarting to use
property-dot syntax in place of messaging expression.
rdar://18839124

llvm-svn: 221001
2014-10-31 21:19:45 +00:00
Richard Trieu d4a0136002 Have -Wuninitialized catch uninitalized use in overloaded operator arguments.
llvm-svn: 221000
2014-10-31 21:10:22 +00:00
Anton Yartsev 5ad0169855 [analyzer] Helpful hints for Windows users of scan-build.
llvm-svn: 220999
2014-10-31 20:57:57 +00:00
David Majnemer 0c0b6d9ac6 MS ABI: Properly call global delete when invoking virtual destructors
Summary:
The Itanium ABI approach of using offset-to-top isn't possible with the
MS ABI, it doesn't have that kind of information lying around.

Instead, we do the following:
- Call the virtual deleting destructor with the "don't delete the object
  flag" set.  The virtual deleting destructor will return a pointer to
  'this' adjusted to the most derived class.
- Call the global delete using the adjusted 'this' pointer.

Reviewers: rnk

Subscribers: cfe-commits

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

llvm-svn: 220993
2014-10-31 20:09:12 +00:00
Fariborz Jahanian 6e21338abb C++-11 [qoi]. Do not warn on missing 'verride' on use of
macros in user code when macros themselves are defined
in a system header. rdar://18295240

llvm-svn: 220992
2014-10-31 19:56:27 +00:00
Bill Schmidt 691e01d94e [PowerPC] Initial VSX intrinsic support, with min/max for vector double
Now that we have initial support for VSX, we can begin adding
intrinsics for programmer access to VSX instructions.  This patch
performs the necessary enablement in the front end, and tests it by
implementing intrinsics for minimum and maximum using the vector
double data type.

The main change in the front end is to no longer disallow "vector" and
"double" in the same declaration (lib/Sema/DeclSpec.cpp), but "vector"
and "long double" must still be disallowed.  The new intrinsics are
accessed via vec_max and vec_min with changes in
lib/Headers/altivec.h.  Note that for v4f32, we already access
corresponding VMX builtins, but with VSX enabled we should use the
forms that allow all 64 vector registers.

The new built-ins are defined in include/clang/Basic/BuiltinsPPC.def.

I've added a new test in test/CodeGen/builtins-ppc-vsx.c that is
similar to, but much smaller than, builtins-ppc-altivec.c.  This
allows us to test VSX IR generation without duplicating CHECK lines
for the existing bazillion Altivec tests.

Since vector double is now legal when VSX is available, I've modified
the error message, and changed where we test for it and for vector
long double, since the target machine isn't visible in the old place.
This serendipitously removed a not-pertinent warning about 'long'
being deprecated when used with 'vector', when "vector long double" is
encountered and we just want to issue an error.  The existing tests
test/Parser/altivec.c and test/Parser/cxx-altivec.cpp have been
updated accordingly, and I've added test/Parser/vsx.c to verify that
"vector double" is now legitimate with VSX enabled.

There is a companion patch for LLVM.

llvm-svn: 220989
2014-10-31 19:19:24 +00:00
Kostya Serebryany 5f1b4e8f58 ignore -mconstructor-aliases when adding field paddings for asan
Summary:
When we are adding field paddings for asan even an empty dtor has to remain in the code,
so we ignore -mconstructor-aliases if the paddings are going to be added.

Test Plan: added a test

Reviewers: rsmith, rnk, rafael

Reviewed By: rafael

Subscribers: cfe-commits

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

llvm-svn: 220986
2014-10-31 19:01:02 +00:00
Daniel Jasper e9ab42df0c clang-format: [Java] Improve line breaks around annotations.
Before:
  @SomeAnnotation("With some really looooooooooooooong text") private static final
      long something = 0L;

  void SomeFunction(@Nullable
                    String something) {}

After:
  @SomeAnnotation("With some really looooooooooooooong text")
  private static final long something = 0L;

  void SomeFunction(@Nullable String something) {}

llvm-svn: 220984
2014-10-31 18:23:49 +00:00
Daniel Jasper f739b0dbfa clang-format: [js] Updates to Google's JavaScript style.
The style guide is changing..

llvm-svn: 220977
2014-10-31 17:50:40 +00:00
Anna Zaks 8a020310b8 [analyzer] Rename NewDeleteLeaks checker in the test script.
Fixup to r220289.

llvm-svn: 220976
2014-10-31 17:40:14 +00:00
David Blaikie 11ab078d80 Fix the build
llvm-svn: 220974
2014-10-31 17:18:09 +00:00
Reid Kleckner e9f6a717dd Fix ARM HVA classification of classes with non-virtual bases
Reuse the PPC64 HVA detection algorithm for ARM and AArch64. This is a
nice code deduplication, since they are roughly identical. A few virtual
method extension points are needed to understand how big an HVA can be
and what element types it can have for a given architecture.

Also make the record expansion code work in the presence of non-virtual
bases.

Reviewed By: uweigand, asl

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

llvm-svn: 220972
2014-10-31 17:10:41 +00:00
David Blaikie 9491a5cd4d Fix unused-function warning differently from r220853
Rather than executing this code only needed for an assertion even in a
non-asserts build, just roll the function into the assert. The assertion
text literally describes the two cases so it doesn't seem like this
benefits much from having a separate function (& have to hassle about
ifndef NDEBUG it out, etc)

llvm-svn: 220970
2014-10-31 17:08:11 +00:00
Argyrios Kyrtzidis 06e8d69ac7 [libclang] Disable spell-checking and warnings during code-completion since they are not needed.
llvm-svn: 220966
2014-10-31 16:44:32 +00:00
Argyrios Kyrtzidis d92da47707 [Makefile] If ENABLE_CLANG_ARCMT=0 it seems we don't build libclang, so the unittests for libclang should be disabled too.
This is a modified patch provided by Vassil Vassilev.

llvm-svn: 220965
2014-10-31 16:44:30 +00:00
Craig Topper c79e5e3432 Remove StorageClass typedefs from VarDecl and FunctionDecl since StorageClass is in the clang namespace.
llvm-svn: 220956
2014-10-31 06:57:13 +00:00
Craig Topper 1a07fd1845 Remove CastKind typedef from CastExpr since CastKind is in the clang namespace.
llvm-svn: 220955
2014-10-31 06:57:10 +00:00
Craig Topper 9ad7e26651 Remove a couple typedefs for things in the clang namespace with the same name. Remove a typedef that matches an identical one in the clang namespace.
llvm-svn: 220954
2014-10-31 06:57:07 +00:00
Hao Liu 6d45b8c385 [AArch64]Add 2 intrinsics vmov_n_p64/vmovq_n_p64, the alias for vdup_n_p64/vdup_n_p64.
As this change is too small, commit it directly.

llvm-svn: 220946
2014-10-31 02:41:37 +00:00
Richard Smith 1e2cf0dd4b [modules] When a .pcm file is explicitly built separately from the translation
unit, allow the -O settings of the two compilations to differ.

llvm-svn: 220943
2014-10-31 02:28:58 +00:00
Richard Smith d5e7ff856c Make QualType::dump() produce a useful dump of the structure of the type,
rather than simply pretty-printing it.

llvm-svn: 220942
2014-10-31 01:17:45 +00:00
NAKAMURA Takumi c73e402ad2 ASTDumper.cpp: Appease g++, for now.
llvm-svn: 220940
2014-10-31 00:30:37 +00:00
Kuba Brecka 2735a02572 Rename 'DarwinStaticLib' to 'DarwinLibName'
The former name doesn't make sense, we are using this parameter for both .a and .dylib libraries.

No functional change.

http://reviews.llvm.org/D6040

llvm-svn: 220939
2014-10-31 00:08:57 +00:00
Richard Smith f7514454a7 Refactor tree printing in AST dumping.
Instead of manually maintaining a flag indicating whether we're about to print
out the last child of the parent node (to determine whether we print "`" or
"|"), capture a callable to print that child and defer printing it until we
either see a next child or finish the parent.

No functionality change intended.

llvm-svn: 220930
2014-10-30 21:02:37 +00:00
Alexey Samsonov 035462c1cf Get rid of SanitizerOptions::Disabled global. NFC.
SanitizerOptions is not even a POD now, so having global variable of
this type, is not nice. Instead, provide a regular constructor and clear()
method, and let each CodeGenFunction has its own copy of SanitizerOptions
it uses.

llvm-svn: 220920
2014-10-30 19:33:44 +00:00
Anton Yartsev 9959295142 [analyzer] Updated tests for ZeroAllocDereference checker.
llvm-svn: 220911
2014-10-30 15:16:26 +00:00
Daniel Marjamaki 3f4062902a Update contact person in Open Projects webpage for copy-paste detection. From Per Viberg to Daniel Marjamäki.
llvm-svn: 220905
2014-10-30 12:44:33 +00:00
NAKAMURA Takumi ed1173e5a0 [autoconf] Add clangToolingCore.a to Makefile(s) for static build w/o libclang.dll.
llvm-svn: 220904
2014-10-30 10:31:29 +00:00
Craig Topper a2c5153edd Remove the last couple uses of the ExprArg(just Expr*) typedef in Parser.
llvm-svn: 220897
2014-10-30 05:30:05 +00:00
Craig Topper 7e54fef1c2 Remove some duplicate functions from the Parser class. Identical functions already exist in the clang namespace from Sema/Ownership.h.
llvm-svn: 220896
2014-10-30 05:17:10 +00:00
NAKAMURA Takumi 9f99a7a417 [CMake] Prune redundant libdeps.
llvm-svn: 220893
2014-10-30 01:37:44 +00:00
NAKAMURA Takumi dc872ed908 [CMake] Add dependencies on clangToolingCore.
llvm-svn: 220890
2014-10-30 00:44:01 +00:00
NAKAMURA Takumi 5fed305f87 [CMake] clangToolingCore requires clangLex.
llvm-svn: 220889
2014-10-30 00:43:44 +00:00
Daniel Jasper ac29eaccd2 clang-format: Format line if invoked on the trailing newline.
llvm-svn: 220883
2014-10-29 23:40:50 +00:00
Hans Wennborg 2f65f7ff58 Sink a #include while we're here. NFC.
Format.h doesn't use stack.

llvm-svn: 220879
2014-10-29 22:49:58 +00:00
Daniel Jasper 06dbac4be9 clang-format: Cut more clangAST dependencies.
Hopefully fixing windows builds.

llvm-svn: 220878
2014-10-29 22:42:53 +00:00
Hans Wennborg aa244c4cc4 Trim some includes. NFC.
llvm-svn: 220877
2014-10-29 22:13:46 +00:00
Hans Wennborg ac6073bb1f Follow-up to r216619: use isCXXCLassMember() instead of trying to
check the context ourselves when selectively allowing late-added
dll attributes on unused free functions and variables (PR20746)

llvm-svn: 220874
2014-10-29 21:20:57 +00:00
Daniel Jasper cb3e6188bc Refactor libTooling to reduce required dependencies.
This moves classes for storing and applying replacements to separate
files. These classes specifically are used by clang-format which doesn't
have any other dependencies on clangAST. Thereby, the size of
clang-format's binary can be cut roughly in half and its build time sped
up.

llvm-svn: 220867
2014-10-29 18:55:09 +00:00
Alexander Kornienko 2ce697b7ca Enable display of compiler diagnostics in clang-tidy.
llvm-svn: 220862
2014-10-29 17:28:51 +00:00
Saleem Abdulrasool a9884bfe3d test: generalise the test matching
The value names may change in different builds, use pattern based tests.

llvm-svn: 220861
2014-10-29 16:53:16 +00:00
Daniel Jasper 49a9a2833b clang-format: [JS] Support more regex literals.
Previously a regex-literal containing "/*" would through clang-format
off, e.g.:
  var regex = /\/*$/;

Would lead to none of the following code to be formatted.

llvm-svn: 220860
2014-10-29 16:51:38 +00:00
Saleem Abdulrasool a25fbef088 CodeGen: add __readfsdword builtin
The Windows NT SDK uses __readfsdword and declares it as a compiler provided
builtin (#pragma intrinsic(__readfsword).  Because intrin.h is not referenced
by winnt.h, it is not possible to provide an out-of-line definition for the
intrinsic.  Provide a proper compiler builtin definition.

llvm-svn: 220859
2014-10-29 16:35:41 +00:00
Jay Foad 6af95d3864 Fix warning in Altivec code when building with GCC 4.8.2 on Ubuntu 14.04.
llvm-svn: 220855
2014-10-29 14:42:12 +00:00
Eli Bendersky 95338a09c0 Pass aggregates on the stack without splitting in NVPTX.
Following the NVVM IR specifications, arguments of aggregate type should be
passed on the stack without splitting (byval).

http://reviews.llvm.org/D6020

Patch by Jacques Pienaar.

llvm-svn: 220854
2014-10-29 13:43:21 +00:00
NAKAMURA Takumi 639728da35 clang/lib/AST/Decl.cpp: Tweak isVLATypeCapturingAllowed() for -Asserts. [-Wunused-function]
llvm-svn: 220853
2014-10-29 13:27:44 +00:00
Ulrich Weigand a094f0428b [PowerPC ABI] Bug 21398 - Consider C++ base classes in HA classification
As discussed in bug 21398, PowerPC ABI code needs to consider C++ base
classes when classifying a class as homogeneous aggregate (or not) for
ABI purposes.

llvm-svn: 220852
2014-10-29 13:23:20 +00:00
NAKAMURA Takumi 7acc8a36c7 clang/test/CodeGen/captured-statements-nested.c: Tweak for -Asserts.
llvm-svn: 220851
2014-10-29 13:21:52 +00:00
Alexey Bataev 330de03083 Improved capturing variable-length array types in CapturedStmt.
An updated implemnentation of VLA types capturing based on previously committed solution for Lambdas.
This version captures the whole VLA type instead of particular variables which are part of VLA size expression and allows to use previusly calculated size of VLA type in captured regions. Required for OpenMP.
Differential Revision: http://reviews.llvm.org/D5099

llvm-svn: 220850
2014-10-29 12:21:55 +00:00
Serge Pavlov 77af3812ec Use enumerators instead of hardcoded integers when we decide if keyword is enabled.
llvm-svn: 220849
2014-10-29 10:59:18 +00:00
NAKAMURA Takumi 44d4d9a4cb Don't capture DeclRefExpr::getNameInfo().getInfo(). It returns reference in temporary object.
DeclarationNameInfo::getInfo() returns reference, but DeclRefExpr::getNameInfo() returns temporary DeclarationNameInfo().

It triggered a local crash for me.

  Failing Tests (1):
      Clang :: SemaTemplate/instantiate-overload-candidates.cpp

  Assertion failed!
  Program: bin\clang.EXE
  File: clang/lib/Basic/SourceManager.cpp, Line 822
  Expression: 0 && "Invalid SLocOffset or bad function choice"

llvm-svn: 220841
2014-10-29 08:11:47 +00:00
Fariborz Jahanian 937224777a Objective-C modern rewriter. Patch to fix a rewriting bug
rewriting an Objective-C block. Patch by Ryan Govostes.
rdar://18799145 

llvm-svn: 220834
2014-10-28 23:46:58 +00:00
Hans Wennborg 349847d02a The dllimport.cpp test was gating some checks on #ifndef MSABI,
but MSABI was never defined in the test. It seems we are erroring
on code that we should be accepting when compiling for MSVC compatibility.

This should make the test less confusing until PR21406 is fixed.

llvm-svn: 220825
2014-10-28 22:15:55 +00:00
Fariborz Jahanian d20bfb623d Objective-C remove an unused enumerator which causes
warning in a switch statement.

llvm-svn: 220819
2014-10-28 20:21:33 +00:00
Daniel Jasper f0c809a19b clang-format: Improve && detection as binary operator.
Before:
  template <class T,
            class = typename ::std::enable_if<
                ::std::is_array<T>{}&& ::std::is_array<T>{}>::type>
  void F();

After:
  template <class T,
            class = typename ::std::enable_if<
                ::std::is_array<T>{} && ::std::is_array<T>{}>::type>
  void F();

llvm-svn: 220813
2014-10-28 18:28:22 +00:00
Fariborz Jahanian 9ad94aa280 Objective-C. revert patch for rdar://17554063.
llvm-svn: 220812
2014-10-28 18:28:16 +00:00
Daniel Jasper acb7e25d5f clang-format: Fix test.
llvm-svn: 220807
2014-10-28 18:18:02 +00:00
Daniel Jasper 13a7f469be clang-format: Improve && detection as binary operators.
Before:
  template <class T, class = typename std::enable_if<std::is_integral<
                         T>::value &&(sizeof(T) > 1 || sizeof(T) < 8)>::type>
  void F();

After:
  template <class T, class = typename std::enable_if<
                         std::is_integral<T>::value &&
                         (sizeof(T) > 1 || sizeof(T) < 8)>::type>
  void F();

llvm-svn: 220805
2014-10-28 18:11:52 +00:00
Fariborz Jahanian dbae11348a Actually remove this test entirely.
llvm-svn: 220803
2014-10-28 17:32:36 +00:00
Fariborz Jahanian 214567ccfa [Objective-C]. revert r220740,r220727
llvm-svn: 220802
2014-10-28 17:26:21 +00:00
Daniel Jasper 2ad0aba610 clang-format: Improve function declaration detection.
Before:
  ReturnType MACRO
      FunctionName() {}

After:
  ReturnType MACRO
  FunctionName() {}

This fixes llvm.org/PR21404.

I wonder what the motivation for that if-condition was. But as no test
breaks, ...

llvm-svn: 220801
2014-10-28 17:06:04 +00:00
Richard Smith 241ae2cecf PR17730: Add test that we don't crash on this testcase. (The bug is already fixed.)
llvm-svn: 220787
2014-10-28 17:00:19 +00:00
Daniel Jasper eb2226e4bd clang-format: Update generated documentation with new flag.
llvm-svn: 220786
2014-10-28 16:56:37 +00:00
Richard Smith 0b350b9ec5 PR21367: Don't accept rvalue references as an extension in C++98 mode if we're in a new-type-id or conversion-type-id, since those things can legitimately be followed by a binary && operator.
llvm-svn: 220785
2014-10-28 16:55:02 +00:00
Daniel Jasper 50d634b343 clang-format: [ObjC] Add separate flag to control indentation in blocks
Apparently, people are very much divided on what the "correct"
indentation is. So, best to give them a choice.

The new flag is called ObjCBlockIndentWidth and the default is now set
to the same value as IndentWidth for the pre-defined styles.

llvm-svn: 220784
2014-10-28 16:53:38 +00:00
Richard Smith 96261ddfa1 Extend test to check that -D flags do not leak across module boundaries.
llvm-svn: 220782
2014-10-28 16:30:57 +00:00
Daniel Jasper e003b78e37 clang-format: Fix test after recent flag change.
llvm-svn: 220781
2014-10-28 16:29:56 +00:00
Richard Smith 96fdab6eb5 [modules] Allow -I, -D, -W flags to change between building a module and
explicitly using the resulting .pcm file. Unlike for an implicit module build,
we don't need nor want to require these flags to match between the module
and its users.

llvm-svn: 220780
2014-10-28 16:24:08 +00:00
Daniel Jasper b89fbe60e3 clang-format: Don't put functions on a single line in Google's Java
style.

llvm-svn: 220778
2014-10-28 16:15:52 +00:00
Samuel Benzaquen c640ef5634 Add valueDecl() matcher.
Summary: Add valueDecl() matcher.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 220776
2014-10-28 13:33:58 +00:00
NAKAMURA Takumi 314df7a5aa clang/test/Modules/explicit-build.cpp: Tweak to meet win32's backslash.
llvm-svn: 220770
2014-10-28 11:34:29 +00:00
Richard Trieu 9ad40ac76d Fix warning text: lower -> higher
llvm-svn: 220763
2014-10-28 04:37:34 +00:00
Saleem Abdulrasool 56dd1ac16f Driver: remove a stray s that propagated in cross-windows
The option is '--allow-multiple-definition' not '--allow-multiple-definitions'.

llvm-svn: 220760
2014-10-28 03:15:02 +00:00
Rafael Espindola 37ad134219 Update for LLVM API change.
llvm-svn: 220742
2014-10-28 00:29:51 +00:00
Fariborz Jahanian 294eecf69e Improve on the diagnostic in my last patch and change warning
to error. rdar://18768214.

llvm-svn: 220740
2014-10-27 23:41:04 +00:00
Richard Smith 79c98cc9fc Remove unused variable.
llvm-svn: 220738
2014-10-27 23:25:15 +00:00
Rafael Espindola c008c64326 Use the newer/simple API for passing a diagnostic handler to the IR linker.
llvm-svn: 220733
2014-10-27 23:02:34 +00:00
Richard Smith d4b230b378 [modules] Load .pcm files specified by -fmodule-file lazily.
llvm-svn: 220731
2014-10-27 23:01:16 +00:00
Fariborz Jahanian 992bdf1b45 Objective-C ARC [qoi]. Issue diagnostic if __bridge casting
to C type a collection literal. rdar://18768214

llvm-svn: 220727
2014-10-27 22:33:06 +00:00
David Majnemer f0822fb00a Frontend: Don't include stdin in the dependency list for an object file
GCC doesn't do this and it semes weird to include a file that we can't
open.

This fixes PR21362.

llvm-svn: 220726
2014-10-27 22:31:50 +00:00
Hans Wennborg a41521a8bd Try to appease the C++ gods
Looks like some builds were not happy with the potentially-throwing move
constructor that was added in r220723, and reached for the implicitly
deleted copy constructor instead.

llvm-svn: 220725
2014-10-27 22:28:50 +00:00
Hans Wennborg 5d83872245 Give TypoExprState a move constructor and assignment operator to appease MSVC build
llvm-svn: 220723
2014-10-27 21:50:49 +00:00
Samuel Benzaquen d93fcc1b28 Fix segfault in hasDeclContext for nodes that have no decl context.
Summary:
Some declarations do not have a declaration context, like TranslationUnitDecl.
Fix hasDeclContext() to not segfault on these nodes.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 220719
2014-10-27 20:58:44 +00:00
David Majnemer 8ef921a48b Frontend: Define __EXCEPTIONS if -fexceptions is passed
GCC defines __EXCEPTIONS, regardless of language mode, if -fexceptions
is passed.  We should do the same.

This fixes PR21358.

llvm-svn: 220714
2014-10-27 20:02:19 +00:00
Kostya Serebryany 68c29da4c5 Do not insert asan paddings after fields that have flexible arrays.
Summary:
We should avoid a tail padding not only if the last field
has zero size but also if the last field is a struct with a flexible array.

If/when http://reviews.llvm.org/D5478 is committed,
this will also handle the case of structs with zero-sized arrays.

Reviewers: majnemer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 220708
2014-10-27 19:34:10 +00:00
Fariborz Jahanian f920a0aa26 c++11 patch to issue warning on missing 'override' on
overriding methods. Patch review by Richard Smith.
rdar://18295240

llvm-svn: 220703
2014-10-27 19:11:51 +00:00
Kaelyn Takata fe408a77f6 Wire up LookupMemberExpr to use the new TypoExpr.
This includes adding the new TypoExpr-based lazy typo correction to
LookupMemberExprInRecord as an alternative to the existing eager typo
correction.

llvm-svn: 220698
2014-10-27 18:07:46 +00:00
Kaelyn Takata 8363f04ee6 Add a callback for recovering using a typo correction.
Also keep track of the stack of Exprs visited during the tree transform
so the callback can be passed the parent of the TypoExpr.

llvm-svn: 220697
2014-10-27 18:07:42 +00:00
Kaelyn Takata 9ab7fb6b73 Add simple way for a CorrectionCandidateCallback to reject exact
matches of the typo.

Also be more proactive about checking a correction's visibility so that
a correction requiring a module import can be distinguished from the
original typo even if it looks identical. Otherwise the correction will
be excluded and the diagnostic about needing the module import won't be
emitted.

Note that no change was made to checkCorrectionVisibility other than
moving where it is at in SemaLookup.cpp.

llvm-svn: 220696
2014-10-27 18:07:40 +00:00
Kaelyn Takata 6c759519bb Start adding the infrastructure for handling TypoExprs.
Part of the infrastructure is a map from a TypoExpr to the Sema-specific
state needed to correct it, along with helpers to ease dealing with the
state.

The the typo count is propagated up the stack of
ExpressionEvaluationContextRecords when one is popped off of to
avoid accidentally dropping TypoExprs on the floor. For example,
the attempted correction of g() in test/CXX/class/class.mem/p5-0x.cpp
happens with an ExpressionEvaluationContextRecord that is popped off
the stack prior to ActOnFinishFullExpr being called and the tree
transform for TypoExprs being run.

llvm-svn: 220695
2014-10-27 18:07:37 +00:00
Kaelyn Takata 0d6a3edcce Have TypoCorrectionConsumer remember the TypoCorrections it returned.
Two additional methods are provided: one to return the current
correction (the last correction returned by getNextCorrection), and one
to "reset" the state so that getNextCorrection will return the previous
corrections before returning any new corrections.

Also ensure that all TypoCorrections have valid source ranges.

llvm-svn: 220694
2014-10-27 18:07:34 +00:00
Kaelyn Takata 89c881b548 Pass around CorrectionCandidateCallbacks as unique_ptrs so
TypoCorrectionConsumer can keep the callback around as long as needed.

llvm-svn: 220693
2014-10-27 18:07:29 +00:00
Kaelyn Takata e1f49d545d Add the initial TypoExpr AST node for delayed typo correction.
llvm-svn: 220692
2014-10-27 18:07:20 +00:00
Kaelyn Takata d2287c3942 Move TypoCorrectionConsumer into a header.
This makes it available outside of SemaLookup.cpp, as
needed for the forthcoming TypoExpr AST node which will
keep a TypoCorrectionConsumer that provides the possible
typo corrections for that TypoExpr.

llvm-svn: 220691
2014-10-27 18:07:13 +00:00
Daniel Jasper e068ac77a2 clang-format: Don't break after very short return types.
Before:
  void
  SomeFunction(int parameter);

After:
  void SomeFunction(
      int parameter);

(Unless AlwaysBreakAfterDefinitionReturnType after type is set).

llvm-svn: 220686
2014-10-27 17:13:59 +00:00
Saleem Abdulrasool 1f060a8552 clang-format: improve vim integration docs
Improve the documentation for vim integration of clang-format.  Prefer the use
of <c-o> to do the normal mode command execution to avoid side-effects of the
escape and re-insertion (cursor movement).  Tweak the macros to use a double
return to avoid having to manually return control to the editor from the
subprocess.

llvm-svn: 220685
2014-10-27 17:13:33 +00:00
Daniel Jasper 5634619389 clang-format: Fix bad merging of lines in nested blocks.
Before:
  SomeFunction([]() {
  #define A a
    return 43; });

After:
  SomeFunction([]() {
  #define A a
    return 43;
  });

llvm-svn: 220684
2014-10-27 16:31:46 +00:00
Samuel Benzaquen 7af8800095 Speed up clang-tidy when profiling in on.
Summary:
Speed up clang-tidy when profiling in on.
It makes profiling runs twice as fast by reusing the time samples between the
different actions.
It also joins together the sampling of different matchers of the same check.

Reviewers: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 220682
2014-10-27 15:22:59 +00:00
Viktor Kutuzov d553bcff4f Allow thread sanitizer in clang driver on FreeBSD
http://reviews.llvm.org/D5999

llvm-svn: 220680
2014-10-27 13:51:25 +00:00
Daniel Jasper ce2fdb0a0a clang-format: [Proto] Change formatting text-formatted options.
Before:
  optional Type type = 1 [(mutate_options) = {vital : true
                                              abc : false}];

After:
  optional Type type = 1 [(mutate_options) = {
    vital : true
    abc : false
  }];

llvm-svn: 220679
2014-10-27 13:25:59 +00:00
NAKAMURA Takumi 729be14435 Prune CRLF.
llvm-svn: 220678
2014-10-27 12:37:26 +00:00
Viktor Kutuzov 64df1f177b Revert rL220675 due to failures on check-clang
llvm-svn: 220677
2014-10-27 12:33:10 +00:00
Viktor Kutuzov bff42de11c Allow thread sanitizer in clang driver on FreeBSD
Differential Revision: http://reviews.llvm.org/D5994

llvm-svn: 220675
2014-10-27 11:26:01 +00:00
NAKAMURA Takumi 59c74b225a Fix unicode chars into ascii in comment lines.
llvm-svn: 220668
2014-10-27 08:08:18 +00:00
Eric Christopher e7b87e5cc9 Fix 80-column and other odd formatting.
llvm-svn: 220659
2014-10-26 23:40:33 +00:00
Benjamin Kramer a885796d5f Make VFS and FileManager match the current MemoryBuffer API.
This eliminates converting back and forth between the 3 formats and
gives us a more homogeneous interface.

llvm-svn: 220657
2014-10-26 22:44:13 +00:00
Hans Wennborg d7580835cb ModuleMap.cpp: fix Windows build, take 2
llvm-svn: 220646
2014-10-26 20:00:53 +00:00
Hans Wennborg 0ef0aeca4f ModuleMap.cpp: fix VS2012 build
llvm-svn: 220644
2014-10-26 19:39:46 +00:00
Daniel Jasper 09c7c93937 Delete unused method and clangAST dependency it required.
llvm-svn: 220640
2014-10-26 14:26:55 +00:00
NAKAMURA Takumi 0e98d93824 ModuleMap::addHeader(): Appease msc17.
llvm-svn: 220639
2014-10-26 13:12:35 +00:00
Saleem Abdulrasool f0ba6ce309 Driver: reduce search logic duplication
Refactor the path search into a helper function to avoid duplicating the path
handling for the search.  NFC.

llvm-svn: 220628
2014-10-25 23:33:21 +00:00
Saleem Abdulrasool d0b6a4ac67 test: attempt to make test more hermetic
Add a fake linker in to a sysroot to use for testing the driver's tool
invocation.  Should make the test behave similarly on all platforms.  Addresses
review comments from Reid Kleckner from SVN r220546.

llvm-svn: 220625
2014-10-25 20:49:12 +00:00
Saleem Abdulrasool eeafce17e6 Driver: assume that all architectures are supported for libstc++
Rather than asserting that the target is unsupported, make a guess at what the
tree for a port would look like and use that for the search path.

Addresses review comments from Ried Kleckner for SVN r220547.

llvm-svn: 220624
2014-10-25 20:48:35 +00:00
David Majnemer d3c3e78ac1 Lex: Fix an invalid access into a SmallString
We would crash because we used operator[] to access past the end of a
SmallString.  This occured because our token had length zero.

Instead, form the pointer using .data() and arithmetic.  This is safe
because this forms a one-past-the-end pointer and it is only used to
compare with another one-past-the-end pointer.

This fixes PR21379.

llvm-svn: 220614
2014-10-25 11:40:40 +00:00
Rafael Espindola 0706548182 Update for LLVM api change.
llvm-svn: 220609
2014-10-25 04:06:14 +00:00
Rafael Espindola 5a1106f8fc Make this test a bit stricter by checking clang's output too.
llvm-svn: 220604
2014-10-25 01:51:19 +00:00
David Majnemer 4b9d964925 CodeGen: Don't form weak dllexport aliases
The MS linker cannot do anything interesting with these, it doesn't make
sense to emit them.

This fixes PR21373.

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

llvm-svn: 220595
2014-10-24 22:05:27 +00:00
Saleem Abdulrasool d9e54a99f6 test: correct an overzealous search-and-replace
The temporary initialized is referenced as %0, not as the auto-release pool.
Fixes R+A tests.

llvm-svn: 220593
2014-10-24 21:23:49 +00:00
Saleem Abdulrasool b31b94a8f7 CodeGen: correct materialize temporary aggregates in ARC mode
Avoid an assertion when materializing a lifetime type aggregate temporary.  When
performing CodeGen for ObjC++, we could generate a lifetime-only aggregate
temporary by using an initializer list (which is effectively an array).  We
would reach through the temporary expression, fishing out the inner expression.
If this expression was a lifetime expression, we would attempt to emit this as a
scalar.  This would eventually result in an assertion as the emission would
eventually assert that the expression being emitted has a scalar evaluation
kind.

Add a case to handle the aggregate expressions.  Use the EmitAggExpr to emit the
aggregate expression rather than the EmitScalarInit.

Addresses PR21347.

llvm-svn: 220590
2014-10-24 20:23:43 +00:00
Richard Smith 202210b369 [modules] Support combining 'textual' with 'private'.
llvm-svn: 220589
2014-10-24 20:23:01 +00:00
David Majnemer 90a3b19e64 Itanium ABI: Template template parameters are usable as substitutions
Template template parameters weren't added to the list of substitutions.
This would make the substitution map contain inaccurate mappings,
leading to Clang violating the Itanium ABI and breaking compatibility
with GCC.

This fixes PR21351.

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

llvm-svn: 220588
2014-10-24 20:22:57 +00:00
Saleem Abdulrasool 8925dc0ae0 CodeGen: trivial conversion to range based loop
Switch to a range-based for loop.  NFC.

llvm-svn: 220587
2014-10-24 19:54:32 +00:00
Saleem Abdulrasool 8f6de2504d test: add -std=c++11
This test uses C++11 features (r-value references) in ObjC++.  Add a -std=c++11
to silence a warning.  NFC.

llvm-svn: 220586
2014-10-24 19:54:29 +00:00
David Majnemer 922ad9fd8c CodeGen: GLValue exprs in template parameters should have reference type
This fixes a corner-case where __uuidof as a template argument would
result in us trying to emit a GLValue as an RValue.  This would lead to
a crash down the road.

llvm-svn: 220585
2014-10-24 19:49:04 +00:00
Reid Kleckner a48d977ee2 Fix windows-cross.c test on my machine
I suspect it will need a custom sysroot to pass reliably elsewhere.

llvm-svn: 220576
2014-10-24 17:55:29 +00:00
Reid Kleckner d7857f05f4 Add frontend support for __vectorcall
Wire it through everywhere we have support for fastcall, essentially.

This allows us to parse the MSVC "14" CTP headers, but we will
miscompile them because LLVM doesn't support __vectorcall yet.

Reviewed By: Aaron Ballman

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

llvm-svn: 220573
2014-10-24 17:42:17 +00:00
Serge Pavlov d024f528b4 Use enumerators instead of hardcoded integers when processing macro names.
llvm-svn: 220572
2014-10-24 17:31:32 +00:00
Benjamin Kramer 5e3a421bfc [Modules] Free modules that failed signature verification.
The control flow and ownership is weird enough so unique_ptr doesn't help here :(

llvm-svn: 220569
2014-10-24 16:31:42 +00:00
Daniel Sanders aa1b35590f [mips] Mark aggregate arguments passed in registers with the inreg attribute
Summary:
This allows us to easily identify them in the backend which in turn allows us
to handle them correctly for big-endian targets (where they must be shifted
into the upper bits of the register).

Depends on D5961

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits, theraven

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

llvm-svn: 220566
2014-10-24 15:30:16 +00:00
Daniel Sanders 5b445b3844 [mips] Promote all integral/enumeration types to the GPR width
Summary:
Ensure all integral/enumeration types are appropriately annotated with
signext/zeroext. In particular, i32 now has these attributes when using the
N32/N64 ABI. This paves the way for accurately representing the way the
N32/N64 ABI's promotes integer arguments to i64.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits, theraven

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

llvm-svn: 220563
2014-10-24 14:42:42 +00:00
Olivier Goffart df6d7b1564 Fix initializing TypeOfTypeLoc
This fixes a crash in the RecursiveASTVisitor on such code
 __typeof__(struct F*) var[invalid];

The UnderlyingTInfo of a TypeOfTypeLoc was left uninitialized when
created from ASTContext::getTrivialTypeSourceInfo
This lead to a crash in RecursiveASTVisitor when trying to access it.

llvm-svn: 220562
2014-10-24 13:52:55 +00:00
Benjamin Kramer 967c079082 ASTMatchers: Peel off a layer of indirection from true matcher. NFC.
llvm-svn: 220560
2014-10-24 13:29:21 +00:00
Benjamin Kramer 79f1590ef4 ASTMatchers: for-rangify loops. No functionality change.
llvm-svn: 220559
2014-10-24 13:29:15 +00:00
Benjamin Kramer 4114ca076c Add arguments() to CXXConstructExpr so the same interface as with CallExpr can be used.
llvm-svn: 220558
2014-10-24 13:29:07 +00:00
Aaron Ballman b2e2c1bd96 Report when a function-try-block does not return a value on all control paths. Fixed PR14620.
llvm-svn: 220557
2014-10-24 13:19:19 +00:00
Oliver Stannard abed2eeaea [Thumb] Clang thinks "char" is signed when using a thumb triple
'char' is unsigned on all ARM and Thumb architectures. Clang gets this
right for ARM, and for thumb when using and arm triple and the -mthumb
option, but gets it wrong for thumb triples. This fixes that.

llvm-svn: 220555
2014-10-24 11:28:47 +00:00
NAKAMURA Takumi 3866e52803 [CMake] clangRewrite: Roll back clangAST in libdeps, due to clang::Stmt::printPretty().
llvm-svn: 220549
2014-10-24 08:44:01 +00:00
Saleem Abdulrasool 432f461e4d Driver: add missed file from previous commit
llvm-svn: 220547
2014-10-24 03:24:33 +00:00
Saleem Abdulrasool 543a78b55e Driver: add CrossWindowsToolChain
This is a very basic toolchain.  It supports cross-compiling Windows (primarily
inspired by the WoA target).  It is meant to use clang with the LLVM IAS and a
binutils ld-compatible interface for the linker (eventually to be lld).  It does
not perform any "standard" GCC lookup, nor does it perform any special
adjustments given that it is expected to be used in an environment where the
user is using MSVCRT (and as such Visual Studio headers) and the Windows SDK.
The primary runtime library is expected to be compiler-rt and the C++
implementation to be libc++.

It also expects that a sysroot has been setup given the usual Unix semantics
(standard C headers in /usr/include, all the import libraries available in
/usr/lib).  It also expects that an entry point stub is present in /usr/lib
(crtbegin.obj for executables, crtbeginS.obj for shared libraries).

The entry point stub is responsible for running any GNU constructors.

llvm-svn: 220546
2014-10-24 03:13:37 +00:00
Nick Lewycky f04f237e0c Add a new -fmerge-functions -cc1 flag that enables function merging.
llvm-svn: 220543
2014-10-24 00:49:29 +00:00
Hans Wennborg ec53c29932 Don't emit strong vtable definitions for imported classes with key functions (PR21355)
Clang would previously assert on the following code when targeting MinGW:

  struct __declspec(dllimport) S {
      virtual ~S();
  };
  S::~S() {}

Because ~S is a key function and the class is dllimport, we would try to emit a
strong definition of the vtable, with dllimport - which is a conflict. We
should not emit strong vtable definitions for imported classes.

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

llvm-svn: 220532
2014-10-23 22:40:46 +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
Richard Smith a182530633 [modules] Simplify reading of INPUT_FILE_OFFSETS record and make it robust against changes to record order.
llvm-svn: 220524
2014-10-23 22:18:29 +00:00
Richard Smith 03478d952d Factor out common checks from module map deserialization. No functionality change.
llvm-svn: 220521
2014-10-23 22:12:14 +00:00
Daniel Jasper f322eb5c45 clang-format: Fix incorrect space after "<".
Before:
  bool a = 2 <::SomeFunction();

After:
  bool a = 2 < ::SomeFunction();

llvm-svn: 220505
2014-10-23 20:22:22 +00:00
Daniel Jasper 4475a249e7 Remove code duplication and cut dependency from clangRewrite on
clangAST.

llvm-svn: 220502
2014-10-23 19:47:36 +00:00
Fariborz Jahanian 4c8cb14c1a patch to issue warning on comparing parameters with
nonnull attribute when comparison is always
true/false. Patch by Steven Wu with few fixes and minor
refactoring and adding tests by me. rdar://18712242

llvm-svn: 220496
2014-10-23 19:00:10 +00:00
Ben Langmuir 487ea14a46 Add a "signature" to AST files to verify that they haven't changed
Since the order of the IDs in the AST file (e.g. DeclIDs, SelectorIDs)
is not stable, it is not safe to load an AST file that depends on
another AST file that has been rebuilt since the importer was built,
even if "nothing changed". We previously used size and modtime to check
this, but I've seen cases where a module rebuilt quickly enough to foil
this check and caused very hard to debug build errors.

To save cycles when we're loading the AST, we just generate a random
nonce value and check that it hasn't changed when we load an imported
module, rather than actually hash the whole file.

This is slightly complicated by the fact that we need to verify the
signature inside addModule, since we might otherwise consider that a
mdoule is "OutOfDate" when really it is the importer that is out of
date. I didn't see any regressions in module load time after this
change.

llvm-svn: 220493
2014-10-23 18:05:36 +00:00
David Blaikie 3813b2650f DebugInfo: Correctly describe the lexical decl context of static member variable definitions.
The previous IR representation used the non-lexical decl context, which
placed the definitions in the same scope as the declarations (ie: within
the class) - this was hidden by the fact that LLVM currently doesn't
respect the context of global variable definitions at all, and always
puts them at the top level (as direct children of the compile_unit).
Having the correct lexical scope improves source fidelity and simplify
backend global variable emission (with changes coming shortly).

Doing something similar for non-member global variables would help
simplify/cleanup things further (see FIXME in the commit) and provide
similar source fidelity benefits to the final debug info.

llvm-svn: 220488
2014-10-23 16:39:49 +00:00
Richard Smith 30428bc844 Revert accidentally-committed files in r220460.
llvm-svn: 220461
2014-10-23 02:02:31 +00:00
Richard Smith feb54b6ded Refactor implementation of 'exclude header'.
This was not a real header role, and was never exposed to clients of ModuleMap.
Remove the enumeration value for it and track it as marking the header as
'known' rather than creating an extra KnownHeader entry that *every single*
client ignores.

llvm-svn: 220460
2014-10-23 02:01:19 +00:00
Richard Smith b8afebe259 Fix covered-switch warning.
llvm-svn: 220456
2014-10-23 01:03:45 +00:00
Alexey Samsonov ecfd5c84ca Revert r218541 - Don't link in sanitizer runtimes if -nostdlib/-nodefaultlibs is provided.
This is a sad thing to do, but all the alternatives look ugly.

Looks like there are legitimate cases when users may want to link
with sanitizer runtimes *and* -nodefaultlibs (and ensure they provide
replacements for system libraries). For example, this happens in libc++
test suite.

"-nodefaultlibs" is told to link only the libraries explicitly provided
by the user, and providing "-fsanitize=address" is a clear indication of
intention to link with ASan runtime.
We can't easily introduce analogue of "-print-libgcc-name": linking with
sanitizers runtimes is not trivial: some runtimes are split into several
archive libraries, which are required to be wrapped in
-whole-archive/-no-whole-archive.

If "-fsanitize=whatever" and "-nodefaultlibs" are provided, system library
dependencies of sanitizer runtimes (-lc/-ldl/-lpthread/-lrt) will *not* be
linked, and user would have to link them in manually. Note that this can
cause problems, as failing to provide "-lrt" might lead to crashes in runtime
during ASan initialization. But looks like we should bite this bullet.

See r218541 review thread for the discussion.

llvm-svn: 220455
2014-10-23 00:46:10 +00:00
Nick Lewycky d935be3568 Update the documentation for API change to CreateASTConsumer the rest of the way.
llvm-svn: 220450
2014-10-22 23:57:14 +00:00
Richard Smith 5974ee637e Test files I forgot to svn add in r220448.
llvm-svn: 220449
2014-10-22 23:52:04 +00:00
Richard Smith 306d892076 [modules] Add support for 'textual header' directives.
This allows a module to specify that it logically contains a file, but that
said file is non-modular and intended for textual inclusion. This allows
layering checks to work properly in the presence of such files.

llvm-svn: 220448
2014-10-22 23:50:56 +00:00
David Majnemer 51c8b3e9db Basic: Add ext_delete_void_ptr_operand to -Wdelete-incomplete
This fixes PR21340.

llvm-svn: 220442
2014-10-22 23:03:58 +00:00
Zachary Turner 34eb943fb2 Fix C++ compliance issue. string literals must be const char *
llvm-svn: 220434
2014-10-22 21:48:56 +00:00
David Majnemer 48c28fa6db Parse: Ignore "long" and "short" in #pragma section
This fixes PR21337.

llvm-svn: 220429
2014-10-22 21:08:43 +00:00
Aaron Ballman ce6c67e040 Removing the setLBracLoc and setRBracLoc functions from CompoundStmt -- their only use was with the AST reader, and friendship can be used to handle that. Drive-by rename of "Brac" to "Brace" for the private data members. NFC.
llvm-svn: 220428
2014-10-22 21:06:18 +00:00
Reid Kleckner 4f9c0eeff8 Fix up attribute documentation links to MSDN in a nicer way
llvm-svn: 220426
2014-10-22 20:54:25 +00:00
Zachary Turner 10d75b2f95 Make a good guess about where MSVC and Windows SDK libraries are for linking.
When a user has not configured a standard Visual Studio environment
by running vcvarsall, clang tries its best to find Visual Studio
include files and executables anyway.  This patch makes clang also
try to find system and Windows SDK libraries for linking against,
as well.

Reviewed by: Hans Wennborg
Differential Revision: http://reviews.llvm.org/D5873

llvm-svn: 220425
2014-10-22 20:40:43 +00:00
Zachary Turner 0eaf8fc4ac Resubmit "Improve Windows toolchain support for non-standard environments."
This resubmits change r220226.  That change broke the chromium
build bots because chromium it ships an hermetic MSVC toolchain
that it expects clang to fallback to by finding it on the path.

This patch fixes the issue by bumping up the prioritization of PATH
when looking for MSVC binaries.

Reviewed by: Hans Wennborg, Reid Kleckner
Differential Revision: http://reviews.llvm.org/D5892

llvm-svn: 220424
2014-10-22 20:40:28 +00:00
Aaron Ballman eab478c7a8 Create a documentation category for the new calling convention documentation. Drive-by fixing of duplicate target names from a previous commit.
llvm-svn: 220419
2014-10-22 20:33:24 +00:00
Samuel Benzaquen 43dcf2172a Add support for profiling the matchers used.
Summary:
Add support for profiling the matchers used.
This will be connected with clang-tidy to generate a report to determine
and debug slow checks.

Reviewers: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 220418
2014-10-22 20:31:05 +00:00
Reid Kleckner 2633341b4a Try to fix link errors in mingw cmake -DBUILD_SHARED_LIBS=ON
llvm-svn: 220417
2014-10-22 20:20:35 +00:00
Reid Kleckner e892ec7e46 Add documentation for calling convention attributes
llvm-svn: 220415
2014-10-22 20:14:27 +00:00
Rafael Espindola ea1e86e80d Remove unused DiagnosticsEngine::NumErrorsSuppressed member.
Patch by Brad King!

llvm-svn: 220413
2014-10-22 20:09:12 +00:00
David Blaikie 3c7dd6be20 Correct importing of the type of a TemplateArgument
It's not clear how this would be tested - I imagine we should have an
ASTImporter test that RAVs the new AST and checks that all the elements
in it are from this ASTContext and not the foreign one... but I know
little about the ASTImporter and how/where that testing might be done.

(post-commit review feedback from Richard Smith on r219900)

llvm-svn: 220411
2014-10-22 19:54:16 +00:00
David Blaikie 60a877b5b9 DebugInfo: Omit scopes in -gmlt to reduce metadata size (on disk and in memory)
I haven't done any actual impact analysis of this change as it's a
strict improvement, but I'd be curious to know how much it helps.

llvm-svn: 220408
2014-10-22 19:34:33 +00:00
Alexey Samsonov 6d87ce8bd5 Fixup for r220403: Use getFileLoc() instead of getSpellingLoc() in SanitizerBlacklist.
This also handles the case where function name (not its body)
is obtained from macro expansion.

llvm-svn: 220407
2014-10-22 19:34:25 +00:00
Alexey Samsonov fa7a8569bb SanitizerBlacklist: Use spelling location for blacklisting purposes.
When SanitizerBlacklist decides if the SourceLocation is blacklisted,
we need to first turn it into a SpellingLoc before fetching the filename
and scanning "src:" entries. Otherwise we will fail to fecth the
correct filename for function definitions coming from macro expansion.

llvm-svn: 220403
2014-10-22 18:26:07 +00:00
Reid Kleckner 89bd8d62f3 Reland r219810 "Fix late template parsing leak with incremental processing"
Original message:
Add a second late template parser callback meant to cleanup any
resources allocated by late template parsing.  Call it from the
Sema::ActOnEndOfTranslationUnit method after all pending template
instantiations have been completed.  Teach Parser::ParseTopLevelDecl to
install the cleanup callback when incremental processing is enabled so
that Parser::TemplateIds can be freed.

Patch by Brad King!

llvm-svn: 220400
2014-10-22 17:50:19 +00:00
Reid Kleckner 0ba8ba4eca MS ABI: Emit more canonical vbptr stores and loads
This eliminates some i8* GEPs and makes the IR that clang emits a bit
more canonical. More work is needed for vftables, but that isn't a clear
win so I plan to send it for review.

llvm-svn: 220398
2014-10-22 17:26:00 +00:00
Rafael Espindola 1bd906d530 Remove unused StmtVector& parameters from declaration parsing functions.
Patch by Eelis van der Weegen!

llvm-svn: 220387
2014-10-22 14:27:08 +00:00
Diego Novillo 795f53ba64 Support using sample profiles with partial debug info (driver)
Summary:
When using a profile, we used to require the use -gmlt so that we could
get access to the line locations. This is used to match line numbers in
the input profile to the line numbers in the function's IR.

But this is actually not necessary. The driver can provide source
location tracking without the emission of debug information. In these
cases, the annotation 'llvm.dbg.cu' is missing from the IR, but the
actual line location annotations are still present.

This patch tells the driver to only emit source location tracking
when -fprofile-sample-use is present in the command line.

Reviewers: echristo, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 220383
2014-10-22 13:00:05 +00:00
Daniel Jasper 6ef29a36ca clang-format: Fix tests after recent change to ObjC block formatting.
llvm-svn: 220376
2014-10-22 09:50:23 +00:00
Daniel Jasper 76284683f1 clang-format: Use AllowShortBlocksOnASingleLine for ObjC blocks, too.
llvm-svn: 220375
2014-10-22 09:12:44 +00:00
Daniel Jasper b52c69e567 clang-format: Fix broken test.
llvm-svn: 220374
2014-10-22 09:01:12 +00:00
Daniel Jasper e8a4939b77 clang-format: Fix incorrect trailing return arrow detection.
Before:
  auto doSomething(Aaaaaa* aaaaaa) -> decltype(aaaaaa -> f()) {}

After:
  auto doSomething(Aaaaaa* aaaaaa) -> decltype(aaaaaa->f()) {}

llvm-svn: 220373
2014-10-22 08:42:58 +00:00
Richard Trieu 353a4b4283 Fix style issue from r220363. No functional change.
llvm-svn: 220370
2014-10-22 05:21:59 +00:00
Richard Trieu 277ace025d Disable the uninitialized field warning in uninstantiated classes.
If a templated class is not instantiated, then the AST for it could be missing
some things that would throw the field checker off.  Wait until specialization
before emitting these warnings.

llvm-svn: 220363
2014-10-22 02:52:00 +00:00
Saleem Abdulrasool 819f391dae Driver: rename Windows to MSVCToolChain
This renames the Windows toolchain to MSVCToolChain.  This is a preparatory step
for adding a CrossWindowsToolChain which uses clang/libc++/(ld/lld) without the
standard GCC toolchain lookup.  NFC.

llvm-svn: 220362
2014-10-22 02:37:29 +00:00
Richard Smith e842a47452 [modules] Initial support for explicitly loading .pcm files.
Implicit module builds are not well-suited to a lot of build systems. In
particular, they fare badly in distributed build systems, and they lead to
build artifacts that are not tracked as part of the usual dependency management
process. This change allows explicitly-built module files (which are already
supported through the -emit-module flag) to be explicitly loaded into a build,
allowing build systems to opt to manage module builds and dependencies
themselves.

This is only the first step in supporting such configurations, and it should
be considered experimental and subject to change or removal for now.

llvm-svn: 220359
2014-10-22 02:05:46 +00:00
NAKAMURA Takumi a267847538 <float.h>: Don't seek #include_next if -ffreestanding for targeting mingw.
llvm-svn: 220356
2014-10-22 01:25:49 +00:00
Richard Smith d20f1e6dd3 PR21327 / C++ DR1652 / C++ DR73: comparing a past-the-end pointer for one
complete object to a pointer to the start of another complete object does
not evaluate to the constant 'false'. All other comparisons between the
addresses of subobjects of distinct complete objects still do.

llvm-svn: 220343
2014-10-21 23:01:04 +00:00
Matt Arsenault 2174a9dc28 R600: Update for div_fmas intrinsic change
llvm-svn: 220339
2014-10-21 22:21:41 +00:00
Richard Smith 6377f8f7fb [modules] When building an injected-class-name type, we may have to insert it
into multiple merged classes' TypeForDecl slots.

llvm-svn: 220331
2014-10-21 21:15:18 +00:00
Aaron Ballman 9d35e2e70e Removing unused variable (assigned into, but never read from); NFC.
llvm-svn: 220313
2014-10-21 19:37:56 +00:00
Aaron Ballman 7a6f36440d Follow-up commit to r211657 which introduced these macros, but not for MSVC. This turns out to break our freestanding tests on Windows when compiling in MSVC-compatible mode. It was decided (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20141020/116942.html is the start of the thread) to support this as part of Clang's interface on all platforms.
llvm-svn: 220312
2014-10-21 19:24:06 +00:00
Hal Finkel 4add5dc093 Treat -g1 as -gline-tables-only
-g1 on gcc (and also IBM's xlc) are documented to be very similar to
-gline-tables-only. Our -gline-tables-only might still be more verbose than -g1
on other compilers, but currently we treat -g1 as -g, and so we're producing
much more debug info at -g1 than everybody else. Treating -g1 as
-gline-tables-only brings us much closer to what everyone else is doing.

For more information, see the discussion on
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-October/039649.html

llvm-svn: 220311
2014-10-21 19:20:21 +00:00
Justin Bogner 33bdbc66d3 Driver: Quote the command in crash reproduction scripts.
This fixes crash report generation when filenames have spaces. It also
removes an awkward workaround that quoted *some* arguments when
generating crash reports.

llvm-svn: 220307
2014-10-21 18:03:08 +00:00
Justin Bogner 256451561c Driver: Move crash report command mangling into Command::Print
This pushes the logic for generating a crash reproduction script
entirely into Command::Print, instead of Command doing half of the
work and then relying on textual substitution for the rest. This makes
this logic much easier to read and will simplify fixing a couple of
issues in this area.

llvm-svn: 220305
2014-10-21 17:24:44 +00:00
Aaron Ballman 953e985ed0 The nodebug attribute has a C++11-style spelling supported by GCC as well. This modifies it so we support that spelling as well.
llvm-svn: 220297
2014-10-21 15:46:57 +00:00
Aaron Ballman 560aa94ede Fixing the MSVC build by removing friendship with CodeGenFunction; NFC.
llvm-svn: 220293
2014-10-21 13:39:56 +00:00
Anton Yartsev 6ca45c92a9 [analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus package.
llvm-svn: 220289
2014-10-21 12:41:36 +00:00
Daniel Jasper c0126864a0 clang-format: [Java] Understand string literal concatenation.
Before:
  String someString = "abc" + "cde";

After:
  String someString = "abc"
                      + "cde";

llvm-svn: 220287
2014-10-21 11:34:53 +00:00