Commit Graph

34378 Commits

Author SHA1 Message Date
Daniel Jasper 86fee2fa3d clang-format: (JavaScript) Don't crash on empty string literals.
Before, this would lead to a crash:
  f('', true);

llvm-svn: 200540
2014-01-31 12:49:42 +00:00
Renato Golin e807c12c7a ARM RT libs with generic name
llvm-svn: 200538
2014-01-31 11:47:28 +00:00
NAKAMURA Takumi 413496f89b [CMake] Prune stray entries in add_dependencies(). target_link_libraries() implies it.
llvm-svn: 200531
2014-01-31 11:19:04 +00:00
Tim Northover 5309111c22 ARM & AArch64: unify the rest of the completely shared NEON implementations
This should be the last routine patch: AArch64 does still delegate to
EmitARMBuiltinExpr, but the remaining instances have complications of
one sort or another so some more cunning thought will be needed.

llvm-svn: 200528
2014-01-31 10:46:52 +00:00
Tim Northover ba1e344d90 ARM & AArch64: another block of miscellaneous NEON sharing.
llvm-svn: 200527
2014-01-31 10:46:49 +00:00
Tim Northover 027b4ee607 ARM & AArch64: move shared vld/vst intrinsics to common implementation.
llvm-svn: 200526
2014-01-31 10:46:45 +00:00
Tim Northover 9d3ab5fe9f ARM & AArch64: more instructions into common block
llvm-svn: 200525
2014-01-31 10:46:41 +00:00
Tim Northover 61fc835d6e ARM & AArch64: merge another NEON block completely.
llvm-svn: 200524
2014-01-31 10:46:36 +00:00
Argyrios Kyrtzidis 278c8d33e2 [Sema] For -Wnon-literal-null-conversion warning, look through integer casts, which are used
by some projects in their null macro.

rdar://15925483

llvm-svn: 200521
2014-01-31 07:51:32 +00:00
Alexey Bataev ec3da87f82 [OPENMP] Bug fixes in threadprivate declaration and data sharing attributes processing. (http://llvm-reviews.chandlerc.com/D2451)
llvm-svn: 200513
2014-01-31 05:15:34 +00:00
Alexey Bataev 286d1b929d Make x86 Android default target CPUs compatible with GCC (http://llvm-reviews.chandlerc.com/D2655)
llvm-svn: 200510
2014-01-31 04:07:13 +00:00
David Majnemer 04a835798a Driver: Don't use DOS style paths on UNIX
We'd add, as a fallback, DOS style paths when using the driver using a
win32 triple.  On a UNIX-like platform, this isn't particularly helpful.

llvm-svn: 200507
2014-01-31 01:35:55 +00:00
Ben Langmuir 332aafede3 Fix autolinking when modules are imported in pch files
Add the ImportDecl to the set of interesting delcarations that are
deserialized eagerly when an AST file is loaded (rather than lazily like
most decls). This is required to get auto linking to work when there is
no explicit import in the main file. Also resolve a FIXME to rename
'ExternalDefinitions', since that is only one of the things that need eager
deserialization. The new name is 'EagerlyDeserializedDecls'. The corresponding
AST bitcode is also renamed.

llvm-svn: 200505
2014-01-31 01:06:56 +00:00
Peter Collingbourne 252444a777 Introduce Parser::completeExpression.
This function returns a list of completions for a given expression and
completion position.

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

llvm-svn: 200497
2014-01-30 22:38:41 +00:00
Richard Smith 538b52a2fc PR14995: Allow a dependent type as the second parameter of operator++ and
operator--, since it might instantiate as 'int' (or, if it's a pack, it
might instantiate as an empty pack).

llvm-svn: 200496
2014-01-30 22:24:05 +00:00
Richard Smith 40f08ebece Don't produce a 'returning reference to local' warning if a lambda returns a
reference (or pointer) to a variable from the closure object or from the
surrounding function scope.

llvm-svn: 200494
2014-01-30 22:05:38 +00:00
Ben Langmuir 5eb7cb74a7 Revert "Fix assertion failures on annot_* tokens in clang -E"
This is causing a failure in the msan buildbot that I am having trouble
reproducing.  Reverting until I can figure out what went wrong.

llvm-svn: 200492
2014-01-30 21:50:18 +00:00
Ben Langmuir 5944ecd64c Fix assertion failures on annot_* tokens in clang -E
In particular, #pragma clang __debug, and #include implicitly changed
into @import were causing assertion failures.

llvm-svn: 200475
2014-01-30 18:09:55 +00:00
Tim Northover 58c4474dea ARM & AArch64: extend shared NEON implementation to first block.
This extends the refactoring to the whole of the first block of
trivial correspondences (as a fairly arbitrary boundary).

llvm-svn: 200472
2014-01-30 14:48:01 +00:00
Tim Northover ac85c341ae ARM & AArch64: fully share NEON implementation of permutation intrinsics
As a starting point, this moves the CodeGen for NEON permutation
instructions (vtrn, vzip, vuzp) into a new shared function.

llvm-svn: 200471
2014-01-30 14:47:57 +00:00
Tim Northover c322f838bc ARM & AArch64: share the BI__builtin_neon enum defs.
llvm-svn: 200470
2014-01-30 14:47:51 +00:00
Daniel Jasper a88f80a1be clang-format: Support ObjC's NS_ENUMs.
Before:
  typedef NS_ENUM(NSInteger, MyType) {
      /// Information about someDecentlyLongValue.
      someDecentlyLongValue,
      /// Information about anotherDecentlyLongValue.
      anotherDecentlyLongValue,
      /// Information about aThirdDecentlyLongValue.
      aThirdDecentlyLongValue};

After:
  typedef NS_ENUM(NSInteger, MyType) {
    /// Information about someDecentlyLongValue.
    someDecentlyLongValue,
    /// Information about anotherDecentlyLongValue.
    anotherDecentlyLongValue,
    /// Information about aThirdDecentlyLongValue.
    aThirdDecentlyLongValue
  };

llvm-svn: 200469
2014-01-30 14:38:37 +00:00
Jakob Stoklund Olesen 5b630b4e96 SPARCv9 supports atomic operations up to 64 bits.
Patch by Roman Divacky!

llvm-svn: 200452
2014-01-30 04:48:04 +00:00
John McCall 2575d88059 Diagnose typedef names for linkage purposes that would change
a previously-computed linkage as an unsupportable error condition.

Per discussion on cfe-commits, this appears to be a
difficult-to-resolve flaw in our implementation approach;
we may pursue this as a language defect, but for now it's
better to diagnose it as unsupported than to produce
inconsistent results (or assertions).  Anything that we can
do to limit how often this diagnostic fires, such as the
changes in r200380, is probably for the best, though.

llvm-svn: 200438
2014-01-30 01:12:53 +00:00
Fariborz Jahanian 13b4304937 Objective-C [IRGen]. Generator a tail call to objc_getProperty() in
synthesized getters for performance improvement. 
// rdar://15884113

llvm-svn: 200430
2014-01-30 00:16:39 +00:00
Aaron Ballman 35db2b3d4c Consolidating several table-generated files containing parser-related string switches into a single file. This reduces build-related complexity by replacing four separate projects (and table-gen instantiations) with a single one.
No functional changes intended.

llvm-svn: 200424
2014-01-29 22:13:45 +00:00
David Majnemer 2c4e00ac1c Sema: Diagnose improper application of inheritance keywords
We would previously allow inappropriate inheritance keywords to appear
on class declarations.  We would also allow inheritance keywords on
templates which were not fully specialized; this was divergent from
MSVC.

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

llvm-svn: 200423
2014-01-29 22:07:36 +00:00
Daniel Jasper f24301d79c clang-format: More custom option fixes for protocol buffer files.
Before:
  repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {
                               aaaaaaaaaaaaaaaa : AAAAAAAAAA,
                               bbbbbbbbbbbbbbbb : BBBBBBBBBB
                             }];

After:
  repeated double value = 1
      [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa : AAAAAAAAAA,
                              bbbbbbbbbbbbbbbb : BBBBBBBBBB}];

llvm-svn: 200406
2014-01-29 18:52:43 +00:00
Daniel Jasper 6e58feef76 clang-format: Fix formatting of custom proto options.
Before:
  repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {
                              aaaaaaaaaaaaaaaaa : AAAAAAAA
                            }];

After:
  repeated double value = 1
      [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaaa : AAAAAAAA}];

llvm-svn: 200405
2014-01-29 18:43:40 +00:00
Artyom Skrobov e72a6f7a70 Cortex-M3 and Cortex-M4 should not enable hwdiv-arm (committing again, with an updated test)
llvm-svn: 200385
2014-01-29 09:43:07 +00:00
Manuel Klimek 14bd917470 Fix crash on unmatched #endif's.
The following snippet would crash:
  #endif
  #if A

llvm-svn: 200381
2014-01-29 08:49:02 +00:00
John McCall 8a4e2e41de Short-circuit a couple of queries (and avoid corrupting
the linkage cache) when type-checking static local
variables.

There's a very deep problem here where the linkage of
a declaration can suddenly massively change as soon as
it's given a typedef name; these fixes, while optimizations
in their own right, are really just targeted workarounds.

rdar://15928125

llvm-svn: 200380
2014-01-29 08:33:09 +00:00
John McCall 30268ca2e0 Extensively comment bitfield layout, rearrange some
code for legibility, and fix a bug with bitfields in packed
ms_structs.

rdar://15926990

llvm-svn: 200379
2014-01-29 07:53:44 +00:00
Hans Wennborg cfdd8b54cf clang-cl: Better error message when trying to compile stdin (PR18640)
We should suggest using /Tc or /Tp to set the input type, instead of
erroneously suggesting -x, which isn't a clang-cl flag.

llvm-svn: 200362
2014-01-29 01:04:40 +00:00
Yunzhong Gao eeeb8dafed Fixing PR18430 by checking that the size of bitfields plus padding does not
grow into the following virtual base.

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

llvm-svn: 200359
2014-01-29 00:09:16 +00:00
Richard Trieu 1e632af0d4 A new conversion warning for when an Objective-C object literal is implicitly
cast into a boolean true value.  This warning will catch code like:

if (@0) {}
if (@"foo") {}

llvm-svn: 200356
2014-01-28 23:40:26 +00:00
Hans Wennborg 1fd6dd3616 Intrin.h: include setjmp.h to get a jmp_buf definition
This makes sure that the ms-intrin.cpp test passes by providing
a mock setjmp.h as a test input.

llvm-svn: 200344
2014-01-28 23:01:59 +00:00
Hans Wennborg 740a4d6e46 Intrin.h: implement __rdtsc and __halt
llvm-svn: 200343
2014-01-28 22:55:01 +00:00
Fariborz Jahanian f40ef45c9d Objective-C. Fixes a bug where "new" family attribute
was not being overridden in the category method implementation
resulting in bogus warning. // rdar://15919775

llvm-svn: 200342
2014-01-28 22:46:29 +00:00
Fariborz Jahanian 33fa962441 Objective-C. provide legacy encoding of *id and *Class types
instead of crashing.  // rdar://15824769.

llvm-svn: 200338
2014-01-28 20:41:15 +00:00
Daniel Jasper 559b63cbb9 clang-format: Understand __attribute__s preceding parameter lists.
Before:
  ReturnType __attribute__((unused))
      function(int i);

After:
  ReturnType __attribute__((unused))
  function(int i);

This fixes llvm.org/PR18632.

llvm-svn: 200337
2014-01-28 20:13:43 +00:00
Daniel Jasper a0e9be2bb2 clang-format: Fix option formatting in protocol buffer files.
Before:
  optional int32 foo[ default = true, deprecated = true ];

After:
  optional int32 foo[default = true, deprecated = true];

llvm-svn: 200327
2014-01-28 18:51:11 +00:00
Daniel Jasper e9beea24ef clang-format: Add support for a space after @property
Mozilla and WebKit seem to use a space after @property (verified by
grepping their codebases) so we turn this on there as well.

Change by Christian Legnitto. Thank you!

llvm-svn: 200320
2014-01-28 15:20:33 +00:00
Amara Emerson 9dc7878ac5 [ARM] Fix AAPCS-VFP non-compliance when returning HFA from variadic functions.
Arguments and return values must always be marshalled as for the base
AAPCS when the callee is a variadic function.

Patch by Oliver Stannard!

llvm-svn: 200307
2014-01-28 10:56:36 +00:00
NAKAMURA Takumi 11387c9621 [CMake] clangStaticAnalyzerFrontend: Deprecate LLVM_NO_RTTI.
llvm-svn: 200296
2014-01-28 09:43:16 +00:00
Alexey Bataev 40e7522ebd Turn on PIC by default on Android (http://llvm-reviews.chandlerc.com/D2603)
llvm-svn: 200290
2014-01-28 06:30:35 +00:00
Aaron Ballman 54fe5eb8cb Relaxing the alignment requirements for fields in a transparent_union. Emits the diagnostic only when subsequent alignments are more strict than the alignment required by the first field.
Fixes PR15134

llvm-svn: 200277
2014-01-28 01:47:34 +00:00
Kaelyn Uhrain 59baee8451 Apply the typo correction replacement location fix from r191450 to the
case when correcting for too many arguments (r191450 had only fixed the
problem for when there were too few arguments). Also fix the underlining
for both cases.

llvm-svn: 200268
2014-01-28 00:46:47 +00:00
Richard Smith 2e87e14490 Remove dead code; MacroDirective's IsHidden flag is always false.
llvm-svn: 200265
2014-01-27 23:54:39 +00:00
Fariborz Jahanian 122d94fd61 ObjectiveC. Fixes a bug in recognition of an ivar
backing a property resulting in bogus warning.
// rdar://15890251

llvm-svn: 200254
2014-01-27 22:27:43 +00:00
Aaron Ballman c669cc0d77 Add a new attribute meta-spelling called "GCC" -- it widens into being a GNU spelling, and a CXX11 spelling with the namespace "gnu". It also sets a bit on the spelling certifying that it is known to GCC. From this, we can warn about the extension appropriately. As a consequence, the FunctionDefinition functionality is completely removed.
Replacing the functionality from r199676, which didn't solve the problem as elegantly.

llvm-svn: 200252
2014-01-27 22:10:04 +00:00
Reid Kleckner 33630907d6 Revert "intrin.h: include setjmp.h to get a jmp_buf definition"
This failed the ms-intrin.cpp test.

This reverts commit r200237.

This also comments out the _setjmpex declaration for now so that
intrin.h will work on x64 targets.

llvm-svn: 200243
2014-01-27 19:32:42 +00:00
Reid Kleckner 2c35b3b029 Revert "Cortex-M3 and Cortex-M4 should not enable hwdiv-arm"
This reverts commit r200233.

The test required a registered ARM target, it was testing LLVM's
generated assembly, and it should have been an IRGen test.

llvm-svn: 200242
2014-01-27 19:26:39 +00:00
Reid Kleckner f08d658d48 Add implementations of some MSVC intrinsics
Adds an implementation for _InterlockedCompareExchangePointer() and
__faststorefence().

Patch by David Ziman!

llvm-svn: 200239
2014-01-27 19:16:35 +00:00
Fariborz Jahanian 369a9c3b51 ObjectiveC. When introducing a new property declaration in
parimary class and in mrr mode, assume property's default
memory attribute (assign) and to prevent a bogus warning.
// rdar://15859862

llvm-svn: 200238
2014-01-27 19:14:49 +00:00
Reid Kleckner 9b8dcebbca intrin.h: include setjmp.h to get a jmp_buf definition
This fixes an error on our _setjmpex declaration for 64-bit code and
allows us to declare _setjmp for 32-bit code.

llvm-svn: 200237
2014-01-27 19:14:09 +00:00
David Blaikie f36d9bac47 Driver: support -fno-debug-types-section to override -fdebug-types-section
llvm-svn: 200236
2014-01-27 18:52:43 +00:00
Reid Kleckner 924eb2afdc Add 'static __inline__' to MSVC intrinsics with implementations
This avoids warnings visible with -Wsystem-headers.

llvm-svn: 200235
2014-01-27 18:48:02 +00:00
Artyom Skrobov 1c66c3a7f2 Cortex-M3 and Cortex-M4 should not enable hwdiv-arm
llvm-svn: 200233
2014-01-27 18:44:25 +00:00
Robert Lytton 1a2292614c XCore target exception handling
Implement __builtin_eh_return_data_regno()

llvm-svn: 200231
2014-01-27 17:56:25 +00:00
Dmitri Gribenko 6bf8f803f2 Comment parsing: don't crash while parsing \deprecated in a standalone comment
(comment without a decl).

I think this can not happen during normal compilation with -Wdocumentation,
only while using Clang APIs to parse comments outside of a source file.

Based on a patch by Olivier Goffart.

llvm-svn: 200230
2014-01-27 17:55:43 +00:00
Simon Atanasyan 26292ccc91 [Mips] Fix __mips macro definition.
llvm-svn: 200223
2014-01-27 13:59:11 +00:00
Simon Atanasyan 1a3665b676 [Mips] Change default CPU for MIPS 32/64 targets. Now they are mips32r2/mips64r2 respectively.
llvm-svn: 200222
2014-01-27 13:59:04 +00:00
Richard Smith 6a6a4bbdd4 PR17052 / DR1560 (+DR1550): In a conditional expression between a glvalue and a
throw-expression, the result is also a glvalue and isn't unnecessarily coerced
to a prvalue.

llvm-svn: 200189
2014-01-27 04:19:56 +00:00
Evan Cheng 31dd9a6cc1 Fix r195149. Triple should correctly reflect that target. If it contains ios,
e.g. thumbv7m-apple-ios3.0.0-eabi, then it should mean it's an iOS target. For
embedded targets, the OS should be unknown, e.g. thumbv7m-apple-unknown-macho.
Since Tim has recently fixed the triple, r195149 is no longer needed.
rdar://15911035

llvm-svn: 200164
2014-01-26 23:12:43 +00:00
Joerg Sonnenberger f19dc30518 Use canonical spelling of NetBSD
llvm-svn: 200157
2014-01-26 20:02:03 +00:00
Alp Toker 14c8aff1aa Fix -Wreturn-type build failure on ASTMatchers, plus an intended assert
llvm-svn: 200140
2014-01-26 08:12:32 +00:00
Alp Toker 9e6d27d037 Update docstrings following the param name change in r200132
llvm-svn: 200137
2014-01-26 06:41:58 +00:00
Alp Toker 29cb66ba2f Enforce safe usage of DiagnosticsEngine::getCustomDiagID()
Replace the last incorrect uses and templatize the function to require a
compile-time constant string preventing further misuse.

The diagnostic formatter expects well-formed input and has undefined behaviour
with arbitrary input or crafted user strings in source files. Accepting user
input would also have caused unbounded generation of new diagnostic IDs which
can be problematic in long-running sessions or language bindings.

This completes the work to fix several incorrect callers that passed user
input or raw messages to the diagnostics engine where a constant format string
was expected.

llvm-svn: 200132
2014-01-26 06:17:37 +00:00
Alp Toker 046cda538c Identify two more unsafe uses of getCustomDiagID()
llvm-svn: 200126
2014-01-26 05:08:49 +00:00
Alp Toker 42aa21222d ARCMigrate: Introduce proper diagnostics for TransformActions
This starts to switch ARCMT to use proper diagnostic messages. The old use was
based on incorrect example code from the documentation.

The logic of the previous report() functions has been retained to support any
external consumers that might be intercepting diagnostic messages through the
old interface.

Note that the change in test/Misc/warning-flags.c isn't a new warning without a
flag, rather one that was previously invisible to the test. Adding a flag might
be a good idea though.

llvm-svn: 200124
2014-01-26 05:07:32 +00:00
Alp Toker 2652153904 Remove flawed diagnostic mapping functions
These haven't been usable since the early return was accidentally removed some
years ago causing all cases to fall through to the !Enabled condition.

llvm-svn: 200123
2014-01-26 05:07:02 +00:00
Alp Toker 42a16a67f5 Rename getResultLoc() too
Follow up to r200082.

Spotted by Dmitri

llvm-svn: 200105
2014-01-25 23:51:36 +00:00
Richard Smith 72db563280 PR18530: Don't assert when performing error recovery after a missing 'template<>' on a variable template explicit specialization.
llvm-svn: 200099
2014-01-25 21:32:06 +00:00
Richard Smith f137f9317b PR18283: If a const variable of integral or enumeration type is
initialized from a constant expression in C++98, it can be used in
constant expressions, even if it was brace-initialized. Patch by
Rahul Jain!

llvm-svn: 200098
2014-01-25 20:50:08 +00:00
Alp Toker 1f307f49ef Remove obsolete ObjCMethodDecl arg_type iterator functions
These were set into deprecation in r199773.

llvm-svn: 200086
2014-01-25 17:32:04 +00:00
Alp Toker 314cc81b8c Rename getResultType() on function and method declarations to getReturnType()
A return type is the declared or deduced part of the function type specified in
the declaration.

A result type is the (potentially adjusted) type of the value of an expression
that calls the function.

Rule of thumb:

  * Declarations have return types and parameters.
  * Expressions have result types and arguments.

llvm-svn: 200082
2014-01-25 16:55:45 +00:00
Simon Atanasyan 68855fe3c9 [Mips] Add support for mips64el-linux-android triple.
llvm-svn: 200081
2014-01-25 16:04:08 +00:00
Alp Toker 48047f5d75 PlistSupport: Eliminate duplicated EmitLocation() and EmitRange() functions
llvm-svn: 200077
2014-01-25 14:38:41 +00:00
Alp Toker bdbcfbf160 PlistSupport: Unify ARCMigrate / StaticAnalyzer plist writers
Reduces the ARCMT migrator plist writer down to a single function,
arcmt::writeARCDiagsToPlist() which shares supporting functions with the
analyzer plist writer.

llvm-svn: 200075
2014-01-25 11:14:41 +00:00
Daniel Jasper ff974ab88a clang-format: Fix incorrect space removal.
Before:
  Deleted &operator=(const Deleted &)&= default;
  Deleted &operator=(const Deleted &)&&= delete;

After:
  Deleted &operator=(const Deleted &)& = default;
  Deleted &operator=(const Deleted &)&& = delete;

llvm-svn: 200073
2014-01-25 09:16:02 +00:00
Eric Christopher 58b404398e One more intrinsic.
llvm-svn: 200061
2014-01-25 01:38:30 +00:00
Richard Trieu 955231ddf6 Broaden -Wstring-conversion to catch string literals in logical or expressions.
Previously, string literals were ignored in all logical expressions.  This
reduces it to only ignore in logical and expressions.

assert(0 && "error"); // No warning
assert(0 || "error"); // Warn

Fixes PR17565

llvm-svn: 200056
2014-01-25 01:10:35 +00:00
Richard Smith 4b5a949834 Allow virt-specifiers after GNU attributes in member-declarators. GCC doesn't
allow this, and we should warn on it, but it turns out that people were already
relying on this.

We should introduce a -Wgcc-compat warning for this if the attributes are known
to GCC, but we don't currently track enough information about attributes to do
so reliably.

llvm-svn: 200045
2014-01-24 22:34:35 +00:00
Aaron Ballman 81cb8cbfa6 Adds a getSemanticSpelling function to semantic attribute subclasses which have a meaningful semantic spelling. Adds a sibling function to parsed attribtues (via AttributeList) for getting the semantic spelling, if one were to exist. This can be used for cleaner code that deals directly with the semantic spellings (such as the MSInheritance attribute).
llvm-svn: 200041
2014-01-24 21:32:49 +00:00
Yunzhong Gao 063763ea42 Fixing PR18510 by checking whether the non-virtual base of the derived class
might have a smaller size as compared to the stand-alone type of the base class.
This is possible when the derived class is packed and hence might have smaller
alignment requirement than the base class.

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

llvm-svn: 200031
2014-01-24 19:28:24 +00:00
Ismail Pazarbasi df1a280526 Added missing StandardConversionSequence initialization
This is the second msan failure where UserDefinedConversion does not initialize
its `Before` member as identity conversion.

llvm-svn: 199997
2014-01-24 13:16:17 +00:00
Eric Christopher 439137ea32 Add missing intrinsics, fix a couple of typos in intrinsic names,
and remove duplicate declarations.

llvm-svn: 199992
2014-01-24 12:13:47 +00:00
Artyom Skrobov 9f2134402c Combine the checks for returns_nonnull and for operator new returning null, in Sema::CheckReturnValExpr. Add the missing handling of value-dependent expressions for returns_nonnull.
llvm-svn: 199989
2014-01-24 11:10:39 +00:00
Ismail Pazarbasi 99afd96703 Initialize StandardConversionSequence correctly
MSAN detected a path that leaves DeprecatedStringLiteralToCharPtr uninitialized.
UserDefinedConversionSequence::First is a StandardConversionSequence that must
be initialized with setAsIdentityConversion.

llvm-svn: 199988
2014-01-24 10:54:12 +00:00
Manuel Klimek 421147ec65 Get rid of special parsing for return statements.
This was done when we were not able to parse lambdas to handle some
edge cases for block formatting different in return statements, but is
not necessary any more.

llvm-svn: 199982
2014-01-24 09:25:23 +00:00
Richard Smith 7ff2bcb814 PR18560: When switching to a new context, don't just save and restore an
override for the type of 'this', also clear it out (unless we're entering the
context of a lambda-expression, where it should be inherited).

llvm-svn: 199962
2014-01-24 01:54:52 +00:00
Hans Wennborg 74ca0c4105 Add implementations of __readfs{byte,word,dword,qword} to Intrin.h
Differential Revision: http://llvm-reviews.chandlerc.com/D2606

llvm-svn: 199958
2014-01-24 00:52:39 +00:00
Richard Smith 72553fc19b Factor out repeated parsing of a member-declarator when parsing a
member-declaration. In the process, fix a couple of bugs that had crept in
where we would parse the first and subsequent member-declarators differently
(in particular, we didn't accept an asm-label on a member function definition
within a class, and we would accept virt-specifiers and attributes in the wrong
order on the first declarator but not on subsequent ones).

llvm-svn: 199957
2014-01-23 23:53:27 +00:00
Peter Collingbourne 50b75dbf1a Fix debug build.
llvm-svn: 199956
2014-01-23 23:15:58 +00:00
Peter Collingbourne d32e28c87a Introduce Registry::getCompletions.
This returns a list of valid (and useful) completions for a context (a list
of outer matchers), ordered by decreasing relevance then alphabetically. It
will be used by the matcher parser to implement completion.

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

llvm-svn: 199950
2014-01-23 22:48:38 +00:00
Hans Wennborg 2ed8880346 Intrin.h: fix definitions of _Interlocked{In,De}crement16
The declarations seem correct, but the definitions were using
chars instead of shorts.

llvm-svn: 199923
2014-01-23 19:15:39 +00:00
Pekka Jaaskelainen b3cdee01e9 Allow clang to compile the "extern" storage class in OpenCL 1.2.
Patch from Fraser Cormack!

llvm-svn: 199906
2014-01-23 16:21:02 +00:00
Amara Emerson 04e2ecfda2 [AArch64] Add -mgeneral_regs_only option.
llvm-svn: 199904
2014-01-23 15:48:30 +00:00
Serge Pavlov 09f9924acf Fix to PR8880 (clang dies processing a for loop)
Due to statement expressions supported as GCC extension, it is possible
to put 'break' or 'continue' into a loop/switch statement but outside
its body, for example:

    for ( ; ({ if (first) { first = 0; continue; } 0; }); )

This code is rejected by GCC if compiled in C mode but is accepted in C++
code. GCC bug 44715 tracks this discrepancy. Clang used code generation
that differs from GCC in both modes: only statement of the third
expression of 'for' behaves as if it was inside loop body.

This change makes code generation more close to GCC, considering 'break'
or 'continue' statement in condition and increment expressions of a
loop as it was inside the loop body. It also adds error for the cases
when 'break'/'continue' appear outside loop due to this syntax. If
code generation differ from GCC, warning is issued.

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

llvm-svn: 199897
2014-01-23 15:05:00 +00:00
Tim Northover 5a68c4b287 MachO embedded: default to soft float without issuing warning
This is a simpler rule, broadly in line with previous Darwin (which chose
between "soft" and "softfp") but probably safer. In practice the only real
reason for "softfp" is ABI compatibility, not usually an issue on limited chips
like these, so anyone who wanted hard-float should already be saying so.

That's my story and I'm sticking to it.

rdar://problem/15887493

llvm-svn: 199896
2014-01-23 15:00:01 +00:00
Alexey Bataev cf7ae30135 Improve x86 android support, add x86_64 android target
llvm-svn: 199875
2014-01-23 09:08:32 +00:00
Jordan Rose ddf1966cc3 [analyzer] Tighten up sanity checks on Objective-C property getter synthesis.
If there are non-trivially-copyable types /other/ than C++ records, we
won't have a synthesized copy expression, but we can't just use a simple
load/return.

Also, add comments and shore up tests, making sure to test in both ARC
and non-ARC.

llvm-svn: 199869
2014-01-23 03:59:10 +00:00
Jordan Rose 6adadb9bc2 [analyzer] Future-proof MallocChecker CFG dumping.
Now we'll get a warning if we miss a case. Refinement of r199800.

llvm-svn: 199868
2014-01-23 03:59:01 +00:00
Kevin Qin ce1f0e85ba [AArch64 NEON] Fix a bug about vcles_f32 and vcled_f64.
As vcles_f32() and vcled_f64 are implemented by FCMGE, operands
should make a swap.

llvm-svn: 199866
2014-01-23 03:42:06 +00:00
Justin Bogner be614c735c CodeGen: Fix tracking of PGO counters for the logical or operator
This adds tests for both logical or and for logical and, which was
already correct.

llvm-svn: 199865
2014-01-23 02:54:30 +00:00
Justin Bogner 81c22c2fae CodeGen: Handle PGO counters for constructors and destructors
llvm-svn: 199864
2014-01-23 02:54:27 +00:00
Ben Langmuir 9eb229bfe5 Require a module.map file to load a module
Removes some old code that allowed a module to be loaded from a pcm file
even if the module.map could not be found.  Also update a number of
tests that relied on the old behavior.

llvm-svn: 199852
2014-01-22 23:19:39 +00:00
Richard Smith 8c7bd6ac1a Don't forget about a builtin if we're about to redeclare it and we couldn't
create an implicit declaration of it (because some type it depends on is
unavailable). This had the effect of causing us to not implicitly give it the
right attributes. It turns out that glibc's __sigsetjmp is declared before
sigjmp_buf is declared, and this resulted in us not implicitly giving it
__attribute__((returns_twice)), which in turn resulted in miscompiles in any C
code calling glibc's sigsetjmp.

(See also the vaguely-related sourceware.org/PR4662.)

llvm-svn: 199850
2014-01-22 23:07:19 +00:00
Mark Seaborn 74020868ee Handle va_arg on struct types for the le32 target (PNaCl and Emscripten)
PNaCl and Emscripten can both handle va_arg IR instructions with
struct type.

Also add a test to cover generating a va_arg IR instruction from
va_arg in C on le32 (as already handled by VisitVAArgExpr() in
CGExprScalar.cpp), which was not covered by a test before.

(This fixes https://code.google.com/p/nativeclient/issues/detail?id=2381)

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

llvm-svn: 199830
2014-01-22 20:11:01 +00:00
Richard Smith 566184ac75 When a special member is explicitly defaulted outside its class, and we reject
the defaulting because it would delete the member, produce additional notes
explaining why the member is implicitly deleted.

llvm-svn: 199829
2014-01-22 20:09:10 +00:00
David Blaikie ec59e75ef2 Driver: Suppression support for -Wa,--compress-debug-sections
(to go with existing suppression of -Wa,-compress-debug-sections)

llvm-svn: 199822
2014-01-22 19:22:21 +00:00
Fariborz Jahanian dad9630398 ObjectiveC. When issuing property implementation is
not using backing ivar warning, ignore when
property is not being synthesized (user declared its
implementation @dynamic). // rdar://1583425

llvm-svn: 199820
2014-01-22 19:02:20 +00:00
Weiming Zhao fb5c21a70b PR18465: [Thumbv8] add predefined macros
currently, for thumbv8, two predefined macros are missing:
 define __THUMB_INTERWORK__ 1
 define __THUMB_INTERWORK__ 1

This patch adds them for thumbv8.

llvm-svn: 199819
2014-01-22 18:42:13 +00:00
Daniel Jasper 6b70ec0d46 clang-format: Fix incorrect lambda recognition.
Before:
  std::unique_ptr<int[]> foo() {}

After:
  std::unique_ptr<int []> foo() {}

Also, the formatting could go severely wrong after such a function
before.

llvm-svn: 199817
2014-01-22 17:01:47 +00:00
Anton Yartsev fee669054f [analyzer] The patch prevents the analyzer from crashing during CFG dump.
llvm-svn: 199800
2014-01-22 13:19:48 +00:00
Daniel Jasper 215d6c8c50 clang-format: Treat "." in protos like namespace separators.
Before:
  optional really.really.long.and.qualified.type.aaaaaaa
      .aaaaaaaa another_fiiiiiiiiiiiiiiiiiiiiield = 2;

After:
  optional
     really.really.long.and.qualified.type.aaaaaaa.aaaaaaaa
          another_fiiiiiiiiiiiiiiiiiiiiield = 2;

llvm-svn: 199796
2014-01-22 08:04:52 +00:00
Alp Toker 2bd4a28664 Change a dyn_cast from r199794 to a straight cast
It's guaranteed to be a CXXMethodDecl.

llvm-svn: 199795
2014-01-22 07:53:08 +00:00
Alp Toker a2794f9f36 Introduce and use Decl::getAsFunction() to simplify templated function checks
Lift the getFunctionDecl() utility out of the parser into a general
Decl::getAsFunction() and use it to simplify other parts of the implementation.

Reduce isFunctionOrFunctionTemplate() to a simple type check that works the
same was as the other is* functions and move unwrapping of shadowed decls to
callers so it doesn't get run twice.

Shuffle around canSkipFunctionBody() to reduce virtual dispatch on ASTConsumer.
There's no need to query when we already know the body can't be skipped.

llvm-svn: 199794
2014-01-22 07:29:52 +00:00
Ted Kremenek ef9e7f8059 Add basic checking for returning null from functions/methods marked 'returns_nonnull'.
This involved making CheckReturnStackAddr into a static function, which
is now called by a top-level return value checking routine called
CheckReturnValExpr.

llvm-svn: 199790
2014-01-22 06:10:28 +00:00
Richard Smith b63b6ee9a0 Enforce restrictions that 'main' is not allowed to be deleted, or to be used by
the program, in C++. (We allow the latter as an extension, since we've always
permitted it, and GCC does the same, and our supported C++ ABIs don't do
anything special in main.)

llvm-svn: 199782
2014-01-22 01:43:19 +00:00
Richard Smith c278c00613 Build an appropriate (albeit trivial) TypeSourceInfo for a destructor name, so
AST consumers can determine where the destructor name was written. Patch by
Olivier Goffart!

llvm-svn: 199779
2014-01-22 00:30:17 +00:00
Richard Smith e81daee21b When formatting a C++-only declaration name, enable C++ mode in the formatter's
language options. This is not really ideal -- we should require the right
language options to be passed in, or not require language options to format a
name -- but it fixes a number of *obviously* wrong formattings. Patch by
Olivier Goffart!

llvm-svn: 199778
2014-01-22 00:27:42 +00:00
Nico Rieck f8e8b5f5c2 Delay attribute checking until auto types are deduced
Checking in ActOnVariableDeclarator computes and caches the linkage using
the non-deduced auto type which defaults to external linkage. Depending on
how the auto type is deduced linkage can change and conflict with the
cached linkage, hitting asserts.

llvm-svn: 199774
2014-01-21 23:54:36 +00:00
Alp Toker 601b22c377 Correct various uses of 'argument' that in fact refer to function parameters
Cleanup only.

llvm-svn: 199773
2014-01-21 23:35:24 +00:00
Richard Smith 111d3485af Fix regression in r197623: only diagnose a by-copy capture of an incomplete
type if the capture is, actually, by copy.

llvm-svn: 199772
2014-01-21 23:27:46 +00:00
Chandler Carruth 902efc61be Teach Clang to look in its installation libdir for libraries (such as
libc++) when the installation is within the system root.

This doesn't really help cross compiles much, but we don't (currently)
have a great story around libc++, cross compiles, and who is responsible
for building and/or installing the libraries. However, it handles the
very common case of non-cross builds in a way entirely consistent with
GCC, so I'm hopeful this won't really hose anyone.

This is the second patch that I think should be backported to 3.4 to
give folks an easy to checkout and install working Clang+libc++
toolchain.

llvm-svn: 199769
2014-01-21 22:49:05 +00:00
David Majnemer b9a5f2d3b6 MSVC ABI: Support C++11's auto on variables
The MSVC C++ ABI always uses the deduced type in place of auto when
generating external names for variables.

N.B.  MSVC doesn't support C++1y's 'operator auto' and this patch will
not give us said functionality.

llvm-svn: 199764
2014-01-21 20:33:36 +00:00
Adrian Prantl 3eff225a44 Debug info: use the file a typedef is defined in as its decl_file instead
of the current compilation unit.
As a side effect this enables many more LTO uniquing opportunities.

This reapplies r199757 with a better testcase.

llvm-svn: 199760
2014-01-21 18:42:27 +00:00
Adrian Prantl cb6e1257ff revert 199757 for buildbot breakage.
llvm-svn: 199758
2014-01-21 18:23:43 +00:00
Adrian Prantl 83788519a5 Debug info: use the file a typedef is defined in as its decl_file instead
of the current compilation unit.
As a side effect this enables many more LTO uniquing opportunities.

rdar://problem/15851206

llvm-svn: 199757
2014-01-21 18:20:52 +00:00
Alp Toker 3e2aa33532 Fix -Wsometimes-uninitialized in r199754
Also make the -m16 check x86-specific. Other archs may have a different take on
things.

llvm-svn: 199755
2014-01-21 18:01:01 +00:00
David Woodhouse 6996f6b9ec Add -m16 option for using x86-*-*-code16 triple
llvm-svn: 199754
2014-01-21 17:19:44 +00:00
Tim Northover 1a9b904b76 Macho-embedded: rename compiler-rt support from Darwin-embedded
There's nothing Darwin-based in the files or target now, so the previous name
is now misleading.

llvm-svn: 199733
2014-01-21 12:38:19 +00:00
Daniel Jasper 7cfde414e1 clang-format: text following #if is likely an expression.
Before:
  #if AAAA &&BBBB

After:
  #if AAAA && BBBB

llvm-svn: 199713
2014-01-21 08:56:09 +00:00
Rafael Espindola e1bd71fea4 Use private linkage for utf-16 objc strings too.
llvm-svn: 199709
2014-01-21 02:57:56 +00:00
Rafael Espindola 6839d23be7 Now that r199688 avoids the real issue, use private linkage for objc strings.
llvm-svn: 199705
2014-01-21 01:50:12 +00:00
Nick Lewycky d950ae74a3 Simplify expression, made possible by r199702.
llvm-svn: 199703
2014-01-21 01:30:30 +00:00
Justin Bogner e25ffdf8a1 Revert "CodeGen: Simplify CodeGenFunction::EmitCaseStmt"
I misunderstood the discussion on this. The complexity here is
justified by the malloc overhead it saves.

This reverts commit r199302.

llvm-svn: 199700
2014-01-21 00:35:11 +00:00
Alp Toker b3fd5cfa81 Update FunctionTypeLoc and related names to match r199686
llvm-svn: 199699
2014-01-21 00:32:38 +00:00
Bob Wilson 74b6cd15ed Stop linking with crt1.o etc. for the iOS simulator. <rdar://problem/11800973>
Recent versions of the iOS simulator no longer require linking with the
crt1.o, dylib1.o, or bundle1.o files. The relevant code is now included in
libSystem for the simulator.

llvm-svn: 199696
2014-01-21 00:17:10 +00:00
Rafael Espindola d19f80a0b4 Give explicit sections for string constants used in NSStrings.
Without them they can be merged with non unnamed_addr constants during LTO.
The resulting constant is not unnamed_addr and goes in a different section,
which causes ld64 to crash.

A testcase that would crash before:

* file1.mm:
void g(id notification) {
  [notification valueForKey:@"name"];
}

* file2.cpp:
extern const char js_name_str[] = "name";

* file3.cpp
extern bool JS_GetProperty(const char *name);
extern const char js_name_str[];
bool js_ReportUncaughtException() { JS_GetProperty(js_name_str); }

run

clang file1.mm  -o file1.o -c -w -emit-llvm
clang file2.cpp -o file2.o -c -w -emit-llvm
clang file3.cpp -o file3.o -c -w

ld -dylib -o XUL file1.o file2.o file3.o -undefined dynamic_lookup.

llvm-svn: 199688
2014-01-20 20:33:18 +00:00
Alp Toker 9cacbabd33 Rename FunctionProtoType accessors from 'arguments' to 'parameters'
Fix a perennial source of confusion in the clang type system: Declarations and
function prototypes have parameters to which arguments are supplied, so calling
these 'arguments' was a stretch even in C mode, let alone C++ where default
arguments, templates and overloading make the distinction important to get
right.

Readability win across the board, especially in the casting, ADL and
overloading implementations which make a lot more sense at a glance now.

Will keep an eye on the builders and update dependent projects shortly.

No functional change.

llvm-svn: 199686
2014-01-20 20:26:09 +00:00
Rafael Espindola 8ff1610f06 Simplify further.
Thanks to David Blaikie for the push.

llvm-svn: 199685
2014-01-20 20:13:11 +00:00
Fariborz Jahanian 15f60cb2ba ObjectiveC driver. reinstate -fno-objc-legacy-dispatch behavior
when the deployment target is 10.5. // rdar://15852259

llvm-svn: 199682
2014-01-20 19:32:33 +00:00
Aaron Ballman b9023ed0f6 Exposed a declarative way to specify that an attribute can be duplicated when merging attributes on a declaration. This replaces some hard-coded functionality from Sema.
llvm-svn: 199677
2014-01-20 18:07:09 +00:00
Aaron Ballman 9a99e0da5a Remove some hard-coded specialness for thread-safety attributes from the parser, and made it more declarative. If an attribute is allowed to appear on a function definition when late parsed, it can now use the FunctionDefinition attribute subject. It's treated as a FunctionDecl for most purposes, except it also gets exposed on the AttributeList so that it can be used while parsing.
llvm-svn: 199676
2014-01-20 17:18:35 +00:00
Daniel Jasper 929b1db276 clang-format: Properly format custom options in protocol buffer definitions.
Before:
  option(my_option) = "abc";

After:
  option (my_option) = "abc";

llvm-svn: 199672
2014-01-20 16:47:22 +00:00
Aaron Ballman 3f5f3e7949 Formatting cleanups; no functional changes.
llvm-svn: 199671
2014-01-20 16:15:55 +00:00
Aaron Ballman f28e49931a Fixing a typo (turned out to be harmless since the default priority values are the same between the two attributes).
llvm-svn: 199666
2014-01-20 15:22:57 +00:00
Rafael Espindola 63582d605e Remove virtual methods that were added in 2009 and still had 1 implementation.
llvm-svn: 199665
2014-01-20 15:19:43 +00:00
Aaron Ballman 05a63787a2 Since the diagnostics engine understands Attr objects, this code is no longer required -- we can just pass in the attribute directly.
llvm-svn: 199664
2014-01-20 15:06:09 +00:00
Aaron Ballman fc1951c505 Making some minor improvements to r199626.
llvm-svn: 199663
2014-01-20 14:19:44 +00:00
Daniel Jasper a55544a658 clang-format: Leave 2 empty lines in Google's JavaScript style.
As per the style guide, two lines are required between top-level
elements.

llvm-svn: 199660
2014-01-20 14:10:30 +00:00
Bradley Smith 0f28f0cfc1 [ARM] Add ACLE enum/wchar size predefines
llvm-svn: 199642
2014-01-20 10:52:00 +00:00
NAKAMURA Takumi bf6d1efbba [CMake] Apply ADDITIONAL_HEADERS introduced in r199639.
llvm-svn: 199640
2014-01-20 10:24:05 +00:00
Chandler Carruth 5a3d898758 Make the Linux support for finding libc++ somewhat less braindead.
Now instead of just looking in the system root for it, we also look
relative to the clang binary's directory. This should "just work" in
almost all cases. I've added test cases accordingly.

This is probably *very* worthwhile to backport to the 3.4 branch so that
folks can check it out, build it, and use that as their host compiler
going forward.

llvm-svn: 199632
2014-01-20 09:42:24 +00:00
Alp Toker c620cab8c4 PR18551: accepts invalid strong enum to bool when operator! is used
llvm-svn: 199627
2014-01-20 07:20:22 +00:00
Ted Kremenek dbf62e3eee Wire up basic parser/sema support for attribute 'returns_nonnull'.
This attribute is supported by GCC.  More generally it should
probably be a type attribute, but this behavior matches 'nonnull'.

This patch does not include warning logic for checking if a null
value is returned from a function annotated with this attribute.
That will come in subsequent patches.

llvm-svn: 199626
2014-01-20 05:50:47 +00:00
Ted Kremenek b5867121a7 These attributes are no longer "checker-specific."
llvm-svn: 199625
2014-01-20 05:50:41 +00:00
Alp Toker 73287bfe40 MSVC 2013 type trait support
Implement type trait primitives used in the latest edition of the Microsoft
standard C++ library type_traits header.

With this change we can parse much of the Visual Studio 2013 standard headers,
particularly anything that includes <type_traits>.

Fully implemented, available in all language modes:

 * __is_constructible()
 * __is_nothrow_constructible()
 * __is_nothrow_assignable()

Partially implemented, semantic analysis WIP, available as MS extensions:

 * __is_destructible()
 * __is_nothrow_destructible()

llvm-svn: 199619
2014-01-20 00:24:09 +00:00
Alp Toker b4bca41491 Fix nothrow trait with multiple default constructors
Check all default ctors, not just the first one we see. This brings
__has_nothrow_constructor() in line with the other unary type traits.

A C++ class can have multiple default constructors but clang was only checking
the first one written, presumably due to ambiguity in the GNU specification.

MSVC has the same bug, while g++ has the correct implementation which we now
match.

llvm-svn: 199618
2014-01-20 00:23:47 +00:00
Richard Smith f600441a04 PR18544: don't assert that 'operator new' is not declared inside a namespace;
such an assert will fail in invalid code that does so!

llvm-svn: 199617
2014-01-19 23:25:37 +00:00
NAKAMURA Takumi c28a9a2c33 [CMake] Deprecate CLANG_RUNTIME_OUTPUT_INTDIR and CLANG_LIBRARY_OUTPUT_INTDIR.
LLVM_*_OUTPUT_INTDIR should be available everywhere. It was my mistake when I introduced INTDIR stuff.

llvm-svn: 199597
2014-01-19 13:00:01 +00:00
Daniel Jasper 7052ce6d8b clang-format: Better support and testing for protocol buffers.
With this patch, there is dedicated testing for protocol buffers
(https://developers.google.com/protocol-buffers/).

Also some minor tweaks formatting tweaks.

llvm-svn: 199580
2014-01-19 09:04:08 +00:00
Daniel Jasper 31745731e8 clang-format: Fix ObjC block as first call parameter formatting.
Before:
  foo (^{ bar(); });
After:
  foo(^{ bar(); });

llvm-svn: 199573
2014-01-19 07:46:32 +00:00
Ted Kremenek 256bd96d1c Harden InitListExpr::isStringLiteralInit() against getInit() returning null.
This led to a crash on invalid code (sorry, no good test case).

Fixes <rdar://problem/15831804>.

llvm-svn: 199571
2014-01-19 06:31:34 +00:00
David Blaikie d74be70aba Driver support for -fdebug-types-sections
Using backend-option like a few other debug codegen flags. I believe
Eric Christopher's working at porting those over to something nicer
such as an API level CodeGenOptions or the like, so this can be
improved along with that work.

llvm-svn: 199535
2014-01-18 02:02:06 +00:00
Reid Kleckner 661f35b0c5 Refactor ABI argument lowering a little
Currently it tracks the number of free registers, but soon it will track
stack offsets for inalloca lowering.

No functional change.

llvm-svn: 199532
2014-01-18 01:12:41 +00:00
Alp Toker 0abb057715 Restrict redeclaration of tags introduced by using decls to MSVCCompat
This limits the facility added in r199490 while we seek clarification on the
standard.

llvm-svn: 199531
2014-01-18 00:59:32 +00:00
Joerg Sonnenberger d769a1ed62 Use switch statements in preparation for adding more architectures.
llvm-svn: 199529
2014-01-18 00:50:49 +00:00
Richard Smith 59d26d2e67 PR12788: Remove unnecessary and incorrect special case for indirect fields.
This caused us to skip a step that was essential for correct access control.

llvm-svn: 199522
2014-01-17 22:29:43 +00:00
Ismail Pazarbasi 1121de36c2 Fix string-literal to char* conversion in overload resolution for C++11
String literal to char* conversion is deprecated in C++03, and is removed in
C++11. We still accept this conversion in C++11 mode as an extension, if we find
it in the best viable function.

llvm-svn: 199513
2014-01-17 21:08:52 +00:00
Richard Smith 990a692f4a Don't allow 'this' within typedefs within classes that otherwise look like they
might be member function declarations. Patch by Harald van Dijk!

llvm-svn: 199512
2014-01-17 21:01:18 +00:00
Daniel Jasper 47ef6ddece clang-format: Don't break lines starting with "import <string-literal>"
The author might be missing the "#" or these might be protocol buffer
definitions. Either way, we should not break the line or the string.

There don't seem to be other valid use cases.

llvm-svn: 199501
2014-01-17 16:21:39 +00:00
Ted Kremenek 115c3f7a36 [analyzer] Fix incorrect spelling of 'pthread_rwlock_trywrlock'. Patch by Jean Baptiste Noblot.
llvm-svn: 199499
2014-01-17 16:06:43 +00:00
Alp Toker 320374c4b1 Permit redeclaration of tags introduced by using decls
This valid construct appears in MSVC headers where it's used to provide a
definition for the '::type_info' compiler builtin type.

llvm-svn: 199490
2014-01-17 12:57:21 +00:00
David Majnemer 440e82ec04 Fix a build-bot breakage for clang-modernize when run with the MSVC ABI
llvm-svn: 199486
2014-01-17 10:54:42 +00:00
David Majnemer 1cdd96d6ad Revert "Revert r199416, "MS ABI: Improve selection of an inheritance model""
This reverts commit r199475 (which reverted r199416) with fixes for the
breakages.

We wouldn't lock an inheritance model if we saw a pointer-to-member
formed as a result of the address-of operator.

llvm-svn: 199482
2014-01-17 09:01:00 +00:00
NAKAMURA Takumi 5c486cf3f3 Revert r199416, "MS ABI: Improve selection of an inheritance model"
It broke tests for targeting x86_64-pc-win32:

    Clang Tools :: clang-modernize/LoopConvert/array.cpp
    Clang :: CodeGenCXX/2010-05-10-Var-DbgInfo.cpp
    Clang :: CodeGenCXX/member-call-parens.cpp
    Clang :: CodeGenCXX/ptr-to-datamember.cpp
    Clang :: SemaTemplate/instantiate-function-1.cpp

llvm-svn: 199475
2014-01-17 07:33:47 +00:00
Ted Kremenek f0ae7d0201 [analyzer] Teach NonNullParamChecker about 'nonnull' attributes on parameters.
llvm-svn: 199473
2014-01-17 07:15:35 +00:00
Ted Kremenek 2ff160046b Change CallEvent to use ArrayRef<> interface to get formal parameters of callee.
llvm-svn: 199472
2014-01-17 07:15:31 +00:00
Ted Kremenek 9aedc159ef Enhance attribute 'nonnull' to be applicable to parameters directly (infix).
This allows the following syntax:

  void baz(__attribute__((nonnull)) const char *str);

instead of:

  void baz(const char *str) __attribute__((nonnull(1)));

This also extends to Objective-C methods.

The checking logic in Sema is not as clean as I would like.  Effectively
now we need to check both the FunctionDecl/ObjCMethodDecl and the parameters,
so the point of truth is spread in two places, but the logic isn't that
cumbersome.

Implements <rdar://problem/14691443>.

llvm-svn: 199467
2014-01-17 06:24:56 +00:00
Ted Kremenek a146db3987 Push NonNullAttr inspection loop into CheckNonNullArguments.
No functionality change.

llvm-svn: 199465
2014-01-17 06:24:47 +00:00
Ted Kremenek 2bc7333a06 Make 'CheckNonNullArguments' a static function. No functionality change.
llvm-svn: 199464
2014-01-17 06:24:43 +00:00
David Blaikie 372d950a24 Driver: Stub -Wa,-compress-debug-sections support for integrated-as with a suppressable warning
llvm-svn: 199454
2014-01-17 03:17:40 +00:00
Richard Smith 741081708e PR18477: Create a function scope representing the constructor call when
handling C++11 default initializers. Without this, other parts of Sema (such as
lambda capture) would think the default initializer is part of the surrounding
function scope.

llvm-svn: 199453
2014-01-17 03:11:34 +00:00
Richard Smith 2c6b449098 Issue a warning if a throwing operator new or operator new[] returns a null
pointer, since this invokes undefined behavior. Based on a patch by Artyom
Skrobov! Handling of dependent exception specifications and some additional
testcases by me.

llvm-svn: 199452
2014-01-17 02:09:33 +00:00
Alp Toker e9d2bfc7e9 Split out -verify into two distinct option flags
Instead of dual-purposing a single flag, rename the driver option to
--verify-debug-info.

The frontend -verify option that enables diagnostic verification remains
unchanged except that it's now a pure CC1Option.

Both have been given proper help text.

llvm-svn: 199451
2014-01-17 02:06:23 +00:00
Ben Langmuir e82630d5d5 Improve the error message when a PCH dependency is modified
Show the top-level pch file as the culprit, rather than the immediate
dependency when a pch file imports a pcm from a module. To clarify the
relationship, the pch import stack is printed as notes. The old behaviour was
misleading when a pch imported a pcm (from a module), since removing the pcm
would not fix the problem, whereas rebuilding the pch would.

llvm-svn: 199446
2014-01-17 00:19:09 +00:00
Adrian Prantl d1b151ed7c Debug info: Refactor NoLocation and ArtificialLocation to use a common base
class and use it pervasively to restore debug locations.
Fixes an interaction between cleanup and EH that caused the location
to not be restored properly after emitting a landing pad.
rdar://problem/15208190

llvm-svn: 199444
2014-01-17 00:15:10 +00:00
Hans Wennborg 854f7d34ec Add implementations of _cpuid and _xgetbv to Intrin.h
The _cpuid() implementation is the same as in lib/Headers/cpuid.h
with the parameter names adjusted to match the interface.

_xgetbv just does what the Intel manual says.

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

llvm-svn: 199439
2014-01-16 23:39:35 +00:00
Richard Smith beef3453cd Clean up variable template handling a bit, and correct the behavior of name
lookup when declaring a variable template specialization.

llvm-svn: 199438
2014-01-16 23:39:20 +00:00
DeLesley Hutchins 80a38428e5 Consumed analysis: bugfix for operator calls. Also fixes some formatting
issues, a few testcases, and kills fish.

llvm-svn: 199436
2014-01-16 23:07:16 +00:00
Bob Wilson c6753a025e Remove an unnecessary special case to check for a few Darwin-specific options.
Using -mmacosx-version-min (etc.) on non-Darwin platforms should be a warning,
not a hard error. There is no reason to add a special check for these options
in the default toolchain. This just removes the special check and then we get
the usual -Wunused-command-line-argument warning if someone tries to use one
of these options for a target where they are not supported.
<rdar://problem/15569346>

llvm-svn: 199431
2014-01-16 21:50:37 +00:00
David Majnemer 37054dd4e7 MS ABI: Improve selection of an inheritance model
The MSVC ABI is rather finicky about the exact representation of it's
pointer-to-member representation.  The exact position of when and where
it will go with one representation versus another appears to be when it
desires the pointer-to-member to be complete.

To properly implement this in clang, do several things:
- Give up on tracking the polymorphic nature of the class.  It isn't
  useful to Sema and is only pertinent when choosing CodeGen-time
  details like whether the field-offset can be 0 instead of -1.
- Insist on locking-in the inheritance model when we ask our
  pointer-to-member type to be complete.  From there, grab the
  underlying CXXRecordDecl and try to make *that* complete.  Once we've
  done this, we can calculate it's inheritance model and apply it using
  an attribute.

N.B. My first bullet point is a lie.  We will eventually care about the
specifics of whether or not a CXXRecordDecl is or is not polymorphic
because MSVC compatible mangling of such things depends on it.  However,
I believe we will handle this in a rather different way.

llvm-svn: 199416
2014-01-16 20:05:57 +00:00
Daniel Jasper a225bcedb4 clang-format: Improve formatting of ObjC Blocks with return type.
Before:
  int a = [operation block:^int(int * i) { return 1; }];

After:
  int a = [operation block:^int(int *i) { return 1; }];

llvm-svn: 199411
2014-01-16 19:14:34 +00:00
Jordan Rose 2be02a7848 [analyzer] Shitfing a constant value by its bit width is undefined.
Citation: C++11 [expr.shift]p1 (and the equivalent text in C11).

This fixes PR18073, but the right thing to do (as noted in the FIXME) is to
have a real checker for too-large shifts.

llvm-svn: 199405
2014-01-16 18:02:23 +00:00
Jakob Stoklund Olesen 497332c05f SPARCv9 implements long double as an IEEE quad.
llvm-svn: 199399
2014-01-16 16:43:19 +00:00
Aaron Ballman 12b9f6535b Factored some function-like type reasoning out of SemaDeclAttr and onto Decl itself. This allows for more declarative subjects in attribute tablegen where the attribute appertains to something function-like, but not strictly a FunctionDecl.
llvm-svn: 199387
2014-01-16 13:55:42 +00:00
Aaron Ballman 36a5350e51 Distinguish between attributes explicitly written at the request of the user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute.
Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it.

llvm-svn: 199378
2014-01-16 13:03:14 +00:00
David Majnemer f5b93794b7 Sema: Fix crash during member pointer conversion involving incomplete classes
We would attempt to determine the inheritance relationship between
classes 'A' and 'B' during static_cast if we tried to convert from 'int
A::*' to 'int B::*'.  However, the question "does A derive from B" is
not meaningful when 'A' isn't defined.

Handle this case by requiring that 'A' be defined.

This fixes PR18506.

llvm-svn: 199374
2014-01-16 12:02:55 +00:00
Evgeniy Stepanov d04b861e69 [asan] Remove -fsanitize-address-zero-base-shadow command line
flag from clang, and disable zero-base shadow support on all platforms
where it is not the default behavior.

- It is completely unused, as far as we know.
- It is ABI-incompatible with non-zero-base shadow, which means all
objects in a process must be built with the same setting. Failing to
do so results in a segmentation fault at runtime.
- It introduces a backward dependency of compiler-rt on user code,
which is uncommon and complicates testing.

This is the Clang part of a larger change.

llvm-svn: 199372
2014-01-16 10:19:31 +00:00
Daniel Jasper cb51cf409b clang-format: Enable formatting of lambdas with explicit return type.
So clang-format can now format:

  int c = []()->int { return 2; }();
  int c = []()->vector<int> { return { 2 }; }();

llvm-svn: 199368
2014-01-16 09:11:55 +00:00
Tim Northover 157d911b42 MachO: use *-*-*-macho for MachO embedded targets.
Previously we had bodged together some hacks mapping MachO embedded
targets (i.e. mainly ARM v6M and v7M) to the "*-*-darwin-eabi" triple.
This is incorrect in both details (they don't run Darwin and they're
not EABI in any real sense).

This commit appropriates the existing "MachO" environment for the
purpose instead.

llvm-svn: 199367
2014-01-16 08:48:16 +00:00
Bob Wilson b767d15d1e Remove support for armv7f slice. <rdar://problem/12478440>
This was never used for anything so we should just get rid of it.

llvm-svn: 199336
2014-01-15 21:43:40 +00:00
Jan Wen Voung 1f9c4ee464 Ensure i686-nacl long long is aligned 8 bytes (like malign-double)
Set NaCl OSTargetInfo to have LongLongAlign = 64. Otherwise, it will
pick up the setting of 32 from X86_32TargetInfo.

llvm-svn: 199335
2014-01-15 21:42:41 +00:00
Roman Divacky dd9bfb2c1a Make -fno-inline attach NoInline attribute to all functions that are not
marked as AlwaysInline or ForceInline.

This moves us to what gcc does with -fno-inline. The attribute approach
was discussed to be better than switching to InlineAlways inliner in presence
of LTO.

llvm-svn: 199324
2014-01-15 19:07:16 +00:00
Jordan Rose 2a833ca575 [analyzer] BlockCall shouldn't really be an AnyFunctionCall.
Per discussion with Anna a /long/ time ago, it was way too easy to misuse
BlockCall: because it inherited from AnyFunctionCall (through SimpleCall),
getDecl() was constrained to return a FunctionDecl, and you had to call
getBlockDecl() instead. This goes against the whole point of CallEvent
(to abstract over different ways to invoke bodies of code).

Now, BlockCall just inherits directly from CallEvent. There's a bit of
duplication in getting things out of the origin expression (which is still
known to be a CallExpr), but nothing significant.

llvm-svn: 199321
2014-01-15 17:25:15 +00:00
Jordan Rose e02e96a69f [analyzer] Print function name when dumping its CFG.
This allows us to use CHECK-LABEL to ensure that we're checking the right CFG.

Debugging change only.

llvm-svn: 199320
2014-01-15 17:25:05 +00:00
Daniel Jasper b2e10a5459 clang-format: Fixed formatting of JavaScript container literals
Before:
  var arr = [ 1, 2, 3 ];
  var obj = {a : 1, b : 2, c : 3};

After:
  var arr = [1, 2, 3];
  var obj = {a: 1, b: 2, c: 3};

llvm-svn: 199317
2014-01-15 15:09:08 +00:00
Erik Verbruggen 888d52a655 Fix for PR9812: warn about bool instead of _Bool.
llvm-svn: 199311
2014-01-15 09:15:43 +00:00
Justin Bogner 4c5c99f91a CodeGen: Simplify CodeGenFunction::EmitCaseStmt
Way back in r129652 we tried to avoid emitting an empty block at -O0
for switch cases that did nothing but break. This led to a poor
debugging experience as reported in PR9796, so we disabled the
optimization for -O0 but left it in for higher optimization levels in
r154420.

Since the whole point of this was to improve -O0, it's silly to keep
the complexity at all.

llvm-svn: 199302
2014-01-15 07:30:30 +00:00
Alp Toker a8bb9c97c6 Fix cxx_variable_templates feature check and documentation
This C++ feature has been marked complete since r191549, but the documentation
claimed it wasn't supported at all and the extension check misreported it as
being available in C.

No regression test; this was a short-lived typo.

llvm-svn: 199292
2014-01-15 04:11:24 +00:00
Serge Pavlov b620b9d0db Fixed error recovery if sizeof is used without parenthesis
Changes made in r192200 fixed PR16992, which requested fixit suggesting
parenthesis if sizeof is followed by type-id. However expression in form
T() followed by ')' was incorrectly considered as a type-id if 'T' is
typedef name. This change fixes this case.

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

llvm-svn: 199284
2014-01-15 01:53:39 +00:00
Ted Kremenek 0f83390540 Teach DeadStoresChecker about attribute objc_precise_lifetime.
llvm-svn: 199277
2014-01-15 00:59:23 +00:00
Fariborz Jahanian 39c17a8f30 Improve comment.
llvm-svn: 199258
2014-01-14 22:01:08 +00:00
Fariborz Jahanian 0f6eabdd05 ObjectiveC. add comment.
llvm-svn: 199257
2014-01-14 21:33:54 +00:00
Hans Wennborg c9bd88e681 Remove the -cxx-abi command-line flag.
This makes the C++ ABI depend entirely on the target: MS ABI for -win32 triples,
Itanium otherwise. It's no longer possible to do weird combinations.

To be able to run a test with a specific ABI without constraining it to a
specific triple, new substitutions are added to lit: %itanium_abi_triple and
%ms_abi_triple can be used to get the current target triple adjusted to the
desired ABI. For example, if the test suite is running with the i686-pc-win32
target, %itanium_abi_triple will expand to i686-pc-mingw32.

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

llvm-svn: 199250
2014-01-14 19:35:09 +00:00
Reid Kleckner 3a4c638900 Remove unused function to fix clang -Werror build
llvm-svn: 199230
2014-01-14 18:10:42 +00:00
Aaron Ballman 2689133805 Simplifying the OpenCL image attribute. It does not need a semantic integer parameter because the required information is encoded in the spelling. Added an appropriate subject to the attribute, and simplified the semantic checking (which will likely be expanded upon in a future patch). Also, removed the GNU spelling since it was unsupported in the first place.
llvm-svn: 199229
2014-01-14 17:41:53 +00:00
Jordan Rose 6f5f719806 CFG: use Visit instead of VisitStmt to look through parens.
PR18472

llvm-svn: 199227
2014-01-14 17:29:12 +00:00
Jordan Rose a3f2781259 [analyzer] Use synthesized ASTs for property getters when available.
This allows the analyzer to handle properties with C++ class type,
finishing up the FIXME from r198953.

llvm-svn: 199226
2014-01-14 17:29:06 +00:00
Jordan Rose 31c05a117a Use a proper lvalue-to-rvalue conversion in Objective-C++ property accessors.
Previously, the synthesized AST contained an rvalue DeclRefExpr for 'self'.
Now, it has an lvalue DeclRefExpr wrapped in an lvalue-to-rvalue
ImplicitCastExpr, which is what's generated when an ivar access is written
in the source.

No (intended) functionality change.

llvm-svn: 199225
2014-01-14 17:29:00 +00:00
Nico Rieck bb0554f959 Update CodeGen to use DLL storage class for dllimport/dllexport
With the old linkage types removed, set the linkage to external for both
dllimport and dllexport to reflect what's currently supported.

llvm-svn: 199220
2014-01-14 15:23:53 +00:00
Alp Toker fd8c079dac Switch around the order of MSVCCompat and MicrosoftExt
Full language modes usually get listed before minor language extensions in
LangOpts, so that subsequent sub-modes can predicate on the major modes.

This also lends to a cleanup in CompilerInvocation to better indicate to the
reader that MSVCCompat is a superset of MicrosoftExt.

Cleanup only.

llvm-svn: 199210
2014-01-14 12:53:58 +00:00
Alp Toker bfa3934f27 Rename language option MicrosoftMode to MSVCCompat
There's been long-standing confusion over the role of these two options. This
commit makes the necessary changes to differentiate them clearly, following up
from r198936.

MicrosoftExt (aka. fms-extensions):
 Enable largely unobjectionable Microsoft language extensions to ease
 portability. This mode, also supported by gcc, is used for building software
 like FreeBSD and Linux kernel extensions that share code with Windows drivers.

MSVCCompat (aka. -fms-compatibility, formerly MicrosoftMode):
 Turn on a special mode supporting 'heinous' extensions for drop-in
 compatibility with the Microsoft Visual C++ product. Standards-compilant C and
 C++ code isn't guaranteed to work in this mode. Implies MicrosoftExt.

Note that full -fms-compatibility mode is currently enabled by default on the
Windows target, which may need tuning to serve as a reasonable default.

See cfe-commits for the full discourse, thread 'r198497 - Move MS predefined
type_info out of InitializePredefinedMacros'

No change in behaviour.

llvm-svn: 199209
2014-01-14 12:51:41 +00:00
Joey Gouly 8fc32f01dc [OpenCL] Disallow casts between address spaces.
llvm-svn: 199208
2014-01-14 12:47:29 +00:00
Sylvestre Ledru 096d6e44fd Remove trailing spaces
llvm-svn: 199199
2014-01-14 10:25:26 +00:00
Daniel Jasper d07c2ee99e clang-format: Fix bug introduced in r198871.
We cannot simply change the start column to accomodate for the @ in an
ObjC string literal as that will make clang-format happily violate the
column limit.

Use a different workaround instead. However, a better long-term
solution might be to join the @ and the rest of the literal into a
single token.

llvm-svn: 199198
2014-01-14 09:53:07 +00:00
David Majnemer 1de36917d3 Sema: Predefine size_t in MSVC Compatibility mode
MSVC defines size_t without any explicit declarations.  This change
allows us to be compatible with TUs that depend on this declaration
appearing from nowhere.

llvm-svn: 199190
2014-01-14 06:19:35 +00:00
Bob Wilson 5a4f3eab0a Remove a temporary workaround that is no longer relevant.
llvm-svn: 199176
2014-01-14 01:56:31 +00:00
Aaron Ballman 05d76eaa21 Removing some attribute magic related to the OpenCL keyword attributes. Instead of mapping them to their semantics as a custom part of the parser, they instead map declaratively through the rest of the attribute system.
llvm-svn: 199175
2014-01-14 01:29:54 +00:00
Warren Hunt 26b944274e [ms-abi] Small Change to pack+alignment interaction.
This patch makes a small behavioral change to the interaction between 
pack and alignment.  Specifically it makes __declspec(align()) on a 
field change that field's alignment without respect to pack but the 
alignment change to the record alignment as a whole still obeys pack.

llvm-svn: 199172
2014-01-14 00:54:36 +00:00
Reid Kleckner 5b1b5d5123 [ms-abi] Remove duplicated vbptr offset code
Record layout will tell us the offset of a shared vbptr inside a
non-virtual base.

No functionality change.

llvm-svn: 199171
2014-01-14 00:50:39 +00:00
DeLesley Hutchins f28bbec90e Consumed analysis: add two new attributes which fine-tune the behavior of
consumable objects.  These are useful for implementing error codes that
must be checked.  Patch also includes some significant refactoring, which was
necesary to implement the new behavior.

llvm-svn: 199169
2014-01-14 00:36:53 +00:00
Warren Hunt 6eba907102 [ms-abi] Report VBPtrOffset correctly
Although VBPtrs were being placed correctly by the ms-abi layout engine, 
their offsets were being improperly reported to the ASTRecordLayout 
builder due to a bug.  This patch fixes that and fixes the test cases to 
use the correct values.
y

llvm-svn: 199168
2014-01-14 00:31:30 +00:00
Reid Kleckner 340ad862d9 [ms-abi] Always generate complete constructors in the Microsoft C++ ABI
Fixes PR18435, where we generated a base ctor instead of a complete
ctor, and so failed to construct virtual bases when constructing the
complete object.

llvm-svn: 199160
2014-01-13 22:57:31 +00:00
Warren Hunt 4c73e59475 [ms-abi] Reordering __declspec(align) pragma pack handling
This patch moves the check for pragma pack until after the application 
of __declspec align to before pragma pack.  This causes observable 
changes in the use of tail padding for bases.  A test case is included.

llvm-svn: 199154
2014-01-13 22:25:55 +00:00
Hans Wennborg 859422a867 clang-cl: Ignore /fallback when not actually compiling (PR18456)
For example, don't fall back in /P (preprocess) mode.

llvm-svn: 199153
2014-01-13 22:24:42 +00:00
Aaron Ballman 09e98ffa5b When determining the attribute's parsed kind, pay attention to the syntax used. This fixes bugs where an attribute has differing GNU and Declspec spellings, but they are treated as the same. Eg) __declspec(aligned) when it should be __attribute__((aligned)), and __attribute__((align)) when it should be __declspec(align).
llvm-svn: 199144
2014-01-13 21:42:39 +00:00
Aaron Ballman 3fe6ed5aa0 __forceinline is a keyword, and not a GNU-style attribute. This FIXME appears to be out-dated, and the attribute syntax is becoming more important these days.
llvm-svn: 199143
2014-01-13 21:40:16 +00:00
Justin Bogner 3fac6498e1 CodeGen: Clarify a comment about PGO in case statement ranges
llvm-svn: 199140
2014-01-13 21:24:25 +00:00
Justin Bogner 0718a3a420 CodeGen: Rename adjustFallThroughCount -> adjustForControlFlow
adjustFallThroughCount isn't a good name, and the documentation was
even worse. This commit attempts to clarify what it's for and when to
use it.

llvm-svn: 199139
2014-01-13 21:24:22 +00:00
Justin Bogner 06bd6d04e0 CodeGen: Introduce CodeGenPGO::setCurrentRegionUnreachable
There are a number of places where we do PGO.setCurrentRegionCount(0)
directly after an unconditional branch. Give this operation a name so
that it's clearer why we're doing this.

llvm-svn: 199138
2014-01-13 21:24:18 +00:00
Justin Bogner 4afcd10e08 CodeGen: Remove a superfluous setCurrentRegionCount
This call looks like it was an artifact of an earlier change, and
doesn't actually make sense. We begin a new region immediately anyway,
so it was mostly harmless.

llvm-svn: 199137
2014-01-13 21:24:15 +00:00
Justin Bogner 2f6b404a14 CodeGen: Remove some unnecessary braces
llvm-svn: 199136
2014-01-13 21:24:13 +00:00
Warren Hunt badf9e0f84 [ms-abi] Leading VFPtrs don't suppress the leading zero sized flag
The MS-ABI tracks a bit that asserts that the first sub-object is zero 
sized.  This bit is used to add padding between objects if there's the 
potential for zero sized objects to alias.  The bit is still true even 
if the zero sized base is lead by a VFPtr.  This patch makes clang mimic 
that behavior.

llvm-svn: 199132
2014-01-13 19:55:52 +00:00
Hans Wennborg 50501fbe38 Use the MS ABI for Win32 targets by default
In addition to being a sensible default, this is a huge improvement
in test coverage for the MS ABI: any bot that targets Win32 will
now run the test suite using the MS ABI by default.

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

llvm-svn: 199131
2014-01-13 19:48:18 +00:00
Reid Kleckner 4f017ceeda [ms-abi] Quick fix layout of an array of records
This fixes llvm::SmallVector, which fixes lots of TUs in the MS ABI self
host.

llvm-svn: 199129
2014-01-13 19:25:00 +00:00