Commit Graph

16461 Commits

Author SHA1 Message Date
Hans Wennborg c5afd06a0d clang-cl /fallback: emit a note when falling back
This makes it a lot easier to see what's going on from the output.

llvm-svn: 201604
2014-02-18 21:42:51 +00:00
Hans Wennborg bf4e8d91e3 clang-cl: support -v
It doesn't conflict with any cl.exe options and it's useful for debugging.

llvm-svn: 201597
2014-02-18 19:29:31 +00:00
Hans Wennborg 3fa9f307fe clang-cl: Parse the /d2Zi+ flag (PR18728)
This is an undocumented, but reportedly widely used flag.
We don't support it, but should be able to parse it.

llvm-svn: 201588
2014-02-18 17:49:01 +00:00
Aaron Ballman efe348ec44 DeLesley Hutchins (who wrote the original thread-safety attribute functionality) and I have agreed to start migrating from lock-specific terminology to "capability"-specific terminology. This opens the door for future threading-related analysis passes so that a common nomenclature can be used.
The following attributes have been (silently) deprecated, with their replacements listed:

lockable => capability
exclusive_locks_required => requires_capability
shared_locks_required => requires_shared_capability
locks_excluded => requires_capability

There are no functional changes intended.

llvm-svn: 201585
2014-02-18 17:36:50 +00:00
Richard Smith 7b1573451e Fix a non-error diagnostic that had an err_ name. Also move it from Warning to
ExtWarn, since it's an extension.

llvm-svn: 201540
2014-02-18 00:45:50 +00:00
Richard Smith 4ee696d55c PR18870: Parse language linkage specifiers properly if the string-literal is
spelled in an interesting way.

llvm-svn: 201536
2014-02-17 23:25:27 +00:00
Richard Smith 8b7258bdb3 PR18855: Add support for UCNs and UTF-8 encoding within ud-suffixes.
llvm-svn: 201532
2014-02-17 21:52:30 +00:00
Anton Yartsev 6a61922239 [analyzer] Improved checker naming in CFG dump.
This implements FIXME from Checker.cpp (FIXME: We want to return the package + name of the checker here.) and replaces hardcoded checker names with the new ones obtained via getCheckName().getName().

llvm-svn: 201525
2014-02-17 18:25:34 +00:00
Aaron Ballman 97dba048a3 Implements a declarative approach to documenting individual attributes in Clang via a Documentation tablegen class. Also updates the internals manual with information about how to use this new, required, documentation feature.
This patch adds some very, very sparse initial documentation for some attributes. Additional effort from attribute authors is greatly appreciated.

llvm-svn: 201515
2014-02-17 15:27:10 +00:00
Patrik Hagglund 55701d25ee Fix gcc warning about C++ style comments.
llvm-svn: 201512
2014-02-17 11:54:08 +00:00
Richard Smith 2add114600 Fix crash-on-invalid if decltype(auto) is used as a deduced return type in
C++11 mode. Continue to disallow return type deduction in C++11 for now.

llvm-svn: 201438
2014-02-14 22:17:32 +00:00
Argyrios Kyrtzidis 75fa9eddae If the headermap maps the filename to a framework include ("Foo.h" -> "Foo/Foo.h"),
continue header lookup using the framework include as filename.

This allows us to conveniently treat
  #import "Foo.h"
as an implicit module import if we can resolve "Foo/Foo.h" as such.

rdar://16042979

llvm-svn: 201419
2014-02-14 14:58:28 +00:00
Evgeniy Stepanov 7429c5941b Enable generation of unwind tables when building with sanitizers.
llvm-svn: 201391
2014-02-14 08:56:25 +00:00
Eric Christopher 0d403d22b0 Add a command line option -gdwarf-aranges that will turn on emitting
the dwarf .debug_aranges section.

llvm-svn: 201379
2014-02-14 01:27:03 +00:00
Kaelyn Uhrain 67b44c9871 Enable correcting a member declaration where the type is class template,
and the class name is shadowed by another member. Recovery still needs
to be figured out, which is non-trivial since the parser has already gone
down a much different path than if it had recognized the class template
as type instead of seeing the member that shadowed the class template.

llvm-svn: 201360
2014-02-13 20:14:07 +00:00
Daniel Jasper ee107adb7d clang-format: Improve documentation of DerivePointerBinding.
For reference: llvm.org/PR18690.

Also updated generated help page and page creation script.

llvm-svn: 201323
2014-02-13 12:51:50 +00:00
Alexey Bataev aadd52e5cc [OPENMP] 'if' clause support (no CodeGen support)
llvm-svn: 201297
2014-02-13 05:29:23 +00:00
Aaron Ballman 44d2ed9817 There is no std namespace for standards-based attributes. Removing the scope qualifier and updating the only affected test case.
llvm-svn: 201294
2014-02-13 04:31:04 +00:00
Reid Kleckner f50dc56baa Fix some -Wdocumentation warnings in Sema.h and try to fix test for win64
llvm-svn: 201278
2014-02-13 00:22:04 +00:00
Reid Kleckner c0dca6ded7 MS ABI: Implement #pragma vtordisp() and clang-cl /vdN
These features are new in VS 2013 and are necessary in order to layout
std::ostream correctly.  Currently we have an ABI incompatibility when
self-hosting with the 2013 stdlib in our convertible_fwd_ostream wrapper
in gtest.

This change adds another implicit attribute, MSVtorDispAttr, because
implicit attributes are currently the best way to make sure the
information stays on class templates through instantiation.

Reviewers: majnemer

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

llvm-svn: 201274
2014-02-12 23:50:26 +00:00
Benjamin Kramer c6a1a16deb Remove unused diagnostic.
llvm-svn: 201257
2014-02-12 21:25:40 +00:00
David Majnemer abecae741c Sema: Restrict alignment to 2**28.
Allowing alignment past this point causes wrap around within clang.

N.B.  GCC has the same restriction.

llvm-svn: 201254
2014-02-12 20:36:10 +00:00
Dmitri Gribenko ea4d1c32fb libclang: report error code for bad PCH files
This commit improves libclang to report the error condition when
CXTranslationUnit can not be created because of a stale PCH file.  This allows
the caller, for example, to rebuild the PCH file and retry the request.

There two are APIs in libclang that return a CXTranslationUnit and don't
support reporting detailed errors (the only error condition is a NULL result).
For these APIs, a second, superior, version is introduced --
clang_createTranslationUnit2 and clang_parseTranslationUnit2.  These functions
return a CXTranslationUnit indirectly and also return an error code.  Old
functions are still supported and are nothing more than convenience wrappers
that ignore extended error codes.

As a cleanup, this commit also categorizes some libclang errors in the
functions I had to modify anyway.

llvm-svn: 201249
2014-02-12 19:12:37 +00:00
Tim Northover 3402dc7d52 ARM NEON: fix range checking on immediates.
Previously, range checking on the __builtin_neon_XYZ_v Clang intrinsics didn't
take account of the type actually passed to the call, which meant a request
like "vext_s16(a, b, 7)" was allowed through (TableGen was conservative and
allowed 0-7 for all types). This caused an assert in the backend because the
lane doesn't make sense.

llvm-svn: 201232
2014-02-12 12:04:59 +00:00
Dmitri Gribenko fdd4f30f0e 'svn add' files I forgot for r201224 (Add an option to allow Clang verify
source files for a module only once during)

llvm-svn: 201225
2014-02-12 10:40:07 +00:00
Dmitri Gribenko f430da4de6 Add an option to allow Clang verify source files for a module only once during
the build

When Clang loads the module, it verifies the user source files that the module
was built from.  If any file was changed, the module is rebuilt.  There are two
problems with this:
1. correctness: we don't verify system files (there are too many of them, and
   stat'ing all of them would take a lot of time);
2. performance: the same module file is verified again and again during a
   single build.

This change allows the build system to optimize source file verification.  The
idea is based on the fact that while the project is being built, the source
files don't change.  This allows us to verify the module only once during a
single build session.  The build system passes a flag,
-fbuild-session-timestamp=, to inform Clang of the time when the build started.
The build system also requests to enable this feature by passing
-fmodules-validate-once-per-build-session.  If these flags are not passed, the
behavior is not changed.  When Clang verifies the module the first time, it
writes out a timestamp file.  Then, when Clang loads the module the second
time, it finds a timestamp file, so it can compare the verification timestamp
of the module with the time when the build started.  If the verification
timestamp is too old, the module is verified again, and the timestamp file is
updated.

llvm-svn: 201224
2014-02-12 10:33:14 +00:00
Jonathan Roelofs 2cea1bea87 Add Multilib selection machinery
This patch improves the support for picking Multilibs from gcc installations.
It also provides a better approximation for the flags '-print-multi-directory'
and '-print-multi-lib'.

This reverts r201203 (i.e. re-applying r201202 with small fixes in
unittests/CMakeLists.txtto make the build bots happy).

review: http://llvm-reviews.chandlerc.com/D2538
llvm-svn: 201205
2014-02-12 03:21:20 +00:00
Jonathan Roelofs 3fa96d8378 Revert 201202
Breaks cmake configure of new unit tests directory

llvm-svn: 201203
2014-02-12 01:36:51 +00:00
Jonathan Roelofs 0e7ec60b74 Add Multilib selection machinery
This patch improves the support for picking Multilibs from gcc installations.
It also provides a better approximation for the flags '-print-multi-directory'
and '-print-multi-lib'.

review: http://llvm-reviews.chandlerc.com/D2538
llvm-svn: 201202
2014-02-12 01:29:25 +00:00
Alexander Kornienko 4c27c5b783 Fix build error caused by r201186 (GCC's "declaration of X changes meaning of Y").
llvm-svn: 201189
2014-02-11 22:14:03 +00:00
Alexander Kornienko 4aca9b1cd8 Expose the name of the checker producing each diagnostic message.
Summary:
In clang-tidy we'd like to know the name of the checker producing each
diagnostic message. PathDiagnostic has BugType and Category fields, which are
both arbitrary human-readable strings, but we need to know the exact name of the
checker in the form that can be used in the CheckersControlList option to
enable/disable the specific checker.

This patch adds the CheckName field to the CheckerBase class, and sets it in
the CheckerManager::registerChecker() method, which gets them from the
CheckerRegistry.

Checkers that implement multiple checks have to store the names of each check
in the respective registerXXXChecker method.

Reviewers: jordan_rose, krememek

Reviewed By: jordan_rose

CC: cfe-commits

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

llvm-svn: 201186
2014-02-11 21:49:21 +00:00
David Majnemer 86c318f496 MS ABI: Add support for the -vm{b,g,s,m,v} flags
These flags control the inheritance model initially used by the
translation unit.

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

llvm-svn: 201175
2014-02-11 21:05:00 +00:00
Dmitri Gribenko 2228cd3f07 Rename some PCH-related errors to have 'err_' as their prefix
llvm-svn: 201157
2014-02-11 15:40:09 +00:00
Alexey Samsonov c30e0c1728 Fix self-hosted -Werror build: delete comma at the end of enumerator list
llvm-svn: 201135
2014-02-11 08:07:54 +00:00
Jordan Rose 8b808d64af [analyzer] Inline C++ operator new when c++-inline-allocators is turned on.
This will let us stage in the modeling of operator new. The -analyzer-config
opton 'c++-inline-allocators' is currently off by default.

Patch by Karthik Bhat!

llvm-svn: 201122
2014-02-11 02:21:06 +00:00
Josh Magee e0fc1a80cb [stackprotector] Add command line option -fstack-protector-strong
This option has the following effects:
 * It adds the sspstrong IR attribute to each function within the CU.
 * It defines the macro __SSP_STRONG__ with the value of 2.

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

llvm-svn: 201120
2014-02-11 01:35:14 +00:00
David Majnemer 4bb0980d96 MS ABI: Add support for #pragma pointers_to_members
Introduce a notion of a 'current representation method' for
pointers-to-members.

When starting out, this is set to 'best case' (representation method is
chosen by examining the class, selecting the smallest representation
that would work given the class definition or lack thereof).

This pragma allows the translation unit to dictate exactly what
representation to use, similar to how the inheritance model keywords
operate.

N.B.  PCH support is forthcoming.

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

llvm-svn: 201105
2014-02-10 19:50:15 +00:00
David Majnemer 8896981056 Basic: Clean up malformed pragma diagnostics
Create a new diagnostic, -Wignored-pragmas and use it to handle any
case where a pragma would have a side effect but is ignored.

llvm-svn: 201102
2014-02-10 19:06:37 +00:00
David Blaikie 6cab596218 Improve diagnostic for using non-class/namespace/scoped enum in a nested name specifier.
Rather than simply saying "X is not a class or namespace", clarify what
X is by providing the aka type in the case where X is a type, or
pointing to the named declaration if there's an unambiguous one to refer
to. In the ambiguous case, the ambiguities are already enumerated
(though could be clarified by describing what kind of entities they are)

Included a few FIXMEs in tests where some further improvements could be
made.

llvm-svn: 201038
2014-02-09 06:54:23 +00:00
Richard Smith 6056d5e918 PR16519, PR18009: When checking a partial specialization for uses of its own
template parameters, don't look for parameters of outer templates. If a problem
is found in a default template argument, point the diagnostic at the partial
specialization (with a note pointing at the default argument) instead of
pointing it at the default argument and leaving it unclear which partial
specialization os problematic.

llvm-svn: 201031
2014-02-09 00:54:43 +00:00
Reid Kleckner 18066822a8 clang-cl: Alias /Zi and /Z7 to -gline-tables-only
LLVM only knows how to emit Z7-style line tables on -win32, so there's
no reason for clang to emit anything other than line info.

llvm-svn: 201017
2014-02-08 01:43:16 +00:00
John McCall 8f80a61914 Remove the -fhidden-weak-vtables -cc1 option. It was dead,
gross, and increasingly replaced through other mechanisms.

llvm-svn: 201011
2014-02-08 00:41:16 +00:00
Dmitri Gribenko c444b57790 ASTUnit: remove dead code in remapping files
ASTUnit contains code to remap files to other files on disk.  This code is not
used.  We only remap files to MemoryBuffers.

llvm-svn: 201010
2014-02-08 00:38:15 +00:00
Ben Langmuir 3d4417c7fd Stat system dependencies when using -verify-pch
We don't stat the system headers to check for stalenes during regular
PCH loading for performance reasons.  When explicitly saying
-verify-pch, we want to check all the dependencies - user or system.

llvm-svn: 200979
2014-02-07 17:31:11 +00:00
Dmitri Gribenko 2febd212d3 ASTUnit: ArrayRef'ize RemappedFiles
llvm-svn: 200975
2014-02-07 15:00:22 +00:00
Dmitri Gribenko 97b711a23f Document return value for FileManager::getNoncachedStatValue()
llvm-svn: 200967
2014-02-07 09:31:00 +00:00
Argyrios Kyrtzidis 25f2afdee0 Revert r194097: "With this patch -Wwrite-strings is still implemented with the terrible
hack of passing -fconst-strings to -cc1"

Passing or not a language option based on diagnostic settings is a bad idea, it breaks
using a PCH that was compiled with different diagnostic settings.

Also add a test case to make sure we don't regress.

llvm-svn: 200964
2014-02-07 08:33:28 +00:00
Peter Collingbourne 1fec3dfe43 Add isListInitialization matcher.
Differential Revision: http://llvm-reviews.chandlerc.com/D2708

llvm-svn: 200949
2014-02-06 21:52:24 +00:00
Richard Smith 3d584b0ced PR18128: a lambda capture-default is not permitted for a non-local lambda
expression.

llvm-svn: 200948
2014-02-06 21:49:08 +00:00
Ben Langmuir 9b9a8d330c Move -verify-pch to use VerifyJobAction
Use the verify hook rather than the compile hook to represent the
-verify-pch action, and move the exising --verify-debug-info action
into its own subclass of VerifyJobAction.  Incidentally change the name
printed by -ccc-print-phases for --verify-debug-info.

llvm-svn: 200938
2014-02-06 18:53:25 +00:00
Quentin Colombet 728c5540ee Wired-up the new LLVM diagnostic system into clang diagnostic system.
The approach is similar to the existing inline-asm reporting, just more
general.

<rdar://problem/15886278>

llvm-svn: 200931
2014-02-06 18:30:43 +00:00
Richard Smith 18819307d3 DR101, PR12770: If a function is declared in the same context as a
using-declaration, and they declare the same function (either because
the using-declaration is in the same namespace as the declaration it
imports, or because they're both extern "C"), they do not conflict.

llvm-svn: 200897
2014-02-06 01:31:33 +00:00
Ben Langmuir 2cb4a78f93 Add a CC1 option -verify-pch
This option will:
- load the given pch file
- verify it is not out of date by stat'ing dependencies, and
- return 0 on success and non-zero on error

llvm-svn: 200884
2014-02-05 22:21:15 +00:00
Benjamin Kramer c24767b4ad Clean up some particularly ugly casting.
No functionality change.

llvm-svn: 200877
2014-02-05 21:29:05 +00:00
Reid Kleckner 96f8f9339d MS ABI: Mangle member pointer template arguments
Member pointers are mangled as they would be represented at runtime.
They can be a single integer literal, single decl, or a tuple with some
more numbers tossed in.  With Clang today, most of those numbers will be
zero because we reject pointers to members of virtual bases.

This change required moving VTableContextBase ownership from
CodeGenVTables to ASTContext, because mangling now depends on vtable
layout.

I also hoisted the inheritance model helpers up to be inline static
methods of MSInheritanceAttr.  This makes the AST code that deals with
member pointers much more readable.

MSVC doesn't appear to have stable manglings of null member pointers:
- Null data memptrs in function templates have a mangling collision with
  the first field of a non-polymorphic single inheritance class.
- The mangling of null data memptrs changes if you add casts.
- Large null function memptrs in class templates crash MSVC.

Clang uses the class template mangling for null data memptrs and the
function template mangling for null function memptrs to deal with this.

Reviewers: majnemer

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

llvm-svn: 200857
2014-02-05 17:27:08 +00:00
Fariborz Jahanian 48f9ab2d54 Objective-C driver. Do not use legacy dispatch for
10.5 or less for x86_64 arch. // rdar://15852259

llvm-svn: 200854
2014-02-05 17:13:42 +00:00
Alexander Kornienko 9b539e1dd9 Added the hasLoopVariable sub-matcher for forRangeStmt.
Summary:
This sub-matcher makes it possible to access directly the range-based for
loop variable: forRangeStmt(hasLoopVariable(anything()).bind(...)).
I've tried to re-generate the docs, but the diffs seem to include much more than
this change could cause, so I'd better leave docs update to someone who knows
the intended changes in the contents better.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits, klimek

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

llvm-svn: 200850
2014-02-05 16:35:08 +00:00
John McCall 9b595db16d Tighten lax vector-conversion rules and enforce them consistently.
When a lax conversion featured a vector and a non-vector, we were
only requiring the non-vector to be a scalar type, but really it
needs to be a real type (i.e. integral or real floating); it is
not reasonable to allow a pointer, member pointer, or complex
type here.

r198474 required lax conversions to match in "data size", i.e.
element size * element count, forbidding matches that happen
only because a vector is rounded up to the nearest power of two
in size.  Unfortunately, the erroneous logic was repeated in
several different places; unify them to use the new condition,
so that it triggers for arbitrary conversions and not just
those performed as part of binary operator checking.

rdar://15931426

llvm-svn: 200810
2014-02-04 23:58:19 +00:00
Justin Bogner eacd96d972 Fix whitespace handling in empty macro arguments
When a function-like macro definition ends with one of the macro's
parameters, and the argument is empty, any whitespace before the
parameter name in the macro definition needs to be preserved. Promoting
the existing NextTokGetsSpace to a preserved bit-field and checking it
at the end of the macro expansion allows it to be moved to the first
token following the macro expansion result.

Patch by Harald van Dijk!

llvm-svn: 200786
2014-02-04 19:18:32 +00:00
Alexander Kornienko 7a712cea71 Allow specifying a custom PathDiagnosticConsumer for use with the static analyzer.
Summary:
Make objects returned by CreateAnalysisConsumer expose an interface,
that allows providing a custom PathDiagnosticConsumer, so that users can have
raw data in a form easily usable from the code (unlike plist/HTML in a file).

Reviewers: jordan_rose, krememek

CC: cfe-commits

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

llvm-svn: 200710
2014-02-03 18:37:50 +00:00
Richard Smith 91dfaacd38 Implement DR329. We already did the right thing here in C++98 mode, but r104014
(which implemented the DR) was disabled in C++11.

llvm-svn: 200673
2014-02-03 02:37:59 +00:00
Nico Weber 514ecc8ce8 clang-format: Let chromium style inherit google style's javascript tweaks.
llvm-svn: 200652
2014-02-02 20:50:45 +00:00
Reid Kleckner 314ef7bafd [ms-cxxabi] Use inalloca on win32 when passing non-trivial C++ objects
When a non-trivial parameter is present, clang now gathers up all the
parameters that lack inreg and puts them into a packed struct.  MSVC
always aligns each parameter to 4 bytes and no more, so this is a pretty
simple struct to lay out.

On win64, non-trivial records are passed indirectly.  Prior to this
change, clang was incorrectly using byval on win64.

I'm able to self-host a working clang with this change and additional
LLVM patches.

Reviewers: rsmith

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

llvm-svn: 200597
2014-02-01 00:04:45 +00:00
Reid Kleckner 4982b82b73 [ms-cxxabi] Use x86_cdeclmethodcc for __cdecl methods on win32
This fixes PR15768, where the sret parameter and the 'this' parameter
are in the wrong order.

Instance methods compiled by MSVC never return records in registers,
they always return indirectly through an sret pointer.  That sret
pointer always comes after the 'this' parameter, for both __cdecl and
__thiscall methods.

Unfortunately, the same is true for other calling conventions, so we'll
have to change the overall approach here relatively soon.

Reviewers: rsmith

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

llvm-svn: 200587
2014-01-31 22:54:50 +00:00
Richard Smith 67294e253e Track the currently-being-built submodule inside the preprocessor (rather than
just storing a flag indicating if there was one), and include it in the 'end of
module' annotation. No functionality change.

llvm-svn: 200573
2014-01-31 20:47:44 +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
Tim Northover c322f838bc ARM & AArch64: share the BI__builtin_neon enum defs.
llvm-svn: 200470
2014-01-30 14:47:51 +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
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
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
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
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
Richard Smith 2e87e14490 Remove dead code; MacroDirective's IsHidden flag is always false.
llvm-svn: 200265
2014-01-27 23:54:39 +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
Richard Smith 340e44074b Remove dead code.
llvm-svn: 200251
2014-01-27 22:08:43 +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
Alp Toker 0d865d3d7b Roll back the use of ConstStringRef for now
We might want try a different strategy so hold back on this for the moment, but
fix the off-by-one error in the original function template.

This reverts commit r200190.

llvm-svn: 200193
2014-01-27 05:21:24 +00:00
Alp Toker a80501742c Use ConstStringRef facility for getCustomDiagID() safety
This is one of various functions in clang that don't handle arbitrary strings
well and can benefit from compile-time safety checks.

Also fixes an off-by-one error that caused one additional null byte to get
added to the end of custom diagnostic descriptions. ConstStringRef handles
tricky details like that for us now.

Requires supporting changes in LLVM r200187.

llvm-svn: 200190
2014-01-27 04:22:22 +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 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
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
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
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
Amara Emerson 05d816d0e2 [AArch64] Replace underscores with dashes in -mgeneral_regs_only.
This should now match the equivalent gcc option.

llvm-svn: 200008
2014-01-24 15:15:27 +00:00
Aaron Ballman cc396f85d9 Adding a new diagnostics group (-Wattributes) which covers both UnknownAttributes and IgnoredAttributes.
llvm-svn: 200004
2014-01-24 14:16:23 +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
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
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 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
DeLesley Hutchins 8a7117d4c8 Thread safety analysis: handle duplicate assert_lock attributes.
llvm-svn: 199949
2014-01-23 22:35:26 +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
Hans Wennborg 80429048db clang-cl: Expose the -ferror-limit= option
llvm-svn: 199828
2014-01-22 20:06:53 +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
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
Hans Wennborg a6ae1209df clang-cl: make /Zp a Joined option (PR18503)
We don't currently support this option, but we should be able to parse it.

llvm-svn: 199787
2014-01-22 03:23:35 +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
Fariborz Jahanian bbf322b0bb ObjectiveC driver. change to reinstate -fno-objc-legacy-dispatch behavior
when the deployment target is 10.5. // rdar://15852259

llvm-svn: 199780
2014-01-22 00:43:54 +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
David Woodhouse 6996f6b9ec Add -m16 option for using x86-*-*-code16 triple
llvm-svn: 199754
2014-01-21 17:19:44 +00:00
Nick Lewycky 36e9b3ccff Neither attribute overloadable nor enable_if are supported by GCC. Disable the
GCC warning about attributes on function definitions for both of them.

llvm-svn: 199710
2014-01-21 04:31:12 +00:00
Alp Toker b3fd5cfa81 Update FunctionTypeLoc and related names to match r199686
llvm-svn: 199699
2014-01-21 00:32:38 +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
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
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 fc1951c505 Making some minor improvements to r199626.
llvm-svn: 199663
2014-01-20 14:19:44 +00:00
Aaron Ballman 9e013515aa HasFunctionProto is a more strict version of FunctionLike. Since attribute subjects are inclusive (passing a single subject test means no subject-related diagnostic will fire), these two subjects should not be combined.
llvm-svn: 199662
2014-01-20 14:18:40 +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
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
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
Alp Toker 1c79b3d486 Make unreferenced f-group options anonymous
These were showing up with find-unused-options.sh

llvm-svn: 199560
2014-01-18 20:45:14 +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
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 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 81541c561c Add ArrayRef<> interface to get the formal parameters of a BlockDecl.
llvm-svn: 199471
2014-01-17 07:15:26 +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 07e4a66306 Add ArrayRef<> interface to get the parameters of a FunctionDecl/ObjCMethodDecl.
This is an alternate interface to the separate iterator interfaces
provided by FunctionDecl and ObjCMethodDecl, which precede ArrayRef.

Providing this new interface is more convenient for some uses, and
likely the old interfaces should be removed.  I have not undertaken
that effort in this change because this API introduction may
solicit commentary and that was a larger change than I wanted
to introduce all at once to serve a direct purpose.

llvm-svn: 199466
2014-01-17 06:24:50 +00:00
Ted Kremenek 2bc7333a06 Make 'CheckNonNullArguments' a static function. No functionality change.
llvm-svn: 199464
2014-01-17 06:24:43 +00:00
Ted Kremenek 4997b21a80 Refine diagnostic: attribute 'nonnull' applies to both functions and methods.
llvm-svn: 199460
2014-01-17 04:58:29 +00:00
Alp Toker 9609d30db6 Kill off obsolete err_target_unknown_cxxabi diag
Unused since r199250.

llvm-svn: 199459
2014-01-17 04:23:58 +00:00
Alp Toker 581f6f1dfc Make -cl-kernel-arg-info a cc1-only option like the others
The driver wasn't doing anything with it. Also rephrase the help text.

llvm-svn: 199458
2014-01-17 04:19:59 +00:00
Alp Toker 810940f3ec Make -verify a -cc1 NoDriverOption
'%clang -verify' will now issue an error instead of succeeding without
verification. This should catch flawed tests like r199347.

Followup to r199451.

llvm-svn: 199455
2014-01-17 03:21:54 +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
Richard Smith 3dd73db411 Move away from 'general' / 'generalized' as a way of identifying C++11
attribute syntax. There's nothing generalized about this; it's one of
several first-class attribute syntaxes we support, all of which are
more-or-less equally general.

As discussed on cfe-commits, we may want to revisit this if we start allowing
this syntax as an extension in C (or if C adopts the syntax), but hopefully
this diagnostic wording will be crystal clear to everyone in the mean time.

llvm-svn: 199443
2014-01-17 00:11:48 +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
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
Aaron Ballman e3a16be52e Giving a spelling to the Override attribute, and commenting on the absence of a spelling for a few implicitly-only attributes. No functional change intended.
llvm-svn: 199410
2014-01-16 19:00:04 +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 95755d6d05 Giving the asm attribute some keyword spellings based off of GCC's documentation. No functional changes.
llvm-svn: 199382
2014-01-16 13:45:57 +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
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
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
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
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
Fariborz Jahanian bae1bcb6bf ObjectiveC. Improve on diagnostics per Jordan's feedback.
llvm-svn: 199278
2014-01-15 00:59:25 +00:00
Tim Northover 9778348172 Driver: clarify help string for "-###"
Someone recently wasted some time not realising that "-###" didn't
actually execute the commands it printed, and suggested a
documentation tweak.

Having made the same mistake myself on at least one occasion, I
sympathise. So here it is. Any kibitzing on an even better text
welcome.

llvm-svn: 199256
2014-01-14 20:49:19 +00:00
Fariborz Jahanian 2ea30fb9b0 ObjectiveC. produce more expressive warning when
-Wselector detects an unimplemented method used
in an @selector expression. // rdar://15781538

llvm-svn: 199255
2014-01-14 20:35:13 +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
Tim Northover 8799445065 Darwin: add __sinpi (etc) and __exp10 libbuiltins
These functions have the same constness properties of the normal libm
functions, which allows LLVM to optimise code better in general. There
are also a couple of specific optimisations that only trigger when
these are properly marked.

rdar://problem/13729466

llvm-svn: 199249
2014-01-14 19:26:03 +00:00
Alp Toker fe71d6a384 Clarify driver/frontend -fms-compatibility help text
Better describe the flag that enables drop-in MSVC compatibility, including
ability to parse MS standard headers. This is intended to distinguish it from
-fms-extensions, the more established and 'gentler' flag also supported by GCC.

The new wording matches up with the internal description introduced in r198936.
Still room for improvement (e.g. C++ is part of the product name, yet the flag
also applies to C) but it's a step forward from "Microsoft mode".

llvm-svn: 199247
2014-01-14 19:13:00 +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
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
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
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
Aaron Ballman 530740be50 Updating the attribute declarations to have the correct syntaxes. This means giving a __declspec spelling to: deprecated, naked, noinline, noreturn, and nothrow. uuid has no GNU spelling, so it was switched to __declspec. dllexport and dllimport both are now supported with GNU spellings.
llvm-svn: 199142
2014-01-13 21:32:48 +00:00
Jordan Rose c9176072e6 [analyzer] Add a CFG node for the allocator call in a C++ 'new' expression.
In an expression like "new (a, b) Foo(x, y)", two things happen:
- Memory is allocated by calling a function named 'operator new'.
- The memory is initialized using the constructor for 'Foo'.

Currently the analyzer only models the second event, though it has special
cases for both the default and placement forms of operator new. This patch
is the first step towards properly modeling both events: it changes the CFG
so that the above expression now generates the following elements.

1. a
2. b
3. (CFGNewAllocator)
4. x
5. y
6. Foo::Foo

The analyzer currently ignores the CFGNewAllocator element, but the next
step is to treat that as a call like any other.

The CFGNewAllocator element is not added to the CFG for analysis-based
warnings, since none of them take advantage of it yet.

llvm-svn: 199123
2014-01-13 17:59:19 +00:00
Chandler Carruth 2192505190 [PM] Update Clang to reflect LLVM r199095 which moves the core DomTree
algorithms and datastructures into the fully generic support library,
separating them (almost) entirely from the LLVM IR. This makes the
reliance on domtrees here *much* cleaner.

It might be worthwhile for someone to use extern templates and other
tools to sink a lot more of this code into the .cpp files instead of the
.h files, but leaving that for someone other than me.

llvm-svn: 199096
2014-01-13 10:56:17 +00:00
Chandler Carruth ca88474aba [cleanup] Update the include of Dominators.h to reflect its move to the
IR library in LLVM r199082.

llvm-svn: 199083
2014-01-13 09:26:48 +00:00
Nico Weber 0e224700de Add help text for -MMD, -MD, -MM, -M, -MF.
Also regroup these flags so that alike flags are next to each other, while
keeping the list still mostly alphabetical.

The help text isn't ideal, but I feel it's less maze-like than
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Preprocessor-Options.html (look
at the entry for '-MMD' and count how many other entries you need to look up
until you know what it does).

And it looks like -M / -MM are mostly an historical accident and most people
use -MD or -MMD for deps tracking these days, so make -M / -MM refer to
-MD / -MMD instead of the other way round.

llvm-svn: 199067
2014-01-12 23:12:35 +00:00
Alp Toker 44e3905987 Clarify warn_cxx98_compat_attribute diagnostic
Various attribute flavours are supported in C++98. Make it clear that this
compatibility warning relates specifically to C++11-style generalized
attributes.

llvm-svn: 199053
2014-01-12 15:18:06 +00:00
Nick Lewycky 35a6ef4c35 Add a new attribute 'enable_if' which can be used to control overload resolution based on the values of the function arguments at the call site.
llvm-svn: 198996
2014-01-11 02:50:57 +00:00
Richard Smith 6fa28ffd5a Fix "regression" caused by updating our notion of POD to better match the C++11
rules: instead of requiring flexible array members to be POD, require them to
be trivially-destructible. This seems to be the only constraint that actually
matters here (and even then, it's questionable whether this matters).

llvm-svn: 198983
2014-01-11 00:53:35 +00:00
Fariborz Jahanian 26cb6d90b8 ObjectiveC. Remove warning on mismatched methods
which may belong to unrelated classes. It was
primarily intended for miuse of @selector expression.
But warning is too noisy and will be issued when
an actual @selector is used. // rdar://15740134

llvm-svn: 198952
2014-01-10 19:27:21 +00:00
Alp Toker 9f1d619c07 Remove unexpected code completion handling from ConsumeToken()
With this change tok::code_completion is finally handled exclusively as a
special token kind like other tokens that need special treatment.

All callers have been updated to use the specific token consumption methods and
the parser has a clear idea the current token isn't special by the time
ConsumeToken() gets called, so this has been unreachable for some time.

ConsumeAnyToken() behaviour is unchanged and will continue to support
unexpected code completion as part of the special token path.

This survived an amount of fuzzing and validation, but please ping the list if
you hit a code path that previously relied on the old unexpected handler and
now asserts.

llvm-svn: 198942
2014-01-10 14:37:02 +00:00
Alp Toker b630b9d20a Update LangOpt descriptions
Based on recent discussions, attempt to provide a clearer distinction between
MicrosoftMode and MicrosoftExt. This still doesn't feel perfect but gives a
better idea which is which.

Also update the CPlusPlus11 description which got missed in r171367.

C++0x is dead, long live C++0x!

llvm-svn: 198936
2014-01-10 11:19:45 +00:00
Fariborz Jahanian 65b1377911 ObjectiveC. 1) Warn when @dynamic (as well as synthesize)
property has the naming convention that implies 'ownership'.
2) improve on diagnostic and make it property specific.
3) fix the line number in the case of default property
synthesis. // rdar://15757510

llvm-svn: 198905
2014-01-10 00:53:48 +00:00
Richard Smith 7073a2da15 Reapply r198845, reverted in r198849, with a fix to make it valid C++98, not
just valid C++11 =)

Original commit message:

PR18427: Use an appropriately-aligned buffer in APValue, to avoid a crash on
SPARC, where uint64_t apparently requires higher alignment than void*.

llvm-svn: 198903
2014-01-10 00:40:45 +00:00
Aaron Ballman ab7691c4ce Removing the notion of TargetAttributesSema and replacing it with one where the parsed attributes are responsible for knowing their target-specific nature, instead of letting Sema figure it out. This is necessary so that __has_attribute can eventually determine whether a parsed attribute applies to the given target or not.
llvm-svn: 198896
2014-01-09 22:48:32 +00:00
Ben Langmuir de04923344 Preserve -fretain-comments-from-system-headers in modules
Preserves the setting of -fretain-comments-from-system-headers when
building/saving/loading module files. This allows code completion to pick up
documentation comments from system modules.

llvm-svn: 198890
2014-01-09 20:53:49 +00:00
Aaron Ballman 15b27b97b7 Removing a bit of custom parsing functionality used by the thread safety analysis APIs. Now using tablegen to determine whether an attribute's arguments should be parsed in an unevaluated context instead of relying on a separate, hard-coded list of attributes.
llvm-svn: 198883
2014-01-09 19:39:35 +00:00
Argyrios Kyrtzidis 62a85daecd Revert "PR18427: Use an appropriately-aligned buffer in APValue, to avoid a crash on"
It broke building.
This reverts commit r198845.

llvm-svn: 198849
2014-01-09 05:01:04 +00:00
Richard Smith e2f4a2744c PR18427: Use an appropriately-aligned buffer in APValue, to avoid a crash on
SPARC, where uint64_t apparently requires higher alignment than void*.

llvm-svn: 198845
2014-01-09 03:29:54 +00:00
Chandler Carruth 439991d7e3 Update Clang's CFGBlock interface to conform to the strange part of
LLVM's Value interface which is used in LLVM's DominatorTree analysis
and which changed in LLVM r198836.

The DominatorTree analysis is actually a generic graph analysis and
should be moved to LLVM's support library to clarify that Clang and
others are using it with arbitrary graphs. Further, it seems likely that
it should be using something other than printAsOperand, but this is
a simpler build fix. I'll clean this up later.

llvm-svn: 198840
2014-01-09 02:56:16 +00:00
Richard Smith 83b11aae18 PR18401: Fix assert by implementing the current proposed direction of core
issue 1430. Don't allow a pack expansion to be used as an argument to an alias
template unless the corresponding parameter is a parameter pack.

llvm-svn: 198833
2014-01-09 02:22:22 +00:00
Warren Hunt d640d7d96e [ms-abi] Refactor Microsoft Record Layout
This patch refactors microsoft record layout to be more "natural".  The 
most dominant change is that vbptrs and vfptrs are injected after the 
fact.  This simplifies the implementation and the math for the offest 
for the first base/field after the vbptr.

llvm-svn: 198818
2014-01-09 00:30:56 +00:00
Aaron Ballman 8c7817ebb1 Attempting a fix the build bots should be happier with. Amends 198804.
llvm-svn: 198805
2014-01-08 23:26:53 +00:00
Aaron Ballman 199a78935e Silencing an MSVC warning about control reaching the end of a non-void function.
llvm-svn: 198804
2014-01-08 23:08:41 +00:00
Argyrios Kyrtzidis 9308f0ae80 [Serialization] In ASTReader::getInputFile record it when we didn't find the file to avoid looking it up again.
Hopefully addresses rdar://14514222.

llvm-svn: 198781
2014-01-08 19:13:34 +00:00
Aaron Ballman b8c0adeac8 Treating the RegParmAttr as a TypeAttr because that is what it is.
Patch reviewed by Rafael Espindola.

llvm-svn: 198765
2014-01-08 13:23:01 +00:00
Richard Smith 8bcc086e58 PR18400: ignore cv-qualifiers on the underlying type of an enumeration.
llvm-svn: 198723
2014-01-08 01:16:19 +00:00
Richard Smith 649c7b069f PR18234: Mark a tag definition as invalid early if it appears in a
type-specifier in C++. Some checks will assert in this case otherwise (in
particular, the access specifier may be missing if this happens inside a class
definition, due to a violation of an AST invariant).

llvm-svn: 198721
2014-01-08 00:56:48 +00:00
Jordan Rose 514f935411 [analyzer] Pointers escape into +[NSValue valueWithPointer:]...
...even though the argument is declared "const void *", because this is
just a way to pass pointers around as objects. (Though NSData is often
a better one.)

PR18262

llvm-svn: 198710
2014-01-07 21:39:48 +00:00
Jordan Rose 6ad4cb4eca [analyzer] Remove unused ARCNotOwnedSymbol retain count return effect.
RetainCountChecker has to track returned object values to know if they are
retained or not. Under ARC, even methods that return +1 are tracked by the
system and should be treated as +0. However, this effect behaves exactly
like NotOwned(ObjC), i.e. a generic Objective-C method that actually returns
+0, so we don't need a special case for it.

No functionality change.

llvm-svn: 198709
2014-01-07 21:39:41 +00:00
Nico Weber b00d66e6ac Shorten the output of `clang-format --version`, include revision number.
Before:
  $ clang-format  --version
  LLVM (http://llvm.org/):
    LLVM version 3.5svn
    Optimized build with assertions.
    Built Jan  3 2014 (14:28:46).
    Default target: x86_64-apple-darwin13.0.0
    Host CPU: core-avx-i

Now:
  $ bin/clang-format --version
  clang-format version 3.5 (198452)

llvm-svn: 198694
2014-01-07 16:27:35 +00:00
Chandler Carruth 5553d0d4ca Sort all the #include lines with LLVM's utils/sort_includes.py which
encodes the canonical rules for LLVM's style. I noticed this had drifted
quite a bit when cleaning up LLVM, so wanted to clean up Clang as well.

llvm-svn: 198686
2014-01-07 11:51:46 +00:00
Argyrios Kyrtzidis d07dcdb958 For areVectorOperandsLaxBitCastable(), only return false if both opearands are vector types
and add a diagnostic when the operand is a vector and non-scalar value.

rdar://15722301

llvm-svn: 198680
2014-01-07 07:59:31 +00:00
Alp Toker f990cefc7e Bring back magic constants in the digraph diagnostic
This backs out changes in commit r198605 and part of r198604, replacing the
original tok::kw_template with a slightly more obvious placeholder
tok::unknown.

llvm-svn: 198666
2014-01-07 02:35:33 +00:00
Adrian Prantl a763447124 Implement a new -fstandalone-debug option. rdar://problem/15685848
It controls everything that -flimit-debug-info used to, plus the
vtable type optimization. The old -fno-limit-debug-info option is now an
alias to -fstandalone-debug and vice versa.

Standalone is the default on Darwin until dtrace is updated to work with
non-standalone debug info (rdar://problem/15758808).

Note: I kept the LimitedDebugInfo name in CodeGenOptions::DebugInfoKind
because NoStandaloneDebugInfo sounded even more confusing.

llvm-svn: 198655
2014-01-07 01:19:08 +00:00
Justin Bogner 6a9d2cfadd Driver: Accept -fprofile-instr-use and -fprofile-instr-generate
These flags will be used for instrumentation based PGO.

llvm-svn: 198639
2014-01-06 22:27:36 +00:00
Alp Toker b3f9501b25 Prospective MSVC 2010 build fix
Try to fix Compiler Error C2011 following r198607 by removing enum from 'enum
TokenKind' parameter types.

llvm-svn: 198621
2014-01-06 15:52:13 +00:00
Alp Toker e9ab39da86 Correct underlying integer type of enum TokenKind
This matches up the underlying type against the actual storage type 'unsigned
short' and lets us get rid of some casts while we're at it.

Effort is made to keep this building in pre-C++11 but as with other features
Token will be less efficiently packed in in legacy configurations.

llvm-svn: 198607
2014-01-06 12:54:51 +00:00
Alp Toker 01d65e1387 Simplify diagnostic tag type using the token kind formatter
As far as the parser is concerned the tag type is always a keyword.

llvm-svn: 198606
2014-01-06 12:54:41 +00:00
Alp Toker addd3669d4 Don't use magic constants in the digraph diagnostic
llvm-svn: 198605
2014-01-06 12:54:32 +00:00
Alp Toker a231ad2216 Support diagnostic formatting of keyword tokens
Implemented with a new getKeywordSpelling() accessor. Unlike getTokenName() the
result of this function is stable and may be used in diagnostic output.

Uses of this feature are split out into the subsequent commit.

llvm-svn: 198604
2014-01-06 12:54:18 +00:00
Alp Toker 6d35eab5a6 Rename getTokenSimpleSpelling() to getPunctuatorSpelling()
That's what it does, what the documentation says it does and what callers
expect it to do.

llvm-svn: 198603
2014-01-06 12:54:07 +00:00
Alp Toker b9fa512954 Highlight the previous underlying enum type when diagnosing a mismatch
enum-scoped.cpp:93:6: error: enumeration redeclared with different underlying type 'short' (was 'int')
  enum Redeclare6 : short;
       ^
enum-scoped.cpp:92:6: note: previous declaration is here
  enum Redeclare6 : int;
       ^            ~~~

The redeclaration source range is still missing but this is a step forward,
potentially edging towards a FixIt.

llvm-svn: 198601
2014-01-06 11:31:18 +00:00
Alp Toker 6e97a69200 Use token kind instead of '%select{.|->}0' in diagnostic
llvm-svn: 198599
2014-01-06 11:30:41 +00:00
Alp Toker 637b347ed0 Apply some LLVM_READONLY / LLVM_READNONE on diagnostic functions
llvm-svn: 198598
2014-01-06 11:30:15 +00:00
Joey Gouly 16cb99dd15 [OpenCL] Produce an error if an address space is used on the return
type of a function.

llvm-svn: 198597
2014-01-06 11:26:18 +00:00
Alp Toker ef6b007dc5 Only mark dump() function definitions 'used' in debug builds
This has the dual effect of (1) enabling more dead-stripping in release builds
and (2) ensuring that debug helper functions aren't stripped away in debug
builds, as they're intended to be called from the debugger.

Note that the attribute is applied to definitions rather than declarations in
headers going forward because it's now conditional on NDEBUG:

  /// \brief Mark debug helper function definitions like dump() that should not be
  /// stripped from debug builds.

Requires corresponding macro added in LLVM r198456.

llvm-svn: 198489
2014-01-04 13:47:14 +00:00
Reid Kleckner 5f08094106 [ms-cxxabi] Improve vbtable name mangling accuracy
Summary:
This makes us more compatible with MSVC 2012+ and fixes PR17748 where we
would give two tables the same name.

Rather than doing a fresh depth-first traversal of the inheritance graph
for every record's vbtables, now we memoize vbtable paths for each
record.  By doing memoization, we end up considering virtual bases of
subobjects that come later in the depth-first traversal.  Where
previously we would have ignored a virtual base that we'd already seen,
we now consider it for name mangling purposes without emitting a
duplicate vbtable for it.

Reviewers: majnemer

CC: cfe-commits

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

llvm-svn: 198462
2014-01-03 23:42:00 +00:00
Aaron Ballman 69714e78e0 Refactored Builtin::Context::isPrintfLike and isScanfLike into a helper function. The implementations are identical, except for the format arguments being searched for.
No functional changes intended.

llvm-svn: 198446
2014-01-03 20:10:54 +00:00
Aaron Ballman 1d17bde708 Marked the default constructor as an LLVM_DELETED_FUNCTION.
llvm-svn: 198435
2014-01-03 18:51:47 +00:00
Aaron Ballman 75ee4cc830 Removed one of the string versions of getQualifiedNameAsString, and switched over to using printQualifiedName where possible. No functional changes intended.
llvm-svn: 198433
2014-01-03 18:42:48 +00:00
Argyrios Kyrtzidis 2080d90f37 [objc] Refactor and improve functionality for the -Wunused-property-ivar warning.
- Remove the additions to ObjCMethodDecl & ObjCIVarDecl that were getting de/serialized and consolidate
  all functionality for the checking for this warning in Sema::DiagnoseUnusedBackingIvarInAccessor
- Don't check immediately after the method body is finished, check when the @implementation is finished.
  This is so we can see if the ivar was referenced by any other method, even if the method was defined after the accessor.
- Don't silence the warning if any method is called from the accessor silence it if the accessor delegates to another method via self.

rdar://15727325

llvm-svn: 198432
2014-01-03 18:32:18 +00:00
Aaron Ballman 7cb6741b3b We haven't cared about VS 2005 in a long time, and VS 2003 in even longer.
llvm-svn: 198429
2014-01-03 18:10:25 +00:00
Aaron Ballman b190f974c9 Fixed a FIXME; created a print method for Selectors that accepts a raw_ostream, and started using it in places it made sense.
No functional changes intended, just API cleanliness.

llvm-svn: 198428
2014-01-03 17:59:55 +00:00
Alexander Kornienko 6de39492da Make clang::ento::CreateAnalysisConsumer a part of a public interface of the static analyzer.
Summary:
This allows for a better alternative to the FrontendAction hack used in
clang-tidy in order to get static analyzer's ASTConsumer.

Reviewers: jordan_rose, krememek

Reviewed By: jordan_rose

CC: cfe-commits

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

llvm-svn: 198426
2014-01-03 17:23:10 +00:00
Aaron Ballman b9bb201194 Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198420
2014-01-03 14:54:10 +00:00
Aaron Ballman 1fb3955cee Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198418
2014-01-03 14:23:03 +00:00
Joey Gouly 96b94e610b [OpenCL] Variables in the constant address space must be initialized.
llvm-svn: 198417
2014-01-03 14:16:55 +00:00
Aaron Ballman 5dff61d322 Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198416
2014-01-03 14:06:37 +00:00
Aaron Ballman fee0cd45fe Removing some more unnecessary manual quotes from diagnostics. Updated the related test case to ensure correctness.
llvm-svn: 198412
2014-01-03 13:34:55 +00:00
Aaron Ballman 6d086d7dc1 Removing some more unnecessary manual quotes from diagnostics.
llvm-svn: 198395
2014-01-03 02:20:27 +00:00
Aaron Ballman 25dc1e1d19 Removing some more unnecessary manual quotes from attribute diagnostics.
llvm-svn: 198392
2014-01-03 02:14:08 +00:00
Aaron Ballman c0550740f0 Removing some more unnecessary manual quotes from attribute diagnostics.
llvm-svn: 198391
2014-01-03 02:07:43 +00:00
Aaron Ballman 1bda4596b6 Removing some more unnecessary manual quotes from attribute diagnostics.
llvm-svn: 198387
2014-01-03 01:09:27 +00:00
Reid Kleckner b40a27dad8 [ms-cxxabi] Move VBTableBuilder from CodeGen over to AST/VTableBuilder.cpp
Summary:
No functionality change.

This code should live here long-term because we should be able to use it
to compute correct vftable names.

It turns out that the most natural way to implement the naming algorithm
is to use a caching layer similar to what we already have for virtual
table info in VTableContext.  Subsequent changes will take advantage of
this to fix PR17748, where we have a vbtable name collision.

Reviewers: majnemer

CC: cfe-commits

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

llvm-svn: 198380
2014-01-03 00:14:35 +00:00
Aaron Ballman 3d216a579c Removed an unnecessary %select from the alignas diagnostics. The attribute already knows how it was spelled.
llvm-svn: 198375
2014-01-02 23:39:11 +00:00
Aaron Ballman e2bb78a740 This diagnostic should not have had the manual quotation marks. Its only usage passed in an Attr object, which was already quoted when printing the diagnostic. However, there was no test case that caught this bug -- one has been added.
llvm-svn: 198373
2014-01-02 23:22:40 +00:00
Aaron Ballman 1da282ae2d Removing some more unnecessary manual quotes from attribute diagnostics. Updated the associated testcase because QualType pretty printing was an improvement.
llvm-svn: 198372
2014-01-02 23:15:58 +00:00
Aaron Ballman 9f6fec4419 Removing some more unnecessary manual quotes from attribute diagnostics.
llvm-svn: 198371
2014-01-02 23:02:01 +00:00
Aaron Ballman 34b3475cd3 Reworded the NSObject attribute diagnostics to be more consistent with other attribute diagnostics. Also updated the associated test case.
llvm-svn: 198368
2014-01-02 22:45:33 +00:00
Fariborz Jahanian 5b3105d2cb ObjectiveC. Remove false positive warning for missing property
backing ivar by not issuing this warning if ivar is referenced
somewhere and accessor makes method calls. // rdar://15727325

llvm-svn: 198367
2014-01-02 22:42:09 +00:00
Aaron Ballman 44ebc079b9 Removing some manual quotes from this diagnostic, since the AST diagnostics engine knows how to handle NamedDecl objects.
llvm-svn: 198365
2014-01-02 22:29:41 +00:00
Aaron Ballman 05e420abad Updated the wording of two attribute-related diagnostics so that they print the offending attribute name. Also updates the associated test cases.
llvm-svn: 198355
2014-01-02 21:26:14 +00:00
Alexander Kornienko ce9161a557 Added an option to avoid splitting certain kinds of comments into lines.
Summary: Added CommentPragmas option for this.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, klimek

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

llvm-svn: 198310
2014-01-02 15:13:14 +00:00
Alp Toker e83b9060cb Verify that clang TargetInfo descriptions match DataLayout strings from LLVM
The backend string is only verified when available as it's possible to run
clang IRGen for targets that haven't been built or don't exist in LLVM.

llvm-svn: 198309
2014-01-02 15:08:04 +00:00
Joey Gouly d4993032a9 [OpenCL] The kernel attribute can only be used on functions.
llvm-svn: 198300
2014-01-02 12:04:42 +00:00
Alp Toker 3ca9c86825 Remove an unused diag left over from r198046
llvm-svn: 198272
2014-01-01 06:07:48 +00:00
Alp Toker 95e7ff2ed1 Eliminate UnaryTypeTraitExpr
Remove UnaryTypeTraitExpr and switch all remaining type trait related handling
over to TypeTraitExpr.

The UTT/BTT/TT enum prefix and evaluation code is retained pending further
cleanup.

This is part of the ongoing work to unify type traits following the removal of
BinaryTypeTraitExpr in r197273.

llvm-svn: 198271
2014-01-01 05:57:51 +00:00
Alp Toker 383d2c478c ExpectAndConsume: Diagnose errors automatically
1) Teach ExpectAndConsume() to emit expected and expected-after diagnostics
    using the generic diagnostic descriptions added in r197972, eliminating another
    set of trivial err_expected_* variations while maintaining existing behaviour.

 2) Lift SkipUntil() recovery out of ExpectAndConsume(). The Expect/Consume
    family of functions are primitive parser operations that now have the
    well-defined property of operating on single tokens. Factoring out recovery
    exposes opportunities for more consistent and tailored error recover at the
    call sites instead of just relying on a bottled SkipUntil formula.

llvm-svn: 198270
2014-01-01 03:08:43 +00:00
Joey Gouly 4ba0f1e2d7 [OpenCL] Produce an error, instead of a warning, for sizeof(void) in OpenCL.
Patch by joey.gouly@arm.com

llvm-svn: 198264
2013-12-31 15:47:49 +00:00
Serge Pavlov 2e3ecb660a Recover from errors in enum definition
Previously any error in enum definition body stopped parsing it. With this
change parser tries to recover from errors.
The patch fixes PR10982.

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

llvm-svn: 198259
2013-12-31 06:26:03 +00:00
Alp Toker fceca50357 Silence g++ 4.9 build issue
lib/ASTMatchers/ASTMatchFinder.cpp:276:28: error: typedef 'traverse_can_only_be_instantiated_with_base_type' locally defined but not used [-Werror=unused-local-typedefs]
                            traverse_can_only_be_instantiated_with_base_type);

llvm-svn: 198256
2013-12-31 03:16:57 +00:00
DeLesley Hutchins bb79c338ed Update DataRecursiveASTVisitor so that it visits attributes.
llvm-svn: 198249
2013-12-30 21:03:02 +00:00
Nick Lewycky 00b9b695c4 Fix two typos in comments. No functionality change.
llvm-svn: 198243
2013-12-30 20:16:30 +00:00
Reid Kleckner 9e3bc72b8d Remove linkage macro from the CXLanguageKind enum
Enums don't have linkage, so clang warns when this expands to dllimport.

llvm-svn: 198227
2013-12-30 17:48:49 +00:00
DeLesley Hutchins c4a82438a7 Update RecursiveASTVisitor so that it visits attributes. This is currently
important for thread safety attributes, which contain expressions that were
not being visited, and were thus invisible to various tools.  There are now
Visit*Attr methods that can be overridden for every attribute.

llvm-svn: 198224
2013-12-30 17:24:36 +00:00
Alp Toker ba5b4dc60c Fix and reword some typos
llvm-svn: 198191
2013-12-30 02:06:29 +00:00
Alp Toker 751d635a2a Cleanup: Switch the preprocessor to err_pp_expected_after
This is approaching consistency but the PP and Parse categories they still have
slightly different wording:

def err_pp_expected_after : Error<"missing %1 after %0">;
def err_expected_after   : Error<"expected %1 after %0">;

llvm-svn: 198189
2013-12-30 01:59:29 +00:00
Alp Toker a724cff01b Rename isBuiltinCall() to getBuiltinCallee()
This better describes what the function does.

Cleanup only.

llvm-svn: 198127
2013-12-28 21:59:02 +00:00