Commit Graph

50220 Commits

Author SHA1 Message Date
NAKAMURA Takumi 4ec59174fd Tweak clang/test/PCH/modified-module-dependency.m for win32 hosts.
llvm-svn: 199469
2014-01-17 07:04:17 +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 a146db3987 Push NonNullAttr inspection loop into CheckNonNullArguments.
No functionality change.

llvm-svn: 199465
2014-01-17 06:24:47 +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
Aaron Ballman 13472563ad Updating the minimum version information for Visual Studio.
Patch thanks to Nikola Smiljanic!

llvm-svn: 199457
2014-01-17 03:38:49 +00:00
Alp Toker e1252dfb02 Tweak test run line for readability
Matching up the argument order in r199455's two RUN lines better demonstrates
what's going on.

llvm-svn: 199456
2014-01-17 03:35:04 +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
Hans Wennborg 72005cb59d ms-intrin.cpp: add -Werror to the test
llvm-svn: 199450
2014-01-17 01:41:07 +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
Adrian Prantl d1b151ed7c Debug info: Refactor NoLocation and ArtificialLocation to use a common base
class and use it pervasively to restore debug locations.
Fixes an interaction between cleanup and EH that caused the location
to not be restored properly after emitting a landing pad.
rdar://problem/15208190

llvm-svn: 199444
2014-01-17 00:15:10 +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
Hans Wennborg b3dec1b4b9 ms-intrin.cpp: no need for -verify anymore
llvm-svn: 199442
2014-01-17 00:04:43 +00:00
Hans Wennborg aae6ac48e7 Relax the ms-intrin.cpp test
The part that checks that certain functions are marked deprecated doesn't
seem that useful, and it has the bad effect that the test hard-coded the
locations of the notes from that test.

llvm-svn: 199441
2014-01-16 23:59:08 +00:00
Hans Wennborg 854f7d34ec Add implementations of _cpuid and _xgetbv to Intrin.h
The _cpuid() implementation is the same as in lib/Headers/cpuid.h
with the parameter names adjusted to match the interface.

_xgetbv just does what the Intel manual says.

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

llvm-svn: 199439
2014-01-16 23:39:35 +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
DeLesley Hutchins 80a38428e5 Consumed analysis: bugfix for operator calls. Also fixes some formatting
issues, a few testcases, and kills fish.

llvm-svn: 199436
2014-01-16 23:07:16 +00:00
Bob Wilson c6753a025e Remove an unnecessary special case to check for a few Darwin-specific options.
Using -mmacosx-version-min (etc.) on non-Darwin platforms should be a warning,
not a hard error. There is no reason to add a special check for these options
in the default toolchain. This just removes the special check and then we get
the usual -Wunused-command-line-argument warning if someone tries to use one
of these options for a target where they are not supported.
<rdar://problem/15569346>

llvm-svn: 199431
2014-01-16 21:50:37 +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 07c3d53c88 When generating Spelling enumeration values, do not generate identifiers in the reserved namespace. Strip underscores as appropriate, taking care to not create duplicate identifiers.
llvm-svn: 199414
2014-01-16 19:44:01 +00:00
Daniel Jasper a225bcedb4 clang-format: Improve formatting of ObjC Blocks with return type.
Before:
  int a = [operation block:^int(int * i) { return 1; }];

After:
  int a = [operation block:^int(int *i) { return 1; }];

llvm-svn: 199411
2014-01-16 19:14:34 +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
Jordan Rose 2be02a7848 [analyzer] Shitfing a constant value by its bit width is undefined.
Citation: C++11 [expr.shift]p1 (and the equivalent text in C11).

This fixes PR18073, but the right thing to do (as noted in the FIXME) is to
have a real checker for too-large shifts.

llvm-svn: 199405
2014-01-16 18:02:23 +00:00
Alp Toker 344845b43f www: update the "Follow what's going on" section too
Includes some style tweaks and removes the tautological observation that "Clang
is still under heavy development" -- it hopefully always will be.

llvm-svn: 199401
2014-01-16 17:04:52 +00:00
Jakob Stoklund Olesen 497332c05f SPARCv9 implements long double as an IEEE quad.
llvm-svn: 199399
2014-01-16 16:43:19 +00:00
Alp Toker 5a1a81841a www: link to the planet clang newsfeed
Also shuffle the Communication section so the bug tracker comes first.

(The sidebar isn't scrollable at the moment so this gives a better chance of
the bug tracker being seen. The links further down are basically invisible --
we should look into that.)

llvm-svn: 199398
2014-01-16 16:29:02 +00:00
Aaron Ballman 4755304fd1 Fixing a warning that causes the sanitizer build disliked about mixing && and ||. Since this is generated code, the && has been removed from the expression entirely.
llvm-svn: 199392
2014-01-16 14:32:03 +00:00
Alexander Potapenko f47e667c05 [ASan] Enough to have llvm-symbolizer in $PATH.
llvm-svn: 199388
2014-01-16 14:01:39 +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
Alexander Potapenko 108bc0311f [ASan] Typo fix (symbolize=0 disables online symbolization)
llvm-svn: 199385
2014-01-16 13:48:16 +00:00
Alexander Potapenko c7549007c9 [ASan] Describe online/offline symbolization of reports, mention dsymutil.
llvm-svn: 199383
2014-01-16 13:46:29 +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
David Majnemer f5b93794b7 Sema: Fix crash during member pointer conversion involving incomplete classes
We would attempt to determine the inheritance relationship between
classes 'A' and 'B' during static_cast if we tried to convert from 'int
A::*' to 'int B::*'.  However, the question "does A derive from B" is
not meaningful when 'A' isn't defined.

Handle this case by requiring that 'A' be defined.

This fixes PR18506.

llvm-svn: 199374
2014-01-16 12:02:55 +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
Daniel Jasper cb51cf409b clang-format: Enable formatting of lambdas with explicit return type.
So clang-format can now format:

  int c = []()->int { return 2; }();
  int c = []()->vector<int> { return { 2 }; }();

llvm-svn: 199368
2014-01-16 09:11:55 +00:00
Tim Northover 157d911b42 MachO: use *-*-*-macho for MachO embedded targets.
Previously we had bodged together some hacks mapping MachO embedded
targets (i.e. mainly ARM v6M and v7M) to the "*-*-darwin-eabi" triple.
This is incorrect in both details (they don't run Darwin and they're
not EABI in any real sense).

This commit appropriates the existing "MachO" environment for the
purpose instead.

llvm-svn: 199367
2014-01-16 08:48:16 +00:00
Alp Toker 11a71128b7 Forbid driver use in Sema tests
This ports the last Sema tests over to use the frontend directly, and adds a
local lit substitution to disable inappropriate %clang usage under this
directory.

llvm-svn: 199348
2014-01-16 02:37:08 +00:00
Alp Toker b9411ce1f7 Disable and XFAIL a test that never worked
-verify was simply ignored by the driver.

This commit fixes the RUN line and XFAILs the test, unblocking changes to ban
use of the driver in Sema tests and avoid problems like this.

llvm-svn: 199347
2014-01-16 02:36:24 +00:00
Bob Wilson b767d15d1e Remove support for armv7f slice. <rdar://problem/12478440>
This was never used for anything so we should just get rid of it.

llvm-svn: 199336
2014-01-15 21:43:40 +00:00
Jan Wen Voung 1f9c4ee464 Ensure i686-nacl long long is aligned 8 bytes (like malign-double)
Set NaCl OSTargetInfo to have LongLongAlign = 64. Otherwise, it will
pick up the setting of 32 from X86_32TargetInfo.

llvm-svn: 199335
2014-01-15 21:42:41 +00:00
Roman Divacky dd9bfb2c1a Make -fno-inline attach NoInline attribute to all functions that are not
marked as AlwaysInline or ForceInline.

This moves us to what gcc does with -fno-inline. The attribute approach
was discussed to be better than switching to InlineAlways inliner in presence
of LTO.

llvm-svn: 199324
2014-01-15 19:07:16 +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
Jordan Rose e02e96a69f [analyzer] Print function name when dumping its CFG.
This allows us to use CHECK-LABEL to ensure that we're checking the right CFG.

Debugging change only.

llvm-svn: 199320
2014-01-15 17:25:05 +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
Chandler Carruth b653131345 Move a bunch of tests to directly use the CC1 layer. This at least saves
a subprocess invocation which is pretty significant on Windows. It also
likely saves a bunch of thrashing the host machine needlessly. Finally
it makes the tests much more predictable and less dependent on the host.
For example 'header_lookup1.c' was passing '-fno-ms-extensions' just to
thwart the host detection adding it into the compilation. By runnig CC1
directly we don't have to deal with such oddities.

llvm-svn: 199308
2014-01-15 09:08:07 +00:00
Chandler Carruth f9814063c6 Switch this test from needlessly running the clang driver to directly
test the CC1 layer.

This actually uncovered that the test semes to no longer be passing for
the reasons intended. =[ The name of the test would lead me to believe
that it should be testing the semantics of noreturn in the static
analyzer.... but there are in fact no -verify assertions about noreturn
that i can find. And the noreturn checker is no longer in 'alpha.core'.
It is in 'core.builtins'. The test *does* have one assertion for a null
dereference warning. This *also* isn't in 'alpha.core', but the driver
inserts a pile of other checker packages, including 'core' which has
this warning.

So I have switch the RUN line to actually do the minimal thing that this
test currently exercises, but someone who works on the static analyzer
should probably look at this and either nuke it or move it to actually
check the noreturn behavior.

llvm-svn: 199307
2014-01-15 09:07:56 +00:00
Nick Lewycky 9c8754f56b This code block wasn't showing up in the html. Try this?
llvm-svn: 199306
2014-01-15 08:33:00 +00:00
Kostya Serebryany 317e2c499d replace LeakSanitizerIsTurnedOffForTheCurrentProcess with __lsan_is_turned_off, but this time hide it under __has_feature(address_sanitizer); also include <sanitizer/lsan_interface.h>
llvm-svn: 199303
2014-01-15 07:59:37 +00:00
Justin Bogner 4c5c99f91a CodeGen: Simplify CodeGenFunction::EmitCaseStmt
Way back in r129652 we tried to avoid emitting an empty block at -O0
for switch cases that did nothing but break. This led to a poor
debugging experience as reported in PR9796, so we disabled the
optimization for -O0 but left it in for higher optimization levels in
r154420.

Since the whole point of this was to improve -O0, it's silly to keep
the complexity at all.

llvm-svn: 199302
2014-01-15 07:30:30 +00:00
Nick Lewycky b9737cd0bc Fix the attribute enable_if example in the docs to be 100% real-world, instead of merely being close to the real world to mislead people. This now matches the test.
llvm-svn: 199298
2014-01-15 06:34:12 +00:00
Alp Toker a8bb9c97c6 Fix cxx_variable_templates feature check and documentation
This C++ feature has been marked complete since r191549, but the documentation
claimed it wasn't supported at all and the extension check misreported it as
being available in C.

No regression test; this was a short-lived typo.

llvm-svn: 199292
2014-01-15 04:11:24 +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
Bob Wilson a19fad7735 Rename QA_OVERRIDE_GCC3_OPTIONS to CCC_OVERRIDE_OPTIONS. <rdar://14578381>
Continue to accept the old name for a while to make it an easier transition
for people who rely on this.

llvm-svn: 199283
2014-01-15 01:41:52 +00:00
Hans Wennborg 1e76cbaebb lit.cfg: Don't expand %ms_abi_triple to non-X86 triples
This is a follow-up to r199260. On ARM hosts, we were attempting to run
tests with triples such as armv7l-unknown-win32. This expands that fix to
cover all non-x86 targets since we only support MS ABI on x86.

llvm-svn: 199280
2014-01-15 01:08:42 +00:00
Fariborz Jahanian bae1bcb6bf ObjectiveC. Improve on diagnostics per Jordan's feedback.
llvm-svn: 199278
2014-01-15 00:59:25 +00:00
Ted Kremenek 0f83390540 Teach DeadStoresChecker about attribute objc_precise_lifetime.
llvm-svn: 199277
2014-01-15 00:59:23 +00:00
Reid Kleckner 9e6e67c2ef Use i686 as the ISA in %microsoft_abi_triple on ARM
Long term we should make -triple arm7l-*-win32 do something sensible,
but for now it's broken and untested.

llvm-svn: 199260
2014-01-14 22:36:02 +00:00
Fariborz Jahanian 39c17a8f30 Improve comment.
llvm-svn: 199258
2014-01-14 22:01:08 +00:00
Fariborz Jahanian 0f6eabdd05 ObjectiveC. add comment.
llvm-svn: 199257
2014-01-14 21:33:54 +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
Reid Kleckner 3a4c638900 Remove unused function to fix clang -Werror build
llvm-svn: 199230
2014-01-14 18:10:42 +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
Jordan Rose 6f5f719806 CFG: use Visit instead of VisitStmt to look through parens.
PR18472

llvm-svn: 199227
2014-01-14 17:29:12 +00:00
Jordan Rose a3f2781259 [analyzer] Use synthesized ASTs for property getters when available.
This allows the analyzer to handle properties with C++ class type,
finishing up the FIXME from r198953.

llvm-svn: 199226
2014-01-14 17:29:06 +00:00
Jordan Rose 31c05a117a Use a proper lvalue-to-rvalue conversion in Objective-C++ property accessors.
Previously, the synthesized AST contained an rvalue DeclRefExpr for 'self'.
Now, it has an lvalue DeclRefExpr wrapped in an lvalue-to-rvalue
ImplicitCastExpr, which is what's generated when an ivar access is written
in the source.

No (intended) functionality change.

llvm-svn: 199225
2014-01-14 17:29:00 +00:00
Nico Rieck bb0554f959 Update CodeGen to use DLL storage class for dllimport/dllexport
With the old linkage types removed, set the linkage to external for both
dllimport and dllexport to reflect what's currently supported.

llvm-svn: 199220
2014-01-14 15:23:53 +00:00
Eli Bendersky aa2e61f3fc Clarify the LibTooling.rst a bit
The ClangCheck tool has changed and no longer is exactly equivalent to the
code pasted in the doc.

llvm-svn: 199215
2014-01-14 14:29:19 +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
Joey Gouly 8fc32f01dc [OpenCL] Disallow casts between address spaces.
llvm-svn: 199208
2014-01-14 12:47:29 +00:00
NAKAMURA Takumi ba6ea6024c clang/test/Index/recursive-cxx-member-calls.cpp: Add "-target" rather than XFAILing.
llvm-svn: 199201
2014-01-14 11:07:55 +00:00
Sylvestre Ledru 096d6e44fd Remove trailing spaces
llvm-svn: 199199
2014-01-14 10:25:26 +00:00
Daniel Jasper d07c2ee99e clang-format: Fix bug introduced in r198871.
We cannot simply change the start column to accomodate for the @ in an
ObjC string literal as that will make clang-format happily violate the
column limit.

Use a different workaround instead. However, a better long-term
solution might be to join the @ and the rest of the literal into a
single token.

llvm-svn: 199198
2014-01-14 09:53:07 +00:00
David Majnemer a5b0999e4d Disable this test for windows builders
This test provides definitions of size_t which are at odds with
-fms-compatibility.  Disable this test on those builders (for now).

llvm-svn: 199196
2014-01-14 08:19:51 +00:00
David Majnemer d4328ded85 Switch to ssize_t from size_t to unbreak windows builders.
Builders that have -fms-compatibility on by default define size_t implicitly.
Tests that provide conflicting definitions would cause unintended failures.

llvm-svn: 199195
2014-01-14 08:18:49 +00:00
David Majnemer 1de36917d3 Sema: Predefine size_t in MSVC Compatibility mode
MSVC defines size_t without any explicit declarations.  This change
allows us to be compatible with TUs that depend on this declaration
appearing from nowhere.

llvm-svn: 199190
2014-01-14 06:19:35 +00:00
Jakob Stoklund Olesen 899b4f3624 This test is passing on SPARC.
llvm-svn: 199189
2014-01-14 06:19:29 +00:00
Jakob Stoklund Olesen 6e1aaf27c1 Puny 24-byte structs are returned by value on SPARC.
Pad these structs up so they are sret-returned even on that
architecture.

llvm-svn: 199188
2014-01-14 06:19:26 +00:00
Richard Smith 75a9a1a3c2 Update feature name "Generalized Attributes" to match the heading in the paper.
llvm-svn: 199177
2014-01-14 02:52:38 +00:00
Bob Wilson 5a4f3eab0a Remove a temporary workaround that is no longer relevant.
llvm-svn: 199176
2014-01-14 01:56:31 +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
Warren Hunt 26b944274e [ms-abi] Small Change to pack+alignment interaction.
This patch makes a small behavioral change to the interaction between 
pack and alignment.  Specifically it makes __declspec(align()) on a 
field change that field's alignment without respect to pack but the 
alignment change to the record alignment as a whole still obeys pack.

llvm-svn: 199172
2014-01-14 00:54:36 +00:00
Reid Kleckner 5b1b5d5123 [ms-abi] Remove duplicated vbptr offset code
Record layout will tell us the offset of a shared vbptr inside a
non-virtual base.

No functionality change.

llvm-svn: 199171
2014-01-14 00:50:39 +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
Warren Hunt 6eba907102 [ms-abi] Report VBPtrOffset correctly
Although VBPtrs were being placed correctly by the ms-abi layout engine, 
their offsets were being improperly reported to the ASTRecordLayout 
builder due to a bug.  This patch fixes that and fixes the test cases to 
use the correct values.
y

llvm-svn: 199168
2014-01-14 00:31:30 +00:00
Reid Kleckner 340ad862d9 [ms-abi] Always generate complete constructors in the Microsoft C++ ABI
Fixes PR18435, where we generated a base ctor instead of a complete
ctor, and so failed to construct virtual bases when constructing the
complete object.

llvm-svn: 199160
2014-01-13 22:57:31 +00:00
Warren Hunt 4c73e59475 [ms-abi] Reordering __declspec(align) pragma pack handling
This patch moves the check for pragma pack until after the application 
of __declspec align to before pragma pack.  This causes observable 
changes in the use of tail padding for bases.  A test case is included.

llvm-svn: 199154
2014-01-13 22:25:55 +00:00
Hans Wennborg 859422a867 clang-cl: Ignore /fallback when not actually compiling (PR18456)
For example, don't fall back in /P (preprocess) mode.

llvm-svn: 199153
2014-01-13 22:24:42 +00:00
Chandler Carruth 0ad27923d5 LLVM's CMake is now using a feature that wasn't preasant in CMake 2.8.7,
so bump the minimum version in the standalone Clang CMake project as
well.

As I mentioned on the LLVM commit version of this, if this causes any
trouble for folks, just let me know. I'm trying to avoid re-implementing
functionality in CMake, but I will if there are problems using the newer
versions.

llvm-svn: 199152
2014-01-13 22:23:58 +00:00
Aaron Ballman b32989eb51 Adding myself as the code owner for the attribute subsystem.
llvm-svn: 199151
2014-01-13 22:23:27 +00:00
Chandler Carruth 38a61d87a5 Teach the standalone Clang CMake bits about the flag to force using an
old toolchain to build. The toolchain version is now checked in
HandleLLVMOptions.

llvm-svn: 199150
2014-01-13 22:22:24 +00:00
Aaron Ballman 09e98ffa5b When determining the attribute's parsed kind, pay attention to the syntax used. This fixes bugs where an attribute has differing GNU and Declspec spellings, but they are treated as the same. Eg) __declspec(aligned) when it should be __attribute__((aligned)), and __attribute__((align)) when it should be __declspec(align).
llvm-svn: 199144
2014-01-13 21:42:39 +00:00
Aaron Ballman 3fe6ed5aa0 __forceinline is a keyword, and not a GNU-style attribute. This FIXME appears to be out-dated, and the attribute syntax is becoming more important these days.
llvm-svn: 199143
2014-01-13 21:40:16 +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
Aaron Ballman 87e7dea2cd There is no such thing as __attribute__((align)); that's a __declspec attribute. Fixing these test cases to use the proper spelling for their syntax.
llvm-svn: 199141
2014-01-13 21:30:03 +00:00
Justin Bogner 3fac6498e1 CodeGen: Clarify a comment about PGO in case statement ranges
llvm-svn: 199140
2014-01-13 21:24:25 +00:00
Justin Bogner 0718a3a420 CodeGen: Rename adjustFallThroughCount -> adjustForControlFlow
adjustFallThroughCount isn't a good name, and the documentation was
even worse. This commit attempts to clarify what it's for and when to
use it.

llvm-svn: 199139
2014-01-13 21:24:22 +00:00
Justin Bogner 06bd6d04e0 CodeGen: Introduce CodeGenPGO::setCurrentRegionUnreachable
There are a number of places where we do PGO.setCurrentRegionCount(0)
directly after an unconditional branch. Give this operation a name so
that it's clearer why we're doing this.

llvm-svn: 199138
2014-01-13 21:24:18 +00:00
Justin Bogner 4afcd10e08 CodeGen: Remove a superfluous setCurrentRegionCount
This call looks like it was an artifact of an earlier change, and
doesn't actually make sense. We begin a new region immediately anyway,
so it was mostly harmless.

llvm-svn: 199137
2014-01-13 21:24:15 +00:00
Justin Bogner 2f6b404a14 CodeGen: Remove some unnecessary braces
llvm-svn: 199136
2014-01-13 21:24:13 +00:00
Warren Hunt badf9e0f84 [ms-abi] Leading VFPtrs don't suppress the leading zero sized flag
The MS-ABI tracks a bit that asserts that the first sub-object is zero 
sized.  This bit is used to add padding between objects if there's the 
potential for zero sized objects to alias.  The bit is still true even 
if the zero sized base is lead by a VFPtr.  This patch makes clang mimic 
that behavior.

llvm-svn: 199132
2014-01-13 19:55:52 +00:00
Hans Wennborg 50501fbe38 Use the MS ABI for Win32 targets by default
In addition to being a sensible default, this is a huge improvement
in test coverage for the MS ABI: any bot that targets Win32 will
now run the test suite using the MS ABI by default.

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

llvm-svn: 199131
2014-01-13 19:48:18 +00:00
Hans Wennborg 9125b08b52 Update tests in preparation for using the MS ABI for Win32 targets
In preparation for making the Win32 triple imply MS ABI mode,
make all tests pass in this mode, or make them use the Itanium
mode explicitly.

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

llvm-svn: 199130
2014-01-13 19:48:13 +00:00
Reid Kleckner 4f017ceeda [ms-abi] Quick fix layout of an array of records
This fixes llvm::SmallVector, which fixes lots of TUs in the MS ABI self
host.

llvm-svn: 199129
2014-01-13 19:25:00 +00:00
Hans Wennborg 13ac4bd774 Follow-up to r199120: don't try referencing the dtor if the param decl isn't valid.
This was caught by running test/SemaCXX/destructor.cpp in MS ABI mode.

llvm-svn: 199128
2014-01-13 19:24:31 +00:00
Rafael Espindola 6b6004a96e Update for getLazyBitcodeModule API change.
llvm-svn: 199126
2014-01-13 18:31:09 +00:00
Joerg Sonnenberger 9853439b5b Hook up NetBSD/aarch64.
llvm-svn: 199124
2014-01-13 18:25:15 +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
Hans Wennborg 0f3c10cb8a [ms-cxxabi] Elide dtor access checks for pass-by-val objects in callees
The ABI requires the destructor to be invoked in the callee, but the
standard does not require access checks here so we avoid doing direct
access checks on the destructor.

If we end up needing to define an implicit destructor, we don't skip
access checks for the base class, etc. Those checks are effectively part
of generating the destructor definition, and aren't affected by which TU
the check is performed in.

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

llvm-svn: 199120
2014-01-13 17:23:24 +00:00
Daniel Jasper f6c7c18b8e clang-format: Fix corner case with comment in ctor initializer.
Formatting:
  Constructor() :
      // Comment forcing unwanted break.
      aaaa(aaaa) {}

Before:
  Constructor()
      :
        // Comment forcing unwanted break.
        aaaa(aaaa) {}

After:
  Constructor()
      : // Comment forcing unwanted break.
        aaaa(aaaa) {}

llvm-svn: 199107
2014-01-13 14:10:04 +00:00
Daniel Jasper 85bde4cdd8 clang-format: Don't indent relative to ./->.
Before:
  SomeThing          // break
      .SomeFunction( // break
           param);
After:
  SomeThing          // break
      .SomeFunction( // break
          param);

Seems to be more common in editors and codebases I have looked at.

llvm-svn: 199105
2014-01-13 13:42:08 +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
Chandler Carruth 1b3304de4d [PM] Update Clang to reflect the new header for the bitcode writer pass
added in LLVM r199078.

llvm-svn: 199079
2014-01-13 07:47:38 +00:00
NAKAMURA Takumi f0a1ab8f2a [CMake] Move BUG_REPORT_URL from clang to llvm.
It was too late to set BUG_REPORT_URL after configure_file(config.h).
BUG_REPORT_URL in config.h.cmake would be updated at 2nd run of cmake.
It caused many recompilations.

FYI, configure handles BUG_REPORT_URL in llvm side.

llvm-svn: 199076
2014-01-13 05:25:13 +00:00
Alexey Bataev 75db8c386d Rename target i386-linux-android to i686-linux-android
llvm-svn: 199073
2014-01-13 03:49:38 +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
NAKAMURA Takumi 9b435fec0d DynamicASTMatchers/VariantValueTest.cpp: It works with msvcrt since setmode(stderr, O_BINARY) were removed.
llvm-svn: 199059
2014-01-12 17:49:26 +00:00
Alp Toker eee59685af Delete inaccurate doc comment - isVariadic is long gone
The canonical documentation in the header is up-to-date.

llvm-svn: 199054
2014-01-12 15:18:15 +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
Chandler Carruth 809403ff3f [PM] Update the creation of an IR printing pass to reflect the API
update in LLVM r199044.

llvm-svn: 199045
2014-01-12 11:31:22 +00:00
Chandler Carruth 0a50c49607 [PM] Update Clang to follow the header rename in LLVM r199041.
llvm-svn: 199042
2014-01-12 11:11:50 +00:00
Jakob Stoklund Olesen b81eb3eb51 SPARC passes non-trivial C++ objects indirectly like everybody else.
llvm-svn: 199037
2014-01-12 06:54:56 +00:00
Jakob Stoklund Olesen 8d7f5066bf MIPS and SPARC assemblers both take the -KPIC flag.
llvm-svn: 199034
2014-01-12 04:53:36 +00:00
Benjamin Kramer 06e0dadede test case hygiene.
llvm-svn: 199017
2014-01-11 21:22:35 +00:00
Benjamin Kramer 2210562249 Make helper function static.
llvm-svn: 199013
2014-01-11 18:42:35 +00:00
Jakob Stoklund Olesen 58801bf1dc Select the UltraSPARC instruction set when invoking the assembler.
llvm-svn: 199012
2014-01-11 18:25:01 +00:00
Nick Lewycky 7dae818117 Whoops! Fix major think-o in the first example in the documentation that I edited at 3am.
llvm-svn: 198997
2014-01-11 02:55:22 +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
Nick Lewycky 5641233047 Use the appropriate SourceLocation for the template backtrace when doing
template argument deduction.

llvm-svn: 198995
2014-01-11 02:37:12 +00:00
Richard Smith 454b4af0b0 PR12208: Under -fno-elide-constructors, don't forget to actually copy an NRVO
variable to the return slot. Patch by David Wiberg, with test case alterations
by me.

llvm-svn: 198991
2014-01-11 01:24:05 +00:00
Warren Hunt 9425891f28 [ms-abi] Change the way alignment is tracked
This patch more cleanly seperates the concepts of Preferred Alignment 
and Required Alignment.  Most notable that changes to Required Alignment 
do *not* impact preferred alignment until late in struct layout.  This 
is observable when using pragma pack and non-virtual bases and the use 
of tail padding when laying them out.

Test cases included.

llvm-svn: 198988
2014-01-11 01:16:40 +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
Warren Hunt 87c2b0400d [ms-abi] Adjusting Rules for Padding Between Bases
The presence of a VBPtr suppresses the presence of zero sized 
sub-objects in the non-virtual portion of the object in the context of 
determining if two base objects need alias-avoidance padding placed 
between them.

Test cases included.

llvm-svn: 198975
2014-01-10 23:32:32 +00:00
Rafael Espindola 2a008784d3 Use the simpler version of llvm::sys::fs::remove when possible.
llvm-svn: 198957
2014-01-10 21:32:14 +00:00
Richard Smith c0a5d5bc4f Downgrade bogus ExtWarn on duplicate 'friend' specifier to a Warning, and add a
Warning for a duplicate 'constexpr' specifier.

llvm-svn: 198956
2014-01-10 21:27:55 +00:00
Jordan Rose 1a866cd54b [analyzer] Model getters of known-@synthesized Objective-C properties.
...by synthesizing their body to be "return self->_prop;", with an extra
nudge to RetainCountChecker to still treat the value as +0 if we have no
other information.

This doesn't handle weak properties, but that's mostly correct anyway,
since they can go to nil at any time. This also doesn't apply to properties
whose implementations we can't see, since they may not be backed by an
ivar at all. And finally, this doesn't handle properties of C++ class type,
because we can't invoke the copy constructor. (Sema has actually done this
work already, but the AST it synthesizes is one the analyzer doesn't quite
handle -- it has an rvalue DeclRefExpr.)

Modeling setters is likely to be more difficult (since it requires
handling strong/copy), but not impossible.

<rdar://problem/11956898>

llvm-svn: 198953
2014-01-10 20:06:06 +00:00