Commit Graph

11513 Commits

Author SHA1 Message Date
Richard Smith 04d3b3ea0f Clarify comment so this doesn't appear to be a C11-only rule.
llvm-svn: 216490
2014-08-26 21:51:57 +00:00
Fariborz Jahanian ffc120a900 revert patch r216469.
llvm-svn: 216485
2014-08-26 21:10:47 +00:00
Fariborz Jahanian 840438bb06 c11- Check for c11 language option as documentation says
feature is c11 about nested struct declarations must have
struct-declarator-list. Without this change, code
which was meant for c99 breaks. rdar://18125536

llvm-svn: 216469
2014-08-26 18:13:47 +00:00
Yi Kong 1d268af094 ARM: Add dbg builtin intrinsic
llvm-svn: 216452
2014-08-26 12:48:06 +00:00
Richard Trieu 11fd079b6e Passing a variable to std::move now counts as a use for -Wuninitialized
llvm-svn: 216438
2014-08-26 04:30:55 +00:00
Richard Smith 43ccec8e53 [modules] Track the described template in an alias declaration that is the
pattern of an alias template declaration. Use this to merge alias templates
properly when they're members of class template specializations.

llvm-svn: 216437
2014-08-26 03:52:16 +00:00
Fariborz Jahanian 4229228389 Objective-C. Allow [super initialize] in an +initialize
implementation but not anywhere else.
rdar://16628028

llvm-svn: 216408
2014-08-25 21:27:38 +00:00
Nikola Smiljanic 92516a8e7a PR20716 - Crash when recovering from type in known dependent base.
llvm-svn: 216352
2014-08-24 23:28:47 +00:00
Hal Finkel 3a1f4c77df Move __vector long deprecation checking into DeclSpec::Finish
__vector long is deprecated, but __vector long long is not. As a result, we
cannot check for __vector long (to issue the deprecation warning) as we parse
the type because we need to know how many 'long's we have first.
DeclSpec::Finish seems like a more-appropriate place to perform the check
(which places it with several other similar Altivec vector checks).

Fixes PR20720.

llvm-svn: 216342
2014-08-24 04:50:19 +00:00
Hans Wennborg c2b7f7a6ab Don't assert on different DLL attributes in template and explicit instantiation (PR20137)
We would previously assert (a decl cannot have two DLL attributes) on this code:

  template <typename T> struct __declspec(dllimport) S { T f() { return T(); } };
  template struct __declspec(dllexport) S<int>;

The problem was that when instantiating, we would take the attribute from the
template even if the instantiation itself already had an attribute.

Also, don't inherit DLL attributes from the template to its members before
instantiation, as the attribute may change.

I couldn't figure out what MinGW does here, so I'm leaving that open. At least
we're not asserting anymore.

llvm-svn: 216340
2014-08-24 00:12:36 +00:00
Hans Wennborg 205c39bb6b MS ABI: Inherit DLL attributes to partial class template specializations
llvm-svn: 216333
2014-08-23 22:34:43 +00:00
Hans Wennborg 2f9e293e37 checkDLLAttribute: remove a redundant dyn_cast
The same dyn_cast was done earlier in the function. No functionality change.

llvm-svn: 216326
2014-08-23 21:10:39 +00:00
David Majnemer 58e4ea904b CodeGen: Skip unnamed bitfields when handling designated initializers
We would accidently initialize unnamed bitfields instead of the
following field.

llvm-svn: 216313
2014-08-23 01:48:50 +00:00
Richard Smith 234ff47366 [modules] Put class template declarations into the scope in which they're
declared, rather than putting them into the template parameter scope. We
previously had *no record* in the scope for class template declarations, once
those declarations completed and their template parameter scopes were popped.
This in turn caused us to be unable to merge class template declarations that
were declared in the global scope (where we use scope lookup rather than
DeclContext lookup for merging), when loading a module.

llvm-svn: 216311
2014-08-23 00:49:01 +00:00
Richard Trieu 7ec1a318ff Fix a bad location in -Wparentheses fix-it hint
The code used getLocStart() instead of getLocEnd().  This works for single
token expressions, but breaks if the expression is longer.

llvm-svn: 216306
2014-08-23 00:30:57 +00:00
Fariborz Jahanian 4bf437ecd8 Objective-C. Warn when @encode'ing provides an incomplete
type encoding because in certain cases, such as for vector
types, because we still haven't designed encoding for them.
rdar://9255564

llvm-svn: 216301
2014-08-22 23:17:52 +00:00
Fariborz Jahanian e8b45505bc Objective-C. Update my previous patch to not warn if
+initialize is called on 'super' in its implementation.
rdar://16628028

llvm-svn: 216282
2014-08-22 19:52:49 +00:00
Fariborz Jahanian 78e9debf68 Objective-C. Warn if user has made explicit call
to +initilize as this results in an extra call
to this method. rdar://16628028

llvm-svn: 216271
2014-08-22 16:57:26 +00:00
Akira Hatanaka 987f1864ca [AArch64, inline-asm] Improve diagnostic that is printed when the size of a
variable that has regiser constraint "r" is not 64-bit.

General register operands are output using 64-bit "x" register names, regardless
of the size of the variable, unless the asm operand is prefixed with the "%w"
modifier. This surprises and confuses many users who aren't familiar with
aarch64 inline assembly rules.

With this commit, a note and fixit hint are printed which tell the users that
they need modifier "%w" in order to output a "w" register instead of an "x"
register.

<rdar://problem/12764785>

llvm-svn: 216260
2014-08-22 06:05:21 +00:00
Richard Trieu f98341ea4f Fix PR20705, crash on invalid.
dyn_cast -> dyn_cast_or_null to handle a null pointer.

llvm-svn: 216254
2014-08-22 01:16:44 +00:00
Richard Smith 3b717527f4 Return statements are initialization; don't forget to revert the initializer to
its syntactic form before re-analyzing it during template instantiation.

llvm-svn: 216224
2014-08-21 20:51:13 +00:00
Fariborz Jahanian 38c53fbf1f Objective-C. Recover from missing interface decl.
and checking on availability of method declaration
instead of crashing. // rdar://18059669

llvm-svn: 216191
2014-08-21 17:06:57 +00:00
Hans Wennborg 334e4ffc0d MS ABI: Don't always instantiate all members of dllexported class templates (PR20163)
Normally we mark all members of exported classes referenced to get them emitted.

However, MSVC doesn't do this for class templates that are implicitly specialized or
just have an explicit instantiation declaration. For such specializations, the members
are emitted when referenced.

The exception is the case when the dllexport attribute is propagated from a base class
to a base class template that doesn't have an explicit attribute: in this case all
methods of the base class template do get instantiated.

llvm-svn: 216145
2014-08-21 01:14:01 +00:00
Fariborz Jahanian 19c2e2fab2 Objective-C [qoi]. Provide fix-it hint when sending
class method to an object receiver. rdar://16263395

llvm-svn: 216038
2014-08-19 23:39:17 +00:00
Aaron Ballman dd69ef38db C++1y is now C++14!
Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording.

llvm-svn: 215982
2014-08-19 15:55:55 +00:00
Craig Topper 4dd9b43c8d Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size.
llvm-svn: 215869
2014-08-17 23:49:53 +00:00
Nico Weber ae4bb8c8f4 Make sure that vtables referenced from delay-parsed templates get referenced.
This fixes PR20671, see the bug for details. In short, ActOnTranslationUnit()
calls DefineUsedVTables() and only then PerformPendingInstantiations(). But
PerformPendingInstantiations() is what does delayed template parsing, so
vtables only references from late-parsed templates weren't marked used.

As a fix, move the SavePendingInstantiationsAndVTableUsesRAII in
PerformPendingInstantiations() up above the delayed template parsing code.
That way, vtables referenced from templates end up in the RAII object, and the
call to DefineUsedVTables() in PerformPendingInstantiations() marks them used.

llvm-svn: 215786
2014-08-15 23:21:41 +00:00
Nico Weber ccec9d8cee Add a RAII class for saving and restoring instantiations and uses. No behavior change.
llvm-svn: 215780
2014-08-15 22:29:14 +00:00
Fariborz Jahanian 4eda2c0086 Objective-C. Do not warn if user is using property-dox syntax to name a
user provided setter name (as declared in @property attribute declaration).
rdar://18022762

llvm-svn: 215736
2014-08-15 17:39:00 +00:00
Aaron Ballman 71291bc4a7 Const-correctness, return-after-else, and formatting updates. NFC.
llvm-svn: 215706
2014-08-15 12:38:17 +00:00
Reid Kleckner 062be331e2 Limit our MSVC compat hack for nested names from dependent bases
Previously, any undeclared unqualified id starting a nested name
specifier in a dependent context would have its lookup retried during
template instantiation.  Now we limit that retry hack to methods of a
class with dependent bases.  Free function templates in particular are
no longer affected by this hack.

Also, diagnose this as a Microsoft extension. This has the downside that
template authors may see this warning *and* an error during
instantiation time about this identifier. Fixing that will probably
require formalizing some kind of "delayed" identifier, instead of our
ad-hoc solutions of forming dependent AST nodes when lookup fails.

Based on a patch by Kim Gräsman!

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

llvm-svn: 215683
2014-08-14 23:34:52 +00:00
DeLesley Hutchins eb0ea5f40a Thread safety analysis: add -Wthread-safety-verbose flag, which adds additional notes that are helpful when compiling statistics on thread safety warnings.
llvm-svn: 215677
2014-08-14 21:40:15 +00:00
David Majnemer 5c734ad844 Sema: Permit nullptr template args in MSVC compat mode
This fixes a regression I caused back in r211766.

llvm-svn: 215609
2014-08-14 00:49:23 +00:00
Fariborz Jahanian d288fad374 Objective-C. Handle case of multiple class methods
found in global pool as well. rdar://16808765

llvm-svn: 215603
2014-08-13 23:38:04 +00:00
Fariborz Jahanian 0ded42451d Objective-C. Minor refactoring of my last patch.
// rdar://16808765

llvm-svn: 215581
2014-08-13 21:24:14 +00:00
Fariborz Jahanian 30ae8d4413 Objective-C. This patch is to resolve the method used in method
expression to the best method found in global method pools. 
This is wip.  // rdar://16808765

llvm-svn: 215577
2014-08-13 21:07:35 +00:00
Yi Kong a5548431a5 AArch64: Prefetch intrinsic
llvm-svn: 215569
2014-08-13 19:18:20 +00:00
Yi Kong 26d104a9ec ARM: Prefetch intrinsics
llvm-svn: 215568
2014-08-13 19:18:14 +00:00
Benjamin Kramer 2f5db8b3db Header guard canonicalization, clang part.
Modifications made by clang-tidy with minor tweaks.

llvm-svn: 215557
2014-08-13 16:25:19 +00:00
Fariborz Jahanian 5ab8750c5c Objective-C [qoi]. Patch to not do Fix-It for fixing
a messaging expression except in the simple case
of a unary selector. We cannot reliably provide such a fixit due
to numerous reasons where a matching selector could not be found.
rdar://15756038

llvm-svn: 215480
2014-08-12 22:16:41 +00:00
Richard Trieu 4834ad2609 Improve -Wuninitialized to catch const classes being used in their own copy
constructors.

llvm-svn: 215471
2014-08-12 21:05:04 +00:00
Jordan Rose 5790d5295e Allow @synchronized to contextually convert a C++ object to an ObjC object pointer.
Patch by Grant Paul!

llvm-svn: 215453
2014-08-12 16:20:36 +00:00
Richard Smith 36ee9fb219 Reject varargs '...' in function prototype if there are more parameters after
it. Diagnose with recovery if it appears after a function parameter that was
obviously supposed to be a parameter pack. Otherwise, warn if it immediately
follows a function parameter pack, because the user most likely didn't intend
to write a parameter pack followed by a C-style varargs ellipsis.

This warning can be syntactically disabled by using ", ..." instead of "...".

llvm-svn: 215408
2014-08-11 23:30:23 +00:00
David Majnemer 36ef89895c Sema: Properly perform lookup when acting on fields for desig inits
Clang used a custom implementation of lookup when handling designated
initializers.  The custom code was not particularly optimized and relied
on standard lookup for typo-correction anyway.

This custom code has to go, it doesn't properly support MSVC-style
anonymous structs embedded inside other records; replace it with the
typo-correction path.

This has the side effect of speeding up semantic handling of the fields
for a designated initializer while simplifying the code at the same
time.

This fixes PR20573.

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

llvm-svn: 215372
2014-08-11 18:33:59 +00:00
David Majnemer 8f0ed91490 Sema: Handle declspecs without declarators in records properly in C mode
We had two bugs:
- We wouldn't properly warn when a struct/union/enum was mentioned
  inside of a record definition if no declarator was provided.  We
  should have mentioned that this declaration declares nothing.
- We didn't properly support Microsoft's extension where certain
  declspecs without declarators would act as anonymous structs/unions.
  * We completely ignored the case where such a declspec could be a
    union.
  * We didn't properly handle the case where a record was defined inside
    another record:
      struct X {
        int a;
        struct Y {
          int b;
        };
      };

llvm-svn: 215347
2014-08-11 07:29:54 +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
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
Fariborz Jahanian bf09db44f7 Objective-C. Minor refactoring of my previous patch.
rdar://17554063

llvm-svn: 215235
2014-08-08 18:29:52 +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