Commit Graph

34667 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 2403797eec For SourceManager::isBeforeInTranslationUnit(), have it consider macro arg expanded
token locations as coming before the closing ')' of a function macro expansion.

Include a unit test for SourceManager.

llvm-svn: 147056
2011-12-21 16:56:29 +00:00
Douglas Gregor 596b7cbc19 Implement a trivial, obvious optimization for deserialization of
redeclaration chains: only ever have the reader search for
redeclarations of the first (canonical) declaration, since we only
ever record redeclaration ranges for the that declaration. Searching
for redeclarations of non-canonical declarations will never find
anything, so it's a complete waste of time.

llvm-svn: 147055
2011-12-21 15:12:03 +00:00
Craig Topper a73baa8050 Add a few more AVX2 intrinsics and fix the type strings on a couple SSE intrinsics.
llvm-svn: 147048
2011-12-21 08:35:05 +00:00
Craig Topper 3fe5ac40db Add AVX2 horizontal add/sub intrinsics.
llvm-svn: 147047
2011-12-21 08:17:40 +00:00
Richard Smith f2b681b4d8 constexpr: diagnostic improvements for invalid lvalue-to-rvalue conversions in
constant expressions.

llvm-svn: 147035
2011-12-21 05:04:46 +00:00
Nick Lewycky f243e0df95 Bump suitable alignment on darwin ppc 32/64 and x86-32 to 16 bytes. I don't
actually know about the other OSes on X86-32 besides Linux...

llvm-svn: 147034
2011-12-21 04:25:47 +00:00
Richard Smith 242ad89a15 C++11 half of r147023: In C++11, additionally eagerly instantiate:
- constexpr function template instantiations
 - variables of reference type
 - constexpr variables

llvm-svn: 147031
2011-12-21 02:55:12 +00:00
Eli Friedman b9ccd553fc Attempt to fix test on 32-bit hosts.
llvm-svn: 147030
2011-12-21 01:57:31 +00:00
Eli Friedman 13ec75ba42 Fix a case where Expr::isConstantInitializer would return true for an expression we can't support. In a slightly amusing twist, the case in question was already in the clang regression tests marked as a valid construct. <rdar://problem/10020074>
llvm-svn: 147026
2011-12-21 00:43:02 +00:00
Richard Smith ed2974f3cf C++ constant expression handling: eagerly instantiate static const integral data
members of class templates so that their values can be used in ICEs. This
required reverting r105465, to get such instantiated members to be included in
serialized ASTs.

llvm-svn: 147023
2011-12-21 00:25:33 +00:00
Fariborz Jahanian 13d08955ea objc QOI: Don't't warn about mismatch between attributes
on method declaration and definition if former is in
a system header. // rdar://10580333

llvm-svn: 147020
2011-12-21 00:09:11 +00:00
Richard Smith 4f848f1dac PR11297: Provide a better diagnostic for code which contains a
reasonable-looking but ill-formed for-range statement of the form:

  for (expression : expression)

llvm-svn: 147006
2011-12-20 22:56:20 +00:00
Anna Zaks 5f847144d1 [analyzer] Do not invalidate arguments when the parameter's
type is a pointer to const. (radar://10595327)

The regions corresponding to the pointer and reference arguments to
a function get invalidated by the calls since a function call can
possibly modify the pointed to data. With this change, we are not going
to invalidate the data if the argument is a pointer to const. This
change makes the analyzer more optimistic in reporting errors.
(Support for C, C++ and Obj C)

llvm-svn: 147002
2011-12-20 22:35:30 +00:00
Fariborz Jahanian 028b9e1d0a objc/c++: Issue diagnostic when free-standing ivar is accessed
in class method instead of crash. // rdar://10593227

llvm-svn: 146998
2011-12-20 22:21:08 +00:00
Douglas Gregor 0abc262b02 When we make a previously-deserialized module definition visible,
notify the AST deserialization listener so that the AST writer knows
that it can write the macro definition.

llvm-svn: 146994
2011-12-20 22:06:13 +00:00
Ted Kremenek a1745c24c4 Fix inversion of static analyzer path diagnostics for path conditions.
llvm-svn: 146993
2011-12-20 22:00:25 +00:00
Nico Weber 3ffc4c93fd Fix a crash on invalid, http://llvm.org/pr11599
llvm-svn: 146988
2011-12-20 20:32:49 +00:00
Roman Divacky fadb3bea6b Let the KNR promotion warning be disabled.
Patch by Dimitry Andric!

llvm-svn: 146982
2011-12-20 18:35:44 +00:00
Douglas Gregor 21823bfe31 When performing name lookup for a redeclaration, ignore module
visibility restrictions. This ensures that all declarations of the
same entity end up in the same redeclaration chain, even if some of
those declarations aren't visible. While this may seem unfortunate to
some---why can't two C modules have different functions named
'f'?---it's an acknowedgment that a module does not introduce a new
"namespace" of names.

As part of this, stop merging the 'module-private' bit from previous
declarations to later declarations, because we want each declaration
in a module to stand on its own because this can effect, for example,
submodule visibility.

Note that this notion of names that are invisible to normal name
lookup but are available for redeclaration lookups is how we should
implement friend declarations and extern declarations within local
function scopes. I'm not tackling that problem now.

llvm-svn: 146980
2011-12-20 18:11:52 +00:00
Douglas Gregor 64d9257e38 When performing layout for an Objective-C class, make sure to dig out
the definition of that class. Fixes PR11613 / <rdar://problem/10604077>.

llvm-svn: 146976
2011-12-20 15:50:13 +00:00
Craig Topper a89747dd1e Add AVX2 intrinsics for pavg, pblend, and pcmp instructions. Also remove unneeded builtins for SSE pcmp. Change SSE pcmpeqq and pcmpgtq to not use builtins and just use vector == and >.
llvm-svn: 146969
2011-12-20 09:55:26 +00:00
Chandler Carruth 1c032e0dc0 Update the CMake build for r146959's new files.
llvm-svn: 146967
2011-12-20 08:42:15 +00:00
Bob Wilson bd646de67f Relax type checking for a few Neon intrinsics. <rdar://problem/10538555>
Not long ago, I tightened up the type checking for pointer arguments of
Neon intrinsics to match the specifications provided by ARM.  One consequence
was that it became impossible to access the unaligned versions of a few
Neon load/store operations.  Since there are just a few of these intrinsics
where it makes a difference, I think it's better to relax the type checking
than to either introduce new non-standard unaligned intrinsics or to disallow
intrinsics for the unaligned operations.

llvm-svn: 146963
2011-12-20 06:16:48 +00:00
Richard Smith ce3ad9a357 Fix off-by-one error in an assert condition. No functionality change, but better
error detection.

llvm-svn: 146962
2011-12-20 04:39:57 +00:00
Richard Smith 0f8ede1654 Revert r146766, and add a testcase for which it introduced a wrong-code bug.
llvm-svn: 146961
2011-12-20 04:00:21 +00:00
David Blaikie 68e081d606 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146959
2011-12-20 02:48:34 +00:00
Richard Smith 764d2fe666 Unlike in C++03, a constant-expression is not an unevaluated operand in C++11.
Split out a new ExpressionEvaluationContext flag for this case, and don't treat
it as unevaluated in C++11. This fixes some crash-on-invalids where we would
allow references to class members in potentially-evaluated constant expressions
in static member functions, and also fixes half of PR10177.

The fix to PR10177 exposed a case where template instantiation failed to provide
a source location for a diagnostic, so TreeTransform has been tweaked to supply
source locations when transforming a type. The source location is still not very
good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to
improve it further.

Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for
static data members of class templates which are used in constant expressions.
This fixes a link-time problem, but we still incorrectly treat the member as
non-constant. The rest of the fix for that issue is blocked on PCH support for
early-instantiated static data members, which will be added in a subsequent
patch.

llvm-svn: 146955
2011-12-20 02:08:33 +00:00
Eli Friedman 0ffc31c55b Fix tentative parsing so it knows how to handle an ambiguous for-range-declaration. PR11601.
llvm-svn: 146953
2011-12-20 01:50:37 +00:00
Chandler Carruth bc40eef82b Remove some extraneous carriage returns from these files. One of the
Windows subversion clients isn't setup to default to eol:native again...

llvm-svn: 146952
2011-12-20 01:45:15 +00:00
Ted Kremenek dd5d0dc4f4 Refine error diagnostic for using bridged casts when not using ARC.
llvm-svn: 146938
2011-12-20 01:03:40 +00:00
Douglas Gregor 98a52db80c Detect when mapping a #include/#import over to a submodule ends up
hitting a submodule that was never actually created, e.g., because
that header wasn't parsed. In such cases, complain (because the
module's umbrella headers don't cover everything) and fall back to
including the header.

Later, we'll add a warning at module-build time to catch all such
cases. However, this fallback is important to eliminate assertions in
the ASTWriter when this happens.

llvm-svn: 146933
2011-12-20 00:28:52 +00:00
Bill Wendling bd26cf90dc Mark the calls to the _setjmp function as returns twice. <rdar://problem/10492556>
llvm-svn: 146926
2011-12-19 23:53:28 +00:00
Eli Friedman 3184a5e482 Switch a few callers of MakeAddrLValue places over to MakeNaturalAlignAddrLValue.
llvm-svn: 146920
2011-12-19 23:03:09 +00:00
Fariborz Jahanian f9aca2089e objc-arc: bridge casts in non-arc mode are now
error. // rdar://10597832

llvm-svn: 146918
2011-12-19 22:52:53 +00:00
Richard Smith 5894a9138c Evaluation support for ExprWithCleanups. We won't evaluate any expression which
actually requires non-trivial cleanups, so no cleanups need to be performed.

llvm-svn: 146916
2011-12-19 22:12:41 +00:00
Richard Smith d0b111c3dd Improve r146813 (for PR11595) to give an appropriate diagnostic.
llvm-svn: 146915
2011-12-19 22:01:37 +00:00
Chris Lattner 4db839a8d4 loads also handled of course.
llvm-svn: 146910
2011-12-19 21:17:33 +00:00
Chris Lattner 2415357a05 Fix PR5279 - don't sliently drop alignment information on stores of types that have alignment less than the natural alignment of the type when it comes from a typedef.
llvm-svn: 146908
2011-12-19 21:16:08 +00:00
Chris Lattner 494f431097 filecheckize.
llvm-svn: 146907
2011-12-19 21:11:59 +00:00
Chris Lattner 7e588a8db0 rename test.
llvm-svn: 146906
2011-12-19 21:10:59 +00:00
Douglas Gregor 66e4addd88 Eliminate the first->last redeclaration map from the AST file
format. It's no longer being used, now that we have a new
implementation of redeclaration chains.

llvm-svn: 146905
2011-12-19 21:09:25 +00:00
Fariborz Jahanian 103ae5c48f objc-arc: bridge casts in non-objc-arc mode are ignord.
But, warn too. // rdar://10597832

llvm-svn: 146904
2011-12-19 21:06:15 +00:00
Douglas Gregor c1a61fe113 Remove ASTReader's PendingForwardRefs, which is now handled by the
(more general) fix-up of definition data pointers.

llvm-svn: 146903
2011-12-19 20:51:16 +00:00
Eli Friedman 61221b72ee Attempt to fix test in Release builds.
llvm-svn: 146898
2011-12-19 20:09:01 +00:00
Douglas Gregor 12aa609fd9 Fix typo 'typdefs', from Nikola Smiljanic
llvm-svn: 146894
2011-12-19 19:50:23 +00:00
Douglas Gregor e80b31f7f9 Once we have fully deserialized a redeclaration chain for something
with a definition pointer (e.g., C++ and Objective-C classes), zip
through the redeclaration chain to make sure that all of the
declarations point to the definition data. 

As part of this, realized again why the first redeclaration of an
entity in a file is important, and brought back that idea.

llvm-svn: 146886
2011-12-19 19:00:47 +00:00
Douglas Gregor 074a409622 Re-implement (de-)serialization of redeclaration chains for
redeclaration templates (RedeclarableTemplateDecl), similarly to the
way (de-)serialization is implemented for Redeclarable<T>. In the
process, found a simpler formulation for handling redeclaration
chains and implemented that in both places.

The new test establishes that we're building the redeclaration chains
properly. However, the FIXME indicates where we're tickling a
different bug that has to do with us not setting the DefinitionData
pointer properly in redeclarations that we detected after the
definition itself was deserialized. The (separable) fix for that bug
is forthcoming.

llvm-svn: 146883
2011-12-19 18:19:24 +00:00
Rafael Espindola ba9cc6c1bb Add a triple to the test.
llvm-svn: 146871
2011-12-19 16:30:30 +00:00
Douglas Gregor 2682ba0ed3 The submodule offset map can introduce "empty" remapping entries for
imported modules that don't introduce any new entities of a particular
kind. Allow these entries to be replaced with entries for another
loaded module.

In the included test case, selectors exhibit this behavior.

llvm-svn: 146870
2011-12-19 16:14:14 +00:00
Douglas Gregor 9f562c8d9e Optimize serialized representation of redeclarable declarations for
which there are no redeclarations. This reduced by size of the PCH
file for Cocoa.h by ~650k: ~536k of that was in the new
LOCAL_REDECLARATIONS table, which went from a ridiculous 540k down to
an acceptable 3.5k, while the rest was due to the more compact
abbreviated representation of redeclarable declaration kinds (which no
longer need to store the 'first' declaration ID).

llvm-svn: 146869
2011-12-19 15:27:36 +00:00