Commit Graph

22951 Commits

Author SHA1 Message Date
Timur Iskhodzhanov 16055e77b9 Fix PR20444 -- wrong number of vftable slots created when return adjustment thunks are needed
Reviewed at http://reviews.llvm.org/D4822

llvm-svn: 215312
2014-08-10 11:40:51 +00:00
Richard Smith ca40f9b39a [modules] When considering merging a newly-declared typedef into an imported
one, perform the import if the types match even if the imported declaration is
hidden. Otherwise, NamedDecl::declarationReplaces will drop one of the name
lookup entries, making the typedef effectively inaccessible from one of the
modules that declared it.

llvm-svn: 215306
2014-08-10 02:20:15 +00:00
Yaron Keren ec740b3d46 Make this test unsupported when there is no real 'env' from a real shell.
While the test was already requiring shell-preserves-root (such as the
internal shell), it wasn't aware that the MSYS 1.0 env command knows how
to expand root by itself!

From cmd.exe try:

  env SDKROOT=/ cmd //c echo %SDKROOT%

And get:

  C:/MINGW/MSYS/1.0
  
To be certain we have a good 'env' program the test now requires a shell.

llvm-svn: 215298
2014-08-09 21:24:04 +00:00
Joerg Sonnenberger 2bb3a90658 Actually add the object file, skipped by the directory add.
llvm-svn: 215297
2014-08-09 21:06:57 +00:00
Joerg Sonnenberger 17a80e49e7 Use the correct fallback directory for EABIHF targets on NetBSD/arm.
From Matt Thomas.

llvm-svn: 215292
2014-08-09 19:01:52 +00:00
Joerg Sonnenberger 323cea90da NetBSD/aarch64 has no libgcc or libstdc++. Drop arm64 tests.
llvm-svn: 215291
2014-08-09 18:28:36 +00:00
Timur Iskhodzhanov f97c973c2e Fix PR20479 -- missing vftable slots in case of virtual inheritance vs return adjusting thunks
Reviewed at http://reviews.llvm.org/D4829

llvm-svn: 215285
2014-08-09 17:08:06 +00:00
Justin Bogner a0101074fd Revert "Add tests for coverage mapping generation."
I reverted one of the added tests from r215261 in r215274, since it
was failing on quite a few bots. It looks like this wasn't sufficient,
as we're still getting failures on windows, like the following:

    http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/5378

I'm reverting this entire commit so the bots aren't blocked on these
failures.

This reverts commit r215261.

llvm-svn: 215278
2014-08-09 03:55:09 +00:00
Justin Bogner 6f147a0966 Revert a failing test from r215261
The (new) CoverageMapping/macroparams.c test is failing on a number of
buildbots. Reverting it until Alex can investigate and fix the test.

llvm-svn: 215274
2014-08-09 01:40:59 +00:00
Richard Smith 49faf9f4cd [modules] Weaken an out-of-date assertion: an #undef can have no location if we
imported it from a module when performing finalization before writing out
an AST file.

llvm-svn: 215272
2014-08-09 01:24:07 +00:00
Alex Lorenz c4ea74a719 Add tests for coverage mapping generation.
This patch adds the tests for the coverage mapping generation. 
Most of the tests check the mapping regions produced by 
the generator, and one checks the llvm IR.

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

llvm-svn: 215261
2014-08-08 23:49:58 +00:00
Bob Wilson a2acb1e84e Add predefined macros to identify x86_64h architectures.
Patch by Jim Grosbach.

llvm-svn: 215260
2014-08-08 23:46:28 +00:00
Bob Wilson 7400e596a3 Predefine IB_DESIGNABLE and IBInspectable macros. <rdar://problem/17441860>
These macros are used as markers for Interface Builder and need to be defined
to empty strings since they have no impact on the code.

Patch by Ted Kremenek.

llvm-svn: 215259
2014-08-08 23:46:25 +00:00
Alexey Samsonov 90490af21d Add -link-cxx-sanitizer driver flag.
Summary:
This flag can be used to force linking of CXX-specific parts
of sanitizer runtimes into the final executable. It gives more precise
control than --driver-mode=g++ and comes handy when user links several
object files with sanitized C++ code into an executable, but wants
to provide libstdc++ himself, instead of relying on Clang dirver's
behavior.

Test Plan: clang regression test suite

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 215252
2014-08-08 22:47:17 +00:00
Richard Trieu 4cbff5c76f Extend tautological pointer compare and pointer to bool conversion warnings to
macro arguments.

Previously, these warnings skipped any code in a macro expansion.  Preform an
additional check and warn when the expression and context locations are both
in the macro argument.

The most obvious case not caught is passing a pointer directly to a macro,
i.e 'assert(&array)' but 'assert(&array && "valid array")' is caught.  This is
because macro arguments are not typed and the conversion happens inside the
macro.

llvm-svn: 215251
2014-08-08 22:41:43 +00:00
Fariborz Jahanian 0b1d28866c Objective-C [qoi]. Issue warning and fixit if property-dot syntax
use mis-cased property name (which is currently accepted silently
due to the way property setters are named). rdar://17911746

llvm-svn: 215250
2014-08-08 22:33:24 +00:00
Bob Wilson 2a3710ec9e Change __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ for versions > 10.9.
The previous encoding only allowed a single digit for the minor version
number. This changes it to use 2 digits for both the minor version and the
revision number.

llvm-svn: 215245
2014-08-08 21:45:53 +00:00
Daniel Sanders 7e7baa9ab8 Partially revert r215204 - [mips] Add -mabicalls/-mno-abicalls to the driver
It wasn't actually a bug that -mabicalls/-mno-abicalls wasn't being passed to
GAS. The only reason we pass it to the integrated assembler is because it shares
the same framework with CodeGen.

llvm-svn: 215236
2014-08-08 18:39:01 +00:00
Fariborz Jahanian 495bc3f5f6 Objective-C ARC. Use of non-retain/autorelease API
for building Objective-C array literals in ARC
mode. rdar://17554063

llvm-svn: 215232
2014-08-08 17:31:14 +00:00
David Blaikie 77bbb5fd0b DebugInfo: Blocks: Do not depend on LLVM argument numbering when choosing the debug info argument numbering.
Due to the possible presence of return-by-out parameters, using the LLVM
argument number count when numbering debug info arguments can end up
off-by-one. This could produce two arguments with the same number, which
would in turn cause LLVM to emit only one of those arguments (whichever
it found last) or assert (r215157).

llvm-svn: 215227
2014-08-08 17:10:14 +00:00
Daniel Sanders feb613028b [mips] Invert the abicalls feature bit to be noabicalls so that it's possible for -mno-abicalls to take effect.
Also added the testcase that should have been in r215194.

This behaviour has surprised me a few times now. The problem is that the
generated MipsSubtarget::ParseSubtargetFeatures() contains code like this:

   if ((Bits & Mips::FeatureABICalls) != 0) IsABICalls = true;

so '-abicalls' means 'leave it at the default' and '+abicalls' means 'set it to
true'. In this case, (and the similar -modd-spreg case) I'd like the code to be

  IsABICalls = (Bits & Mips::FeatureABICalls) != 0;

or possibly:

   if ((Bits & Mips::FeatureABICalls) != 0)
     IsABICalls = true;
   else
     IsABICalls = false;

and preferably arrange for 'Bits & Mips::FeatureABICalls' to be true by default
(on some triples).

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

Patch by Rob Springer.

llvm-svn: 215208
2014-08-08 14:59:00 +00:00
Daniel Sanders e805f44c8f [mips] Add -mabicalls/-mno-abicalls to the driver
Based on a patch by Matheus Almeida. I've added testcases and fixed a bug where
the options weren't passed on to GAS.

llvm-svn: 215204
2014-08-08 13:44:50 +00:00
Manuel Klimek deb0262a5e Fix branch reachabiliy annotation for temp dtor branches.
As we only create temp dtor decision branches when a temp dtor needs to
be run (as opposed to for each logical branch in the original
expression), we must include the information about all previous logical
branches when we annotate the temp dtor decision branch.

llvm-svn: 215188
2014-08-08 07:37:13 +00:00
David Majnemer f9834d5fa0 Parser: Array decls with static but without array size are illformed
Array declarators involving the static keyword take on two forms:
    D[ static type-qualifier-listopt assignment-expression ]
    D[ type-qualifier-list static assignment-expression ]

Raise a diagnostic if the assignment-expression is missing.

This fixes PR20584.

llvm-svn: 215187
2014-08-08 07:21:18 +00:00
David Majnemer d96b99740d MS ABI: Don't force bases to have an inheritance model
Previously, assigning an inheritance model to a derived class would
trigger further assiginments to the various bases of the class.  This
was done to fix a bug where we couldn't handle an implicit
base-to-derived conversion for pointers-to-members when the conversion
was ambiguous at an earlier point.

However, this is not how the MS scheme works.  Instead, assign
inheritance models to *just* the class which owns to declaration we
ended up referencing.

N.B.  This result is surprising in many ways.  It means that it is
possible for a base to have a "larger" inheritance model than it's
derived classes.  It also means that bases in the conversion path do not
get assigned a model.

struct A { void f(); void f(int); };
struct B : A {};
struct C : B {};
void f() { void (C::*x)() = &A::f; }

We can only begin to assign an inheritance model *after* we've seen the
address-of but *before* we've done the implicit conversion the more
derived pointer-to-member type.  After that point, both 'A' and 'C' will
have an inheritance model but 'B' will not.  Surprising, right?

llvm-svn: 215174
2014-08-08 00:10:39 +00:00
David Majnemer b3e5654923 MS ABI: Handle member function pointers returning a member data pointer
MSVC doesn't decide what the inheritance model for a returned member
pointer *until* a call expression returns it.

This fixes PR20017.

llvm-svn: 215164
2014-08-07 22:56:13 +00:00
Reid Kleckner d3b23d611b Debug info: Use the vbtable offset for virtual bases in the MS ABI
There are no vtable offset offsets in the MS ABI, but vbtable offsets
are analogous.  There are no consumers of this information yet, but at
least we don't crash now.

llvm-svn: 215149
2014-08-07 21:29:25 +00:00
Fariborz Jahanian d45e7cec42 Objective-C arc. Switch the Objective-C dictionary literal in ARC mode
to use non-retain/autorelease API variants of ObjC objects. wip.
rdar://17554063

llvm-svn: 215146
2014-08-07 20:57:35 +00:00
Reid Kleckner 65a2f640d1 Revert "Debug info: Use record layout to find vbase offsets instead of vtables"
This reverts commit r215137.

This doesn't work at all, an offset-offset is probably different than an
offset.  I'm scared that this passed our normal test suite.

llvm-svn: 215141
2014-08-07 20:36:48 +00:00
Reid Kleckner 9f6e438022 Debug info: Use record layout to find vbase offsets instead of vtables
This fixes an assertion when generating full debug info in the MS ABI
for classes with virtual bases.

Fixes PR20579.

llvm-svn: 215137
2014-08-07 19:43:01 +00:00
Richard Smith 4d2357948b [modules] When emitting an update record containing the body of a destructor,
also emit the updated 'operator delete' looked up for that destructor. Switch
from UpdateDecl to an actual update record when this happens due to implicitly
defining a special member function and unify this code path and the one for
instantiating a function definition.

llvm-svn: 215132
2014-08-07 18:53:08 +00:00
Justin Bogner 69ba3306fc test/Modules: Use FileCheck's -allow-empty instead of "count 0"
Piping stderr into "count 0" in tests doesn't work - things like guard
malloc write to stderr and mess up the count. This comes up all the
time, so I've added a feature to FileCheck to fix it this time.

Fixes test failures caused by r215046 under guard malloc.

llvm-svn: 215129
2014-08-07 18:45:21 +00:00
Manuel Klimek edf925b935 Mark successors as reachable/unreachable instead of changing the CFG.
As suggested by Ted, this makes a few warnings less aggressive.

llvm-svn: 215128
2014-08-07 18:44:19 +00:00
Manuel Klimek cadc603e91 Fix CFG for temporary dtors when the branch taken is known.
Use the parent context when visiting temporaries when we do not insert a
temporary dtor decision branch.

llvm-svn: 215120
2014-08-07 17:02:21 +00:00
Manuel Klimek 7c03013c8b Model temporary destructors from logical operators with known values.
If the truth value of a LHS is known, we can build the knowledge whether
a temporary destructor is executed or not into the CFG. This is needed
by the return type analysis.

llvm-svn: 215118
2014-08-07 16:05:51 +00:00
Manuel Klimek 0ce9108104 Only have one path in the CFG for ternaries if the condition is known.
The return type analysis requires that the CFG is simplified when the
truth values of branches are statically known at analysis time.

llvm-svn: 215114
2014-08-07 14:25:43 +00:00
Manuel Klimek b5616c9f8d Re-applying r214962.
Changes to the original patch:
- model the CFG for temporary destructors in conditional operators so that
  the destructors of the true and false branch are always exclusive. This
  is necessary because we must not have impossible paths for the path
  based analysis to work.
- add multiple regression tests with ternary operators

Original description:
Fix modelling of non-lifetime-extended temporary destructors in the
analyzer.

Changes to the CFG:
When creating the CFG for temporary destructors, we create a structure
that mirrors the branch structure of the conditionally executed
temporary constructors in a full expression.
The branches we create use a CXXBindTemporaryExpr as terminator which
corresponds to the temporary constructor which must have been executed
to enter the destruction branch.

2. Changes to the Analyzer:
When we visit a CXXBindTemporaryExpr we mark the CXXBindTemporaryExpr as
executed in the state; when we reach a branch that contains the
corresponding CXXBindTemporaryExpr as terminator, we branch out
depending on whether the corresponding CXXBindTemporaryExpr was marked
as executed.

llvm-svn: 215096
2014-08-07 10:42:17 +00:00
Justin Bogner 4d10c23909 Driver: Add tests for -fprofile-arcs and -fno-profile-arcs
I tried to be lazy and get away with no test in r215051, but Chad
caught me :)

llvm-svn: 215053
2014-08-07 03:58:32 +00:00
Richard Smith 3be1cb294f Use -Rblah, not -Wblah, to control remark diagnostics. This was always the
intent when we added remark support, but was never implemented in the general
case, because the first -R flags didn't need it. (-Rpass= had special handling
to accomodate its argument.)

-Rno-foo, -Reverything, and -Rno-everything can be used to turn off a remark,
or to turn on or off all remarks. Per discussion on cfe-commits, -Weverything
does not affect remarks, and -Reverything does not affect warnings or errors.

The only "real" -R flag we have right now is -Rmodule-build; that flag is
effectively renamed from -Wmodule-build to -Rmodule-build by this change.

-Wpass and -Wno-pass (and their friends) are also renamed to -Rpass and
-Rno-pass by this change; it's not completely clear whether we intended to have
a -Rpass (with no =pattern), but that is unchanged by this commit, other than
the flag name. The default pattern is effectively one which matches no passes.
In future, we may want to make the default pattern be .*, so that -Reverything
works for -Rpass properly.

llvm-svn: 215046
2014-08-07 00:24:21 +00:00
Fariborz Jahanian 2a25dba153 Objective-C ARC. More code for Objective-C's
new APIs for literals. nfc. wip. rdar://17554063

llvm-svn: 215043
2014-08-06 23:40:31 +00:00
Rui Ueyama a89f9c8fdb Revert "Fix modelling of non-lifetime-extended temporary destructors in the analyzer."
This reverts commit r214962 because after the change the
following code doesn't compile with -Wreturn-type -Werror.

  #include <cstdlib>

  class NoReturn {
  public:
    ~NoReturn() __attribute__((noreturn)) { exit(1); }
  };

  int check() {
    true ? NoReturn() : NoReturn();
  }

llvm-svn: 214998
2014-08-06 22:01:54 +00:00
Manuel Klimek d9b4ad6e1f Fix modelling of non-lifetime-extended temporary destructors in the analyzer.
1. Changes to the CFG:
When creating the CFG for temporary destructors, we create a structure
that mirrors the branch structure of the conditionally executed
temporary constructors in a full expression.
The branches we create use a CXXBindTemporaryExpr as terminator which
corresponds to the temporary constructor which must have been executed
to enter the destruction branch.

2. Changes to the Analyzer:
When we visit a CXXBindTemporaryExpr we mark the CXXBindTemporaryExpr as
executed in the state; when we reach a branch that contains the
corresponding CXXBindTemporaryExpr as terminator, we branch out
depending on whether the corresponding CXXBindTemporaryExpr was marked
as executed.

llvm-svn: 214962
2014-08-06 12:45:51 +00:00
David Majnemer ff9075f054 MS ABI: Mangle lambdas which are given the same mangling number
It is possible for lambdas to get the same mangling number because they
may exist in different mangling contexts.  To handle this correctly,
mangle the context into the name as well.

llvm-svn: 214947
2014-08-06 03:12:47 +00:00
Rui Ueyama cfea160681 Remove trailing whitespaces
llvm-svn: 214935
2014-08-05 23:43:21 +00:00
David Majnemer 57fbc0c35f MS ABI: Mangle empty type parameter packs compatibly
The MS mangling scheme apparently has separate manglings for type and
non-type parameter packs when they are empty.  Match template arguments
with parameters during mangling; check the parameter to see if it was
destined to hold type-ish things or nontype-ish things.

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

llvm-svn: 214932
2014-08-05 22:43:45 +00:00
Reid Kleckner 74a6816b33 Fix Driver tests that I broke on Windows in r214924
llvm-svn: 214931
2014-08-05 22:39:07 +00:00
Fariborz Jahanian bcd82afad6 Introduce f[no-]max-unknown-pointer-align=[number] option
to instruct the code generator to not enforce a higher alignment 
than the given number (of bytes) when accessing memory via an opaque 
pointer or reference. Patch reviewed by John McCall (with post-commit
review pending). rdar://16254558

llvm-svn: 214911
2014-08-05 18:37:48 +00:00
Anton Yartsev 4e4cb6bc30 [Analyzer] fix for PR19102
Newly-created unconsumed instance is now assumed escaped if an invoked constructor has an argument of a pointer-to-record type.

llvm-svn: 214909
2014-08-05 18:26:05 +00:00
Arthur Marble 05b0798916 Added f and m flags to be ignored. These will not display a warning. The revision
for this patch is here: http://reviews.llvm.org/D4570. This will help with the
rebuild of Debian with clang. Here is a link to the errors that Debian is
experiencing: http://clang.debian.net/status.php?version=3.4.2&key=UNKNOWN_ARG

llvm-svn: 214907
2014-08-05 18:21:20 +00:00