Commit Graph

34660 Commits

Author SHA1 Message Date
Richard Smith faf156ad15 Tests for DR370-380.
Also promote a couple of Warnings on ill-formed code found by this testing to
ExtWarns.

llvm-svn: 203021
2014-03-05 22:54:58 +00:00
Ted Kremenek 3cdbc39a6e [-Wunreachable-code] generalize configuration value checking to all comparison operators.
llvm-svn: 203016
2014-03-05 22:32:39 +00:00
Aaron Ballman 6c8100748f Capabilities are required to pass a name specifying what type of capability is being annotated. There are currently only two supported names: mutex and role. Adding functionality to check for the capability name and diagnose when it's unexpected.
Note that for backwards compatibility, an unnamed capability will default to being a "mutex." This allows the deprecated lockable attribute to continue to function.

llvm-svn: 203012
2014-03-05 21:47:13 +00:00
Ben Langmuir 9385323747 Attempt to re-enable the VFS unittests on Windows
Using a //net/ path to hopefully avoid problems with non-absolute paths
on Windows.

llvm-svn: 203010
2014-03-05 21:32:20 +00:00
Rafael Espindola 191b95125a Don't produce an alias between destructors with different calling conventions.
Fixes pr19007.

llvm-svn: 203007
2014-03-05 21:04:41 +00:00
Richard Smith 7bea1d42d8 When building a module from the command line via -emit-module, add an entry to
the module build stack for the module being built, so we can correctly detect
recursive module builds.

llvm-svn: 203006
2014-03-05 20:55:36 +00:00
Richard Smith 8c71eba19f If a #include finds a file relative to the current file, don't forget to check
whether it's part of a module.

llvm-svn: 203005
2014-03-05 20:51:45 +00:00
David Majnemer f27217ffaf AST: Remove layering violation with Sema
Scope lives in Sema and cannot be used in AST. Shuffle things around.

llvm-svn: 202993
2014-03-05 18:55:38 +00:00
Timur Iskhodzhanov 77764b6d4c Style fix: replace "1 entries" with "1 entry" in the vftable layout dumping code
llvm-svn: 202978
2014-03-05 13:54:07 +00:00
Benjamin Kramer 65f0a4a1af Revert "[C++11] Replace trivial lambda with std::cref."
MSVC2013's standard library is too broken to understand this pattern.

llvm-svn: 202971
2014-03-05 13:25:00 +00:00
Benjamin Kramer fcef811822 [C++11] Replace trivial lambda with std::cref.
llvm-svn: 202968
2014-03-05 11:38:18 +00:00
Alexander Kornienko cef10edcb2 Added a const qualifier to SourceManager& parameters.
llvm-svn: 202964
2014-03-05 10:38:27 +00:00
David Majnemer f017ec360c MS ABI: Mangle lambdas
Use a scheme inspired by the Itanium ABI to properly implement the
mangling of lambdas.

N.B.  The incredibly astute observer will notice that we do not generate
external names that are identical, or even compatible with, MSVC.
This is fine because they don't generate names that they can use across
translation units.  Technically, we can generate any name we'd like so
long as that name wouldn't conflict with any other and would be stable
across translation units.

This fixes PR15512.

llvm-svn: 202962
2014-03-05 10:35:06 +00:00
David Majnemer 2206bf5d5b [-cxx-abi microsoft] Implement local manglings accurately
Summary:
The MSVC ABI appears to mangle the lexical scope into the names of
statics.  Specifically, a counter is incremented whenever a scope is
entered where things can be declared in such a way that an ambiguity can
arise.  For example, a class scope inside of a class scope doesn't do
anything interesting because the nested class cannot collide with
another nested class.

There are problems with this scheme:
- It is unreliable. The counter is only incremented when a previously
  never encountered scope is entered.  There are cases where this will
  cause ambiguity amongst declarations that have the same name where one
  was introduced in a deep scope while the other was introduced right
  after in the previous lexical scope.
- It is wasteful.  Statements like: {{{{{{{ static int foo = a; }}}}}}}
  will make the mangling of "foo" larger than it need be because the
  scope counter has been incremented many times.

Because of these problems, and practical implementation concerns.  We
choose not to implement this scheme if the local static or local type
isn't visible.  The mangling of these declarations will look very
similar but the numbering will make far more sense, this scheme is
lifted from the Itanium ABI implementation.

Reviewers: rsmith, doug.gregor, rnk, eli.friedman, cdavis5x

Reviewed By: rnk

CC: cfe-commits

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

llvm-svn: 202951
2014-03-05 08:57:59 +00:00
Ted Kremenek 4b3c66e6e8 Adjust logic for 'objc_protocol_requires_explicit_implementation' for inherited protocols and protocols already conformed in the class hierarchy.
Per more discussion, 'objc_protocol_requires_explicit_implementation' is
refinement that it mainly adds that requirement that a protocol must be
explicitly satisfied at the moment the first class in the class hierarchy
conforms to it.  Any subclasses that also conform to that protocol,
either directly or via conforming to a protocol that inherits that protocol,
do not need to re-implement that protocol.

Doing this requires first doing a pass on the super class hierarchy,
gathering the set of protocols conformed to by the super classes,
and then culling those out when determining conformance.  This
two-pass algorithm could be generalized for all protocol checking,
and could possibly be a performance win in some cases.  For now
we restrict this change to protocols with this attribute to isolate
the change in logic (especially as the design continues to evolve).

This change needs to be adjusted for properties as well; this
only impacts methods right now.

llvm-svn: 202948
2014-03-05 08:13:08 +00:00
Alexey Bataev 18a3764b4f [OPENMP] emit error message for clause 'if(1 0)'
llvm-svn: 202942
2014-03-05 06:53:13 +00:00
Argyrios Kyrtzidis 0692508670 [AST] A "Class<P>" type should not have '*' when printed out.
rdar://14309030

llvm-svn: 202941
2014-03-05 06:47:57 +00:00
Alexey Bataev af7849e7c7 [OPNEMP] Fixed instantiation of 'if' clause
llvm-svn: 202940
2014-03-05 06:45:14 +00:00
Ted Kremenek 6d9bb56cd3 [-Wunreachable-code] Don't warn about dead code guarded by a "configuration value".
Some unreachable code is only "sometimes unreachable" because it
is guarded by a configuration value that is determined at compile
time and is always constant.  Sometimes those represent real bugs,
but often they do not.  This patch causes the reachability analysis
to cover such branches even if they are technically unreachable
in the CFG itself.  There are some conservative heuristics at
play here to determine a "configuration value"; these are intended
to be refined over time.

llvm-svn: 202912
2014-03-05 00:01:17 +00:00
David Majnemer 1e57976ec0 Headers: Provide an ABI compatible max_align_t when _MSC_VER is defined
Summary:
Our usual definition of max_align_t wouldn't match up with MSVC if it
was used in a template argument.

Reviewers: chandlerc, rsmith, rnk

Reviewed By: chandlerc

CC: cfe-commits

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

llvm-svn: 202911
2014-03-04 23:43:48 +00:00
David Blaikie 9afd5daea3 Remove some unnecessary qualification
llvm-svn: 202909
2014-03-04 23:39:18 +00:00
Fariborz Jahanian 7a5830294f Objective-C. Return 0 as class of methods in protocols.
This simplifies my last patch a bit. No change in
functionality.

llvm-svn: 202906
2014-03-04 22:57:32 +00:00
Ben Langmuir a6f8ca8c5f Support relative paths in VFSFromYAML
Use llvm::sys::fs::make_absolute to get an absolute path before
matching. Also, allow "." directories to enable testing.  ".." is still
not supported, and will require crossing file system boundaries to
implement correctly.

llvm-svn: 202903
2014-03-04 22:34:50 +00:00
David Blaikie 0856f66dd2 DebugInfo: Refix r202888 (a fix to r202769) in a different way, ensuring types aren't needlessly built during -gmlt
llvm-svn: 202900
2014-03-04 22:01:08 +00:00
Ted Kremenek 5a09527d0d [CFG] Tweak "?:" CFG construction to record the unreachable blocks.
llvm-svn: 202898
2014-03-04 21:53:26 +00:00
Richard Smith 841f1c782e [C++11] Simplify a callback to use a lambda.
llvm-svn: 202897
2014-03-04 21:50:01 +00:00
Ted Kremenek eb862849a1 [-Wunreachable-code] handle cases where a dead 'return' may have a valid predecessor.
Fies PR19040.

llvm-svn: 202892
2014-03-04 21:41:38 +00:00
Reid Kleckner e0b9201f5a Fix unconditional dereference of a WeakVH in CGDebugInfo TypeCache
This fails an "isa<> used with null pointer" assert during a clang-cl
self-host on Windows.  This was caused by r202769, and I'm currently
reducing a test case.

Reviewers: dblaikie

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

llvm-svn: 202888
2014-03-04 20:51:58 +00:00
Benjamin Kramer 9299637dc0 Pass llvm::Triple objects by const reference.
Copying isn't cheap as it contains a std::string.

llvm-svn: 202880
2014-03-04 19:31:42 +00:00
Simon Atanasyan 738f85a20e [Mips] Check all MIPS toolchains to find the one that best meets command
line arguments and directories tree. The old toolchain selection heuristics
worked incorrectly when user has a reduced MIPS toolchain supports
the O32 ABI only.

Patch reviewed by Jonathan Roelofs, David Majnemer.

llvm-svn: 202873
2014-03-04 18:37:28 +00:00
Fariborz Jahanian dafffbe2be Objective-C IRGen. Fix up the hueristics for determining
if an ivar offset load is invariant iff inside an instance method
and ivar belongs to instance method's class and one of its super class.
// rdar://16095748

llvm-svn: 202872
2014-03-04 18:34:52 +00:00
Roman Divacky b8322b13f8 The wmmintrin.h header includes two different sub-headers: one for AES support
and one for PCLMUL support.  The current immintrin.h header only includes
wmmintrin.h if AES support is enabled.  It should include it if either AES or
PCLMUL is enabled (GCC's version of immintrin.h does this).

Patch by John Baldwin!

llvm-svn: 202871
2014-03-04 18:26:12 +00:00
Timur Iskhodzhanov 3a9ac93478 First step towards fixing PR18967 - simplify the ComputeThisOffset interface
llvm-svn: 202870
2014-03-04 18:17:38 +00:00
Sean Callanan c94711c7e3 When deciding whether or not to resolve two
anonymous structs to the same Decl in the
ASTImporter, ensure that both are filled in
from their external sources (if present).
Otherwise two different structs may be 
identified erroneously.

llvm-svn: 202869
2014-03-04 18:11:50 +00:00
Chandler Carruth 735e6d8046 [Modules] Update to reflect the move of CFG.h to the IR library in LLVM
r202827.

llvm-svn: 202828
2014-03-04 11:46:22 +00:00
Chandler Carruth 61743af166 [Modules] Update to reflect ValueHandle moving to the IR library in LLVM
r202821.

llvm-svn: 202822
2014-03-04 11:18:19 +00:00
Chandler Carruth c80ceea90b [Modules] Update to reflect the move of CallSite into the IR library in
LLVM r202816.

llvm-svn: 202817
2014-03-04 11:02:08 +00:00
Chandler Carruth 757fcd6d1f [cleanup] Re-sort includes with llvm/utils/sort_includes.py and fix
a missing include from CLog.h.

CLog.h referenced most of the core libclang types but never directly
included Index.h that provides them. Previously it got lucky and other
headers were always included first but with the sorting it ended up
first in one case and stopped compiling. Adding the Index.h include
fixes it right up.

llvm-svn: 202810
2014-03-04 10:05:20 +00:00
Argyrios Kyrtzidis 7ffeea4ef3 [CMake] Add the newly introduced compiler header.
llvm-svn: 202792
2014-03-04 06:28:23 +00:00
David Majnemer 8f77453f7c MS ABI: Mangle variable templates properly
We wouldn't recognize variable templates as being templates leading us
to leave the template arguments off of the mangled name.  This would
allow two unrelated templates to map to the same mangled name.

N.B.  While MSVC doesn't support variable templates as of this date,
this mangling is the most likely thing they will choose to use.  Their
demangler can successfully demangle our manglings with the template
arguments shown.

llvm-svn: 202789
2014-03-04 05:38:05 +00:00
Alexey Bataev af02c1c003 Fix for r202778 - Implement __readeflags and __writeeflags intrinsics (renamed res to __res)
llvm-svn: 202784
2014-03-04 03:42:58 +00:00
David Blaikie f7f2185975 DebugInfo: Improvements/corrections to conservative emission of types in explicit template instantiation declarations
* detect out of line definitions correctly
* detect member function explicit specializations correctly

llvm-svn: 202779
2014-03-04 03:08:14 +00:00
Alexey Bataev 7cab007902 Implement __readeflags and __writeeflags intrinsics
llvm-svn: 202778
2014-03-04 03:03:03 +00:00
Richard Smith 309271b0ad Fix typo that resulted in names at TU scope getting lost sometimes after a
module import.

llvm-svn: 202771
2014-03-04 00:21:14 +00:00
David Blaikie 0e716b42f4 DebugInfo: Emit only the declaration of a class template that has an explicit instantiation declaration (& always emit such a type when there's an explicit instantiation definition)
We should only have this optimization fire when the explicit
instantiation definition would cause at  least one member function to be
emitted, thus ensuring that even a compiler not performing this
optimization would still emit the full type information elsewhere.

But we should also pessimize output still by always emitting the
definition when the explicit instantiation definition appears so that at
some point in the future we can depend on that information even when no
code had to be emitted in that TU. (this shouldn't happen very often,
since people mostly use explicit spec decl/defs to reduce code size -
but perhaps one day they could use it to explicitly reduce debug info
size too)

This was worth about 2% for Clang and LLVM - so not a huge win, but a
win. It looks really great for simple STL programs (include <string> and
just declare a string - 14k -> 1.4k of .dwo)

llvm-svn: 202769
2014-03-03 23:48:23 +00:00
Fariborz Jahanian 1d5c1fad68 Objective-C. Fixes a regression when figuring out linkage
for metadata symbols for forward referenced protocols which 
are never defined.  // rdar://16203115

llvm-svn: 202761
2014-03-03 21:53:57 +00:00
Richard Smith 446161b9ac Improve diagnostics for malformed constructor declarations (where lookup for
the type of the first parameter fails, and it is the only, unnamed, parameter).

llvm-svn: 202759
2014-03-03 21:12:53 +00:00
Benjamin Kramer a741b8c451 [C++11] Simplify compare operators with std::tie.
No functionality change.

llvm-svn: 202755
2014-03-03 20:26:46 +00:00
Diego Novillo b56be64599 Schedule discriminator pass.
This needs to modify a line table test to account for the new lexical
block created to hold the new discriminator value.

llvm-svn: 202754
2014-03-03 20:06:18 +00:00
Chandler Carruth b55d0226b7 [C++11] Remove a now unnecessary use of std::function for a remove_if
predicate. The wrapper used by SetVector was erroneously requiring an
adaptable predicate. It has been fixed and we really don't want to
require an indirect call for every predicate evaluation.

llvm-svn: 202744
2014-03-03 19:36:27 +00:00
Diego Novillo e6d398189e Update call DIBuilder::createLexicalBlock.
Create lexical blocks with discriminator value 0 by default.

llvm-svn: 202737
2014-03-03 18:53:32 +00:00
Jordan Rose 7ef1c387a0 Serialized diagnostic severity levels should be stable.
Serialized diagnostics were accidentally using the AST diagnostic level values
rather than a dedicated stable enum, so the addition of "remark" broke the
reading of existing serialized diagnostics files. I've added a .dia file
generated from Xcode 5's Clang to make sure we don't break this in the future.

llvm-svn: 202733
2014-03-03 18:29:52 +00:00
Robert Lytton d21e2d76fc correct consitency of XCore caps
llvm-svn: 202711
2014-03-03 13:45:29 +00:00
Argyrios Kyrtzidis 1594c15500 Introduce '-fmodules-user-build-path' which accepts the "canonical" path to a user workspace build.
This is used to avoid conflicts with user modules with the same name from different workspaces.

rdar://16042513

llvm-svn: 202683
2014-03-03 08:12:05 +00:00
Ahmed Charles bf8e283f15 [C++11] Add #include's for OwningPtr.
Allows removing #include's in LLVM while switching to std::unique_ptr.

llvm-svn: 202677
2014-03-03 07:11:21 +00:00
Peter Collingbourne c0423b349b Disable all dependency output options when using the Tooling library.
It isn't appropriate for a tool to be stomping over the dependency files,
especially if the actual build uses a compiler other than Clang or the tool
cannot find all the headers for some reason (which would cause the existing
dependency file to be deleted).

If a tool actually needs to care about dependency files we can think about
adding a mechanism for getting to this information.

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

llvm-svn: 202669
2014-03-02 23:37:26 +00:00
David Majnemer dbd6acb64b Revert "Preprocessor: Add __ALIGNOF_MAX_ALIGN_T__"
This commit reverts r201037, it's functionality is not needed given the
definition of std::max_align_t in libcxx circa r201843.

llvm-svn: 202667
2014-03-02 23:01:10 +00:00
David Majnemer b100410365 Normalize line endings
Some files had CRLF line terminators, some only had a mixture of
CRLF and LF.  Switch to LF.

llvm-svn: 202659
2014-03-02 18:46:05 +00:00
Hal Finkel f7a07a5010 Add a PPC inline asm constraint type for single CR bits
This adds support for the PPC "wc" inline asm constraint (used for allocating
individual CR bits). Support for this constraint type was recently added to the
LLVM PowerPC backend. Although gcc does not currently support allocating
individual CR bits, this identifier choice has been coordinated with the gcc
PowerPC team, and will be marked as reserved for this purpose in the gcc
constraints.md file.

Prior to this change, none of the multi-character PPC constraints were handled
correctly (the '^' escape character was not being added as required by the
parsing code in LLVM). This should now be fixed. I'll add tests for these other
constraints as support is added for them in the backend.

llvm-svn: 202658
2014-03-02 18:24:18 +00:00
Benjamin Kramer bd39f6e364 [C++11] ASTMatchers: Use standard static_assert and type traits.
llvm-svn: 202653
2014-03-02 17:08:43 +00:00
Benjamin Kramer 4527fb2f33 [C++11] Use std::atomic instead of LLVM's.
No intended functionality change.

llvm-svn: 202652
2014-03-02 17:08:31 +00:00
Benjamin Kramer cef536ec0f [C++11] Work around an incompatibility between llvm::tie and std::tie.
llvm-svn: 202643
2014-03-02 13:18:22 +00:00
Chandler Carruth 06dde92cd6 [C++11] Switch from LLVM_STATIC_ASSERT to static_assert now that we
require host toolchains which support this.

llvm-svn: 202640
2014-03-02 13:02:01 +00:00
Benjamin Kramer 867ea1d426 [C++11] Replace llvm::tie with std::tie.
llvm-svn: 202639
2014-03-02 13:01:17 +00:00
Chandler Carruth f8b7266d57 [C++11] Switch the clang-format LLVM style to use C++11 style braced
init list formatting. This suggestion has now gone into the LLVM coding
standards, and is particularly relevant now that we're using C++11.

Updated a really ridiculous number of tests to reflect this change.

llvm-svn: 202637
2014-03-02 12:37:31 +00:00
Benjamin Kramer 167e999be9 [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.
llvm-svn: 202635
2014-03-02 12:20:24 +00:00
Craig Topper bbc6d62736 [C++11] Remove an LLVM_OVERRIDE use that I missed in my previous commit.
llvm-svn: 202630
2014-03-02 10:02:43 +00:00
Craig Topper a798a9db93 Switch all uses of LLVM_OVERRIDE to just use 'override' directly.
llvm-svn: 202625
2014-03-02 09:32:10 +00:00
Richard Smith 7794486846 Add [extern_c] attribute for modules, allowing a C module to be imported within an extern "C" block in C++ code.
llvm-svn: 202615
2014-03-02 05:58:18 +00:00
Chandler Carruth c72d9b33af [C++11] Switch from the llvm_move macro to directly calling std::move.
llvm-svn: 202611
2014-03-02 04:02:40 +00:00
Alp Toker ceb95c47c4 [C++11] Expand and eliminate the LLVM_ENUM_INT_TYPE() macro
llvm-svn: 202606
2014-03-02 03:20:16 +00:00
Benjamin Kramer 3d6220d981 Move private classes into anonymous namespaces.
llvm-svn: 202595
2014-03-01 17:21:22 +00:00
Benjamin Kramer bbdd7640e8 [C++11] Replace verbose functors with succinct lambdas
No functionality change.

llvm-svn: 202590
2014-03-01 14:48:57 +00:00
Warren Hunt fed55979b1 Fixed an assertion failure related to bitfield lowering.
When lowering a bitfield, CGRecordLowering would assign the wrong 
storage type to a bitfield in some cases and trigger an assertion.  In 
these cases the layout was still correct, just the bitfield info was 
wrong.

llvm-svn: 202562
2014-03-01 00:38:40 +00:00
Richard Smith 49f906a36f If a module A exports a macro M, and a module B imports that macro and #undef's
it, importers of B should not see the macro. This is complicated by the fact
that A's macro could also be visible through a different path. The rules (as
hashed out on cfe-commits) are included as a documentation update in this
change.

With this, the number of regressions in libc++'s testsuite when modules are
enabled drops from 47 to 7. Those remaining 7 are also macro-related, and are
due to remaining bugs in this change (in particular, the handling of submodules
is imperfect).

llvm-svn: 202560
2014-03-01 00:08:04 +00:00
Reid Kleckner 3331128994 Fix leak in MicrosoftVTableContext
llvm-svn: 202558
2014-02-28 23:26:22 +00:00
Anton Yartsev 68a172ca16 [analyzer] Fix for PR18394.
Additional conditions that prevent useful nodes before call from being reclaimed.

llvm-svn: 202553
2014-02-28 22:29:48 +00:00
Ben Langmuir d066d4c849 Reapply fixed "Honour 'use-external-names' in FileManager"
Was r202442

There were two issues with the original patch that have now been fixed.
1. We were memset'ing over a FileEntry in a test case. After adding a
   std::string to FileEntry, this still happened to not break for me.
2. I didn't pass the FileManager into the new compiler instance in
   compileModule. This was hidden in some cases by the fact I didn't
   clear the module cache in the test.

Also, I changed the copy constructor for FileEntry, which was memcpy'ing
in a (now) unsafe way.

llvm-svn: 202539
2014-02-28 21:16:07 +00:00
Richard Smith 35ddad0723 Fix a minor bug in lexing pp-numbers with digit separators: if a pp-number contains "'e+", the pp-number ends between the 'e' and the '+'.
llvm-svn: 202533
2014-02-28 20:06:02 +00:00
Anders Carlsson 382ba41c48 When completing Objective-C instance method invocations, perform a contextual conversion to an Objective-C pointer type of the target expression if needed. This fixes code completion of method invocations where the target is a smart pointer that has an explicit conversion operator to an Objective-C type.
llvm-svn: 202529
2014-02-28 19:07:22 +00:00
Kaelyn Uhrain b4b1475322 Don't suggest non-static methods as corrections when they obviously
won't work (i.e. when not doing a member lookup and not in a method from
the same class or a descendant class).

llvm-svn: 202520
2014-02-28 18:12:42 +00:00
Tobias Grosser 741602461d Add 'remark' diagnostic type in 'clang'
A 'remark' is information that is not an error or a warning, but rather some
additional information provided to the user. In contrast to a 'note' a 'remark'
is an independent diagnostic, whereas a 'note' always depends on another
diagnostic.

A typical use case for remark nodes is information provided to the user, e.g.
information provided by the vectorizer about loops that have been vectorized.

This patch provides the initial implementation of 'remarks'. It includes the
actual definiton of the remark nodes, their printing as well as basic parameter
handling. We are reusing the existing diagnostic parameters which means a remark
can be enabled with normal '-Wdiagnostic-name' flags and can be upgraded to
an error using '-Werror=diagnostic-name'. '-Werror' alone does not upgrade
remarks.

This patch is by intention minimal in terms of parameter handling. More
experience and more discussions will most likely lead to further enhancements
in the parameter handling.

llvm-svn: 202475
2014-02-28 09:11:08 +00:00
Argyrios Kyrtzidis 24c55228a9 [ASTUnit] Don't let the preamble diagnostics out-live the CompilerInstance that created them,
this is inherently unsafe.

Instead get the diagnostic info into a SourceManager-independent form.

llvm-svn: 202471
2014-02-28 07:11:01 +00:00
Nick Lewycky b8336b7d13 Fix crash with enable_if on constructors.
llvm-svn: 202467
2014-02-28 05:26:13 +00:00
Rafael Espindola cc126271f8 Add support for OpenBSD SPARC assembler.
Patch by Brad Smith.

llvm-svn: 202462
2014-02-28 01:55:21 +00:00
Richard Smith 2868a736f8 Add a -Wclass-varargs to warn on objects of any class type being passed through an ellipsis. Since C++11 relaxed the rules on this, we allow a lot more bad code through silently, such as:
const char *format = "%s";
  std::experimental::string_view view = "foo";
  printf(format, view);

In this case, not only warn about a class type being used here, but also suggest that calling c_str() might be a good idea.

llvm-svn: 202461
2014-02-28 01:36:39 +00:00
Reid Kleckner 383c2f232e Attempt to fix non-MSVC build
llvm-svn: 202458
2014-02-28 01:12:55 +00:00
Reid Kleckner ad59deb436 -fdump-record-layouts: Sort nvbases by offset before printing them
It makes our -fdump-record-layouts a little more sane.

llvm-svn: 202457
2014-02-28 01:03:09 +00:00
Richard Trieu 86738692fd "&&&" != "&&"
llvm-svn: 202444
2014-02-27 23:59:14 +00:00
Ben Langmuir 1b8d44f59b Revert "Honour 'use-external-names' in FileManager"
Revert r202442, which broke the buildbots.

llvm-svn: 202443
2014-02-27 23:48:03 +00:00
Ben Langmuir 09e0d5c1bb Honour 'use-external-names' in FileManager
Pass through the externally-visible names that we got from the VFS down
to FileManager, and test that this is the name showing up in __FILE__,
diagnostics, and debug information.

llvm-svn: 202442
2014-02-27 23:27:54 +00:00
Reid Kleckner d6f9b83ae1 MS ABI: Attempt to fix DenseMap entry reference invalidation
llvm-svn: 202441
2014-02-27 22:51:43 +00:00
Ben Langmuir c9b7234e5c Reapply r202420 hopefully fixed for other STLs
Keep the copy constructor around, and add a FIXME that we should really
remove it as soon as we have C++11 std::map's emplace function.

llvm-svn: 202439
2014-02-27 22:21:32 +00:00
Bob Wilson 32dc99a480 Remove an assertion that no longer holds. <rdar://problem/16135814>
In r201528, I changed the PGO instrumentation counter for a "do" loop to not
include the fall-through count. That fall-through count is included later, b
it means that this assertion may fail for "do" loops.

llvm-svn: 202437
2014-02-27 21:59:17 +00:00
Ted Kremenek 08da97819a [-Wunreachable-code] always treat 'case:' and 'default:' cases as reachable.
This is a heuristic.  Many switch statements, although they look covered
over an enum, may actually handle at runtime more values than in the enum.

This is overly conservative, as there are some cases that clearly
can be ruled as being clearly unreachable, e.g. 'switch (42) { case 1: ... }'.
We can refine this later.

llvm-svn: 202436
2014-02-27 21:56:47 +00:00
Ted Kremenek 9238c5c878 [CFG] record the original (now unreachable) block of 'case:' and 'default:' cases.
llvm-svn: 202435
2014-02-27 21:56:44 +00:00
Ted Kremenek 4b408e7a04 [analyzer] check for now possibly null predecessor edge.
llvm-svn: 202434
2014-02-27 21:56:41 +00:00
Rui Ueyama ad33e60bef Fix -Wunused-function in Release build.
llvm-svn: 202429
2014-02-27 20:50:04 +00:00
John McCall 95833f33bd Diagnose attempts to apply ms_struct to records with base classes
or virtual functions, but permit that error to be downgraded to
a warning (with -Wno-error=incompatible-ms-struct), and officially
support this kind of dual, ABI-mixing layout.

The basic problem here is that projects which use ms_struct are often
not very circumspect about what types they annotate; for example,
some projects enable the pragma in a prefix header and then only
selectively disable it around system header inclusions.  They may
only care about binary compatibility with MSVC for a subset of
those structs, but that doesn't mean they have no binary
compatibility concerns at all for the rest; thus we are essentially
forced into supporting this hybrid ABI.  But it's reasonable for
us to at least point out the places where we're not making
any guarantees.

The original diagnostic was for dynamic classes, i.e. those with
virtual functions or virtual bases; I've extended it to include
all classes with bases, because we are not actually making any
attempt to duplicate MSVC's base subobject layout in ms_struct
(and it is indeed quite different from Itanium, even for
non-virtual bases).

rdar://16178895

llvm-svn: 202427
2014-02-27 20:30:49 +00:00
Reid Kleckner 9c6e9e313d MS ABI: Fix vftable mangling by using the vbtable name algorithm
Summary:
This merges VFPtrInfo and VBTableInfo into VPtrInfo, since they hold
almost the same information.  With that change, the vbtable mangling
code can easily be applied to vftable data and we magically get the
correct, unambiguous vftable names.

Fixes PR17748.

Reviewers: timurrrr, majnemer

CC: cfe-commits

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

llvm-svn: 202425
2014-02-27 19:40:09 +00:00