Commit Graph

6116 Commits

Author SHA1 Message Date
Chad Rosier 360e1763d5 [ms-inline asm] Add basic codegen support for simple asm stmts. Currently,
only machine specific clobbers are modeled.

llvm-svn: 161524
2012-08-08 21:15:52 +00:00
Eli Friedman f6d2184c83 Fix an assertion failure with a C++ constructor initializing a
member of reference type in an anonymous struct.  PR13154.

llvm-svn: 161473
2012-08-08 03:51:37 +00:00
Fariborz Jahanian af264ce12a objc-arc: set nonlazybind attribute on objc_retain/
objc_release for performance for these most often
called APIs. // rdar://12040837

llvm-svn: 161448
2012-08-07 21:30:31 +00:00
Eric Christopher 06d29572e1 If we don't have a complete type for the array type yet either then
just let the alignment be zero.

PR13531

llvm-svn: 161379
2012-08-07 00:48:43 +00:00
Eric Christopher 5b3ec2630a Remove some unintended changes from my last patch.
llvm-svn: 161369
2012-08-07 00:18:40 +00:00
Eric Christopher 33becaa77a Make sure when we get the replacement type for a template argument
that we attach the lost qualifiers.

Fixes rdar://11882155

llvm-svn: 161368
2012-08-07 00:14:25 +00:00
Hal Finkel 3fadbb54fd Add __builtin_readcyclecounter() to produce the @llvm.readcyclecounter() intrinsic.
llvm-svn: 161310
2012-08-05 22:03:08 +00:00
Benjamin Kramer e073177e06 Simplify code, no functionality change.
llvm-svn: 161303
2012-08-04 17:00:46 +00:00
Eric Christopher 08af4c8461 Fix the name of this variable.
llvm-svn: 161287
2012-08-04 00:11:22 +00:00
Eric Christopher 47cff54422 Update comment to accurately reflect what should happen.
llvm-svn: 161286
2012-08-04 00:11:20 +00:00
Eli Friedman abab776039 Make sure we don't emit IR for unused EH cleanups. PR13359.
llvm-svn: 161148
2012-08-02 00:10:24 +00:00
John McCall 13a39c6f54 When devirtualizing the conversion to a virtual base subobject,
don't explode if the offset we get is zero.  This can happen if
you have an empty virtual base class.

While I'm at it, remove an unnecessary block from the IR-generation
of the null-check, mark the eventual GEP as inbounds, and generally
prettify.

llvm-svn: 161100
2012-08-01 05:04:58 +00:00
Benjamin Kramer 1bbcbd0187 Remove deprecated getNameAsCString methods.
llvm-svn: 161044
2012-07-31 11:45:39 +00:00
John McCall f253834456 Introduce new queries on ObjCRuntime for how to interpret subscripts
on object pointers and whether pointer arithmetic on object pointers
is supported.  Make ObjFW interpret subscripts as pseudo-objects.
Based on a patch by Jonathan Schleifer.

llvm-svn: 161028
2012-07-31 05:14:30 +00:00
Rafael Espindola 06b2b4a7c9 Handle functions with struct arguments or return types and the regparm
attribute. It is a variation of the x86_64 ABI:

* A struct returned indirectly uses the first register argument to pass the
  pointer.
* Floats, Doubles and structs containing only one of them are not passed in
  registers.
* Other structs are split into registers if they fit on the remaining ones.
  Otherwise they are passed in memory.
* When a struct doesn't fit it still consumes the registers.

llvm-svn: 161022
2012-07-31 02:44:24 +00:00
John McCall ff755cda9c Don't crash *or* insert a bogus autorelease when emitting a
this-adjustment thunk in ARC++.

llvm-svn: 161014
2012-07-31 00:33:55 +00:00
NAKAMURA Takumi 836926dbdf clang/lib: [CMake] Update tblgen'd dependencies.
llvm-svn: 160851
2012-07-27 06:18:33 +00:00
Rafael Espindola 4d3487b44b ABIArgInfo's constructor is private and only used by the static get* methods.
No need to abuse default arguments.

llvm-svn: 160684
2012-07-24 19:30:23 +00:00
Nick Lewycky 085970736f Emit debug info for dynamic initializers. Permit __attribute__((nodebug)) on
variables that have static storage duration, it removes debug info on the
emitted initializer function but not all debug info about this variable.

llvm-svn: 160659
2012-07-24 01:40:49 +00:00
Rafael Espindola a647296b7c move X86_32ABIInfo::computeInfo out of line.
llvm-svn: 160652
2012-07-24 00:01:07 +00:00
Rafael Espindola 75419dc151 Make classifyReturnType and classifyArgumentType private.
llvm-svn: 160648
2012-07-23 23:30:29 +00:00
Richard Trieu c320c745cc Change APInt to APSInt in one instance. Also change a call to operator==() to
APSInt::isSameValue() when comparing different sized APSInt's.

llvm-svn: 160641
2012-07-23 20:21:35 +00:00
Sylvestre Ledru 830885ca64 Fix a typo (the the => the)
llvm-svn: 160622
2012-07-23 08:59:39 +00:00
Tim Northover eb752d43c9 Add "long double" to permitted list of ARM complex homogeneous aggregates.
Under AAPCS, long double is the same as double, which means it should be
allowed as part of a homogeneous aggregate.

llvm-svn: 160586
2012-07-20 22:29:29 +00:00
Chad Rosier 7a96c77824 Add the mechanics for -fms-inline-asm. No easy way to test at this time.
llvm-svn: 160580
2012-07-20 21:44:43 +00:00
Eric Christopher f8378ca2b1 Remove HasSynthBitfield and all callers/writers/etc. Also remove
previous ResetObjCLayout calls since this is now handled in Sema.

Part of rdar://11842763

llvm-svn: 160527
2012-07-19 22:22:55 +00:00
Joel Jones 682150364a More replacing of target-dependent intrinsics with target-indepdent
intrinsics.  The second instruction(s) to be handled are the vector versions 
of count set bits (ctpop).

The changes here are to clang so that it generates a target independent 
vector ctpop when it sees an ARM dependent vector bits set count.  The changes 
in llvm are to match the target independent vector ctpop and in 
VMCore/AutoUpgrade.cpp to update any existing bc files containing ARM 
dependent vector pop counts with target-independent ctpops.  There are also 
changes to an existing test case in llvm for ARM vector count instructions and 
to a test for the bitcode upgrade.

<rdar://problem/11892519>

There is deliberately no test for the change to clang, as so far as I know, no
consensus has been reached regarding how to test neon instructions in clang;
q.v. <rdar://problem/8762292>

llvm-svn: 160409
2012-07-18 00:01:03 +00:00
Joao Matos 718a883c5f Fixed whitespace issue introduced in r160373.
llvm-svn: 160388
2012-07-17 19:17:58 +00:00
Joao Matos 2ce88ef9a7 [Windows] Abstract pure virtual method calls in the ABI. Fix the Windows ABI to forward to the correct function.
llvm-svn: 160373
2012-07-17 17:10:11 +00:00
Simon Atanasyan 94a6d863a9 Revert commit r160308. We decide to move builtins selection to the backend.
llvm-svn: 160353
2012-07-17 08:15:06 +00:00
Simon Atanasyan a06d06b660 MIPS: Implement __builtin_mips_shll_qb builtin function overloading.
This function has two versions. The first one is used for a register operand.
The second one is used for an immediate number.

llvm-svn: 160308
2012-07-16 18:52:02 +00:00
Chandler Carruth cc8f2a6ab5 Update Clang to reflect the move of MDBuilder in r160237.
llvm-svn: 160238
2012-07-15 23:28:01 +00:00
Eric Christopher 934a1c0231 Capitalize comment.
llvm-svn: 160220
2012-07-14 19:29:12 +00:00
Joel Jones 3e00e9d5c1 This is one of the first steps at moving to replace target-dependent
intrinsics with target-indepdent intrinsics.  The first instruction(s) to be 
handled are the vector versions of count leading zeros (ctlz).

The changes here are to clang so that it generates a target independent 
vector ctlz when it sees an ARM dependent vector ctlz.  The changes in llvm 
are to match the target independent vector ctlz and in VMCore/AutoUpgrade.cpp 
to update any existing bc files containing ARM dependent vector ctlzs with 
target-independent ctlzs.  There are also changes to an existing test case in 
llvm for ARM vector count instructions and a new test for the bitcode upgrade.

<rdar://problem/11831778>

There is deliberately no test for the change to clang, as so far as I know, no
consensus has been reached regarding how to test neon instructions in clang;
q.v. <rdar://problem/8762292>

llvm-svn: 160201
2012-07-13 23:26:27 +00:00
Timur Iskhodzhanov c5098ad371 [Windows] Use thiscall as the default calling convention for class methods. PR12785
llvm-svn: 160121
2012-07-12 09:50:54 +00:00
Benjamin Kramer a43b6999ff Add _rdrand{16,32,64}_step intrinsics to immintrin.h
llvm-svn: 160118
2012-07-12 09:33:03 +00:00
John McCall 775086e67c Add the ObjFW runtime. Patch by Jonathan Schleifer!
llvm-svn: 160102
2012-07-12 02:07:58 +00:00
Tanya Lattner 7445ada9c8 Add OpenCL metadata for kernel arg names. This output is controlled via a flag as noted in the OpenCL Spec.
Includes a test case.

llvm-svn: 160092
2012-07-11 23:02:10 +00:00
Eric Christopher f8b9809fab Temporarily revert this to see if it brings the gdb bot back.
llvm-svn: 160049
2012-07-11 15:32:13 +00:00
Eric Christopher 2977378974 The end of a block doesn't necessarily need a line table entry unless
there's something going on there. Remove the unconditional line entry
and only add one if we're emitting cleanups (any other statements
would be handled normally).

Fixes rdar://9199234

llvm-svn: 160033
2012-07-11 01:49:26 +00:00
Tanya Lattner bcffcdfd18 Patch by Anton Lokhmotov to add OpenCL work group size attributes.
llvm-svn: 159965
2012-07-09 22:06:01 +00:00
Abramo Bagnara cb43567374 The delete argument should not be converted to void*.
llvm-svn: 159961
2012-07-09 21:15:43 +00:00
John McCall 8dda7b27ee Distinguish more carefully between free functions and C++ instance methods
in the ABI arrangement, and leave a hook behind so that we can easily
tweak CCs on platforms that use different CCs by default for C++
instance methods.

llvm-svn: 159894
2012-07-07 06:41:13 +00:00
Lang Hames aa53b936ec Add -ffp-contract = { fast | on | off } command line option support.
This flag sets the 'fp-contract' mode, which controls the formation of fused
floating point operations. Available modes are:

- Fast: Form fused operations anywhere. 
- On: Form fused operations where allowed by FP_CONTRACT. This is the default
      mode.
- Off: Don't form fused operations (in future this may be relaxed to forming
       fused operations where it can be proved that the result won't be
       affected).

Currently clang doesn't support the FP_CONTRACT pragma, so the 'On' and 'Off'
modes are equivalent.

llvm-svn: 159794
2012-07-06 00:59:19 +00:00
Dmitri Gribenko ec92531c29 Implement AST classes for comments, a real parser for Doxygen comments and a
very simple semantic analysis that just builds the AST; minor changes for lexer
to pick up source locations I didn't think about before.

Comments AST is modelled along the ideas of HTML AST: block and inline content.

* Block content is a paragraph or a command that has a paragraph as an argument
  or verbatim command.
* Inline content is placed within some block.  Inline content includes plain
  text, inline commands and HTML as tag soup.

llvm-svn: 159790
2012-07-06 00:28:32 +00:00
Benjamin Kramer 2ef3031496 Remove get(V)BaseClassOffsetInBits, the CharUnit functions should be used instead.
No functionality change.

llvm-svn: 159719
2012-07-04 18:45:14 +00:00
Benjamin Kramer 1ea8e092be Drop the ASTContext.h include from Stmt.h and fix up transitive users.
This required moving the ctors for IntegerLiteral and FloatingLiteral out of
line which shouldn't change anything as they are usually called through Create
methods that are already out of line.

ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector
and make it independent from ASTContext.h

Pass the StorageAllocator directly to AccessedEntity so it doesn't need to
have a definition of ASTContext around.

llvm-svn: 159718
2012-07-04 17:04:04 +00:00
David Chisnall b601c96892 Rename the GCC Objective-C runtime to gcc from gnu-fragile and the GNUstep
runtime to gnustep from gnu.  Fix EH for the GCC runtime.

llvm-svn: 159684
2012-07-03 20:49:52 +00:00
Akira Hatanaka e1e3ad3d11 Make the following changes in the way Mips handles vector arguments and return
values:

- Return integer vectors in integer registers.
- Pass vector arguments in integer registers.
- Set an upper bound for argument alignment. The largest alignment is 8-byte
  for O32 and 16-byte for N32/64.

llvm-svn: 159676
2012-07-03 19:24:06 +00:00
Matt Beaumont-Gay 36af16affd Silence warning in -Asserts build
llvm-svn: 159635
2012-07-03 03:55:58 +00:00
Nico Weber 4b18c3ff40 Share ConvertUTF8toWide() between Lex and CodeGen.
llvm-svn: 159634
2012-07-03 02:24:52 +00:00
John McCall 4e8ca4fa14 Significantly simplify CGExprAgg's logic about ignored results:
if we want to ignore a result, the Dest will be null.  Otherwise,
we must copy into it.  This means we need to ensure a slot when
loading from a volatile l-value.

With all that in place, fix a bug with chained assignments into
__block variables of aggregate type where we were losing insight into
the actual source of the value during the second assignment.

llvm-svn: 159630
2012-07-02 23:58:38 +00:00
Eli Friedman c9f439461b When we're looking for redeclarations which might provide a definition in CodeGen, make sure we examine all the redeclarations. PR13252.
llvm-svn: 159586
2012-07-02 21:05:30 +00:00
Chandler Carruth 6b22da9e89 Update Clang to reflect the new home of IRBuilder.h as of r159421.
llvm-svn: 159422
2012-06-29 12:39:08 +00:00
Bill Wendling 128f8bdb78 Update based on move of DIBuilder.h to include/llvm.
llvm-svn: 159415
2012-06-29 08:32:29 +00:00
Timur Iskhodzhanov 099ec01569 Fix PR13234 - crash when trying to report an unsupported ABI feature
llvm-svn: 159405
2012-06-29 01:14:21 +00:00
Benjamin Kramer 46a72fb741 Dead code eliminate the massive hexagon builtin intrinsic supporting code.
The tablegen'd code does the same thing without this egregious duplication.
In my limited testing everything seems to work, however there can be
differences if the clang and llvm builtin definitions don't match.

llvm-svn: 159371
2012-06-28 20:08:55 +00:00
Benjamin Kramer 8652ca8a6a Now that we use the GCC builtin <-> llvm intrinsic, dead code eliminate the handwritten emitter.
The generated code uncovered an invalid prototype for __builtin_mips_shilo, fix it along the way.

llvm-svn: 159368
2012-06-28 19:10:01 +00:00
Simon Atanasyan 07ce7d8fb5 Support MIPS DSP Rev1 intrinsics.
This patch was reviewed in the llvm-commits list by Jim Grosbach.

llvm-svn: 159366
2012-06-28 18:23:16 +00:00
Rafael Espindola b27564af76 Compare the canonical types and document why we give up on the covariant case.
llvm-svn: 159360
2012-06-28 17:57:36 +00:00
Rafael Espindola debc71cea3 Disable devirtualization when we have covariant returns. I will open a bug
for tracking this.

llvm-svn: 159351
2012-06-28 15:11:39 +00:00
Rafael Espindola 3b33c4ecf0 Don't devirtualize calls when we don't have the correct type of the this pointer
handy. It can be done, but we would have to build a derived-to-base cast
during codegen to compute the correct this pointer.

I will handle covariant returns next.

llvm-svn: 159350
2012-06-28 14:28:57 +00:00
Hans Wennborg f60f6af9e8 Add -ftls-model command-line flag.
This allows for setting the default TLS model. (PR9788)

llvm-svn: 159336
2012-06-28 08:01:44 +00:00
Rafael Espindola ecbe2e9795 Fix another issue with devirtualizing calls to final methods by passing them
the correct this pointer. There is some potential for sharing a bit more
code with canDevirtualizeMemberFunctionCalls, but that can be done in an
independent patch.

llvm-svn: 159326
2012-06-28 01:56:38 +00:00
Eric Christopher c939e50846 Fix grammar.
llvm-svn: 159321
2012-06-28 01:20:05 +00:00
Bill Wendling 4adcf78275 Update the #include to find the DebugInfo.h in the correct place
llvm-svn: 159315
2012-06-28 00:30:19 +00:00
Eli Friedman c24e2fb1fb Propagate lvalue alignment into bitfields. Per report on cfe-dev.
llvm-svn: 159295
2012-06-27 21:19:48 +00:00
Rafael Espindola b7f5a9c5cd Implement John McCall's review of r159212 other than the this pointer not
being updated. Will fix that in a second.

llvm-svn: 159280
2012-06-27 18:18:05 +00:00
Rafael Espindola 727a771a5f Fix a bug in my previous patch: If we are not doing a virtual call because
the member expression is qualified, call the method specified in the code,
not the most derived one we can find.

llvm-svn: 159219
2012-06-26 19:18:25 +00:00
Rafael Espindola 49e860b248 During codegen of a virtual call we would extract any casts in the expression
to see if we had an underlying final class or method, but we would then
use the cast type to do the call, resulting in a direct call to the wrong
method.

llvm-svn: 159212
2012-06-26 17:45:31 +00:00
Fariborz Jahanian 6362803cfe block literal irgen: several improvements on naming block
literal helper functions. All helper functions (global
and locals) use block_invoke as their prefix. Local literal
helper names are prefixed by their enclosing mangled function
names. Blocks in non-local initializers (e.g. a global variable 
or a C++11 field) are prefixed by their mangled variable name. 
The descriminator number added to end of the name starts off 
with blank (for first block) and _<N> (for the N+2-th block).

llvm-svn: 159206
2012-06-26 16:06:38 +00:00
Kostya Serebryany bf84b8fa3b [asan] add missing asan instrumentation in generated global init functions
llvm-svn: 159191
2012-06-26 08:56:33 +00:00
Manman Ren 6fdb15811a ARM: enable struct byval for APCS.
Revert r136662 which disables ARM byval.

llvm-svn: 159168
2012-06-25 22:04:00 +00:00
Charles Davis a325a6e0dc IRGen: Factor v-table generation into the CGCXXABI object.
llvm-svn: 159091
2012-06-23 23:44:00 +00:00
Hans Wennborg d3b01bc7c6 Support the tls_model attribute (PR9788)
This adds support for the tls_model attribute. This allows the user to
choose a TLS model that is better than what LLVM would select by
default. For example, a variable might be declared as:

  __thread int x __attribute__((tls_model("initial-exec")));

if it will not be used in a shared library that is dlopen'ed.

This depends on LLVM r159077.

llvm-svn: 159078
2012-06-23 11:51:46 +00:00
Nico Weber 3a691a367c Support L__FUNCTION__ in microsoft mode, PR11789
Heavily based on a patch from
Aaron Wishnick <aaron.s.wishnick@gmail.com>.

I'll clean up the duplicated function in CodeGen as
a follow-up, later today or tomorrow.

llvm-svn: 159060
2012-06-23 02:07:59 +00:00
Nuno Lopes c65221decf revert CodeGen support for the alloc_size attribute until we finish the design of a more generic metadata node
llvm-svn: 159016
2012-06-22 18:01:38 +00:00
James Dennett 41725129a4 Documentation cleanup: making \param docs match the code.
llvm-svn: 158982
2012-06-22 10:16:05 +00:00
James Dennett 14c41ea3dd Documentation cleanup: Escape @objc* in Doxygen comments.
llvm-svn: 158974
2012-06-22 05:41:30 +00:00
Chandler Carruth 28969b4139 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

llvm-svn: 158888
2012-06-21 01:30:21 +00:00
Chad Rosier 43b7c021b3 [ms-style asm] Change the fatal error to an extension warning. Apparently, this
error was asserting on anything that included Windows.h.  MS-style inline asm is
still dropped, but at least now we're not completely silent about it.

llvm-svn: 158833
2012-06-20 18:28:37 +00:00
Benjamin Kramer e6dcf106b2 Don't circumvent the debug info type cache when emitting info for EnumConstantDecl.
CreateEnumType doesn't participate in caching so the descriptor for the enum
gets recomputed for every reference of an element of an enum, only to get
discarded when it gets turned into an MDNode.

No functionality change except performance.

llvm-svn: 158832
2012-06-20 18:11:18 +00:00
Chad Rosier bebf146dd6 Whitespace.
llvm-svn: 158830
2012-06-20 17:43:05 +00:00
John McCall 5fb5df9c83 Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend:  break this
down into a single target runtime kind and version, and compute
all the relevant information from that.  This makes it
relatively painless to add support for new runtimes to the
compiler.  Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime.  This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

llvm-svn: 158793
2012-06-20 06:18:46 +00:00
James Dennett a02e11f31d Documentation cleanup: escape "::" to avoid a Doxygen warning
llvm-svn: 158778
2012-06-20 00:57:15 +00:00
Fariborz Jahanian a36cbeb464 objc-arc: captured block variable accessed in its block literal
initializer need be null initialized before initializer takes
hold, just like any other initialized retainable object pointer. 
// rdar://11016025

llvm-svn: 158738
2012-06-19 20:53:26 +00:00
Rafael Espindola 66aa045fd9 Add a -fuse-init-array option to cc1 and map to the UseInitArray target
option. On the driver, check if we are using libraries from gcc 4.7 or newer
and if so pass -fuse-init-array to the frontend.
The crtbegin*.o files in gcc 4.7 no longer call the constructors listed in
.ctors, so we have to use .init_array.

llvm-svn: 158694
2012-06-19 01:26:10 +00:00
Michael J. Spencer f97bd8c9cb [MSExtensions] Add support for __forceinline.
__forceinline is a combination of the inline keyword and __attribute__((always_inline))

llvm-svn: 158653
2012-06-18 07:00:48 +00:00
Eli Friedman 93ee5ca805 Fix Sema and IRGen for atomic compound assignment so it has the right semantics when promotions are involved.
(As far as I can tell, this only affects some edge cases.)

llvm-svn: 158591
2012-06-16 02:19:17 +00:00
Eli Friedman 13ffdd86b9 Make the ".*" operator work correctly when the base is a prvalue and the field has a non-trivial copy constructor. PR13097.
llvm-svn: 158578
2012-06-15 23:51:06 +00:00
James Dennett be30245442 Documentation cleanup:
* Escaped Objective-C @keywords in Doxygen comments;
* Documented more accurate \params;
* Exposed some more summaries using \brief.

llvm-svn: 158559
2012-06-15 22:10:14 +00:00
James Dennett 9426c6c6d3 Documentation fix: made the name given to \param match the code.
llvm-svn: 158511
2012-06-15 09:02:08 +00:00
James Dennett 6e5cffb617 Documentation fixes: Added \brief markup and fixed some formatting.
llvm-svn: 158501
2012-06-15 07:35:42 +00:00
John McCall d8d00be632 It turns out that implementing the rethrow-on-fallthrough
semantics of a ctor/dtor function-try-block catch handler
by pushing a normal cleanup is not just overkill but actually
actively wrong when the handler contains an explicit return
(which is only legal in a dtor).  Just emit the rethrow as
ordinary code at the fallthrough point.  Fixes PR13102.

llvm-svn: 158488
2012-06-15 05:27:05 +00:00
James Dennett b9199ee5c1 More doxygen/documentation cleanups.
This reduces the number of warnings generated by Doxygen by about 100
(roughly 10%).  Issues addressed:
(1) Primarily, backslash-escaped "@foo" and "#bah" in Doxygen comments
when they're not supposed to be Doxygen commands or links, and
similarly for "<baz>" when it's not intended as as HTML tag;
(2) Changed some \t commands (which don't exist) to \c ("to refer to a
word of code", as the Doxygen manual says);
(3) \precondition becomes \pre;
(4) When touching comments, deleted a couple of spurious spaces in them;
(5) Changed some \n and \r to \\n and \\r;
(6) Fixed one tiny typo: #pragms -> #pragma.

This patch touches documentation/comments only.

llvm-svn: 158422
2012-06-13 22:07:09 +00:00
Bill Wendling d4da16c193 Remove unused variable.
llvm-svn: 158353
2012-06-12 06:53:25 +00:00
Chad Rosier 175b507f5e Make CodeGenFunction::EmitMSAsmStmt throw a fatal error as MS-style inline
assembly is completely untested and unsupported.

llvm-svn: 158329
2012-06-11 21:52:25 +00:00
Chad Rosier 32503020a4 Etch out the code path for MS-style inline assembly.
llvm-svn: 158325
2012-06-11 20:47:18 +00:00
James Dennett 1355bd17c6 Documentation cleanup, fixing Doxygen markup. Mostly this avoids common terms
such as "protocol" and "expression" being implicitly turned into links to
mistakenly-generated Doxygen pages:
- Escaping @ symbols when Doxygen would otherwise incorrectly interpret them;
- Escaping # symbols when they're not intended as explicit Doxygen link 
  requests, such as when discussing preprocessor directives;
- In one odd case, unescaping @ in @__experimental_modules_import, because
  Doxygen wrote '\@' to the output in that case, causing the example in the
  description of ImportDecl to be wrong; and
- Fixing a typo: @breif -> @brief.

llvm-svn: 158299
2012-06-11 06:19:40 +00:00
Richard Smith 2b013185f8 PR13064: Store whether an in-class initializer uses direct or copy
initialization, and use that information to produce the right kind of
initialization during template instantiation.

llvm-svn: 158288
2012-06-10 03:12:00 +00:00
Michael J. Spencer d1e09a4282 [C++11 Compat] Fix breaking change in C++11 pair copyctor.
While this code is valid C++98, it is not valid C++11. The problem can be
reduced to:

class MDNode;

class DIType {
  operator MDNode*() const {return 0;}
};

class WeakVH {
  WeakVH(MDNode*) {}
};

int main() {
  DIType di;
  std::pair<void*, WeakVH> p(std::make_pair((void*)0, di)));
}

This was not detected by any of the bots we have because they either compile
C++98 with libstdc++ (which allows it), or C++11 with libc++ (which incorrectly
allows it). I ran into the problem when compiling with VS 2012 RC.

Thanks to Richard for explaining the issue.

llvm-svn: 158245
2012-06-08 23:47:12 +00:00
Fariborz Jahanian 5d53fcda7c User better API for vla in compund literals.
// rdar://11485774

llvm-svn: 158157
2012-06-07 18:15:55 +00:00
Fariborz Jahanian bbc5bbf4f1 When emitting compund literal of vla pointer elements, make
sure to emit vla size to prevent an irgen crash.
// rdar://11485774

llvm-svn: 158153
2012-06-07 17:07:15 +00:00
Benjamin Kramer 6003ad5848 Plug a long standing memory leak in TemplateArgument.
The integral APSInt value is now stored in a decomposed form and the backing
store for large values is allocated via the ASTContext. This way its not
leaked as TemplateArguments are never destructed when they are allocated in
the ASTContext. Since the integral data is immutable it is now shared between
instances, making copying TemplateArguments a trivial operation.

Currently getting the integral data out of a TemplateArgument requires creating
a new APSInt object. This is cheap when the value is small but can be expensive
if it's not. If this turns out to be an issue a more efficient accessor could
be added.

llvm-svn: 158150
2012-06-07 15:09:51 +00:00
Fariborz Jahanian ff045dc040 reverse r158117.
llvm-svn: 158119
2012-06-06 23:21:58 +00:00
Fariborz Jahanian 67164852a7 When doing arithmatic on vla pointer, make sure
to emit vla size to prevent an irgen crash.
// rdar://11485774

llvm-svn: 158117
2012-06-06 22:58:50 +00:00
David Blaikie 40ed29730b Revert Decl's iterators back to pointer value_type rather than reference value_type
In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.

This rolls back r155808 and r155869.

Review by Doug Gregor incorporating feedback from Chandler Carruth.

llvm-svn: 158104
2012-06-06 20:45:41 +00:00
Benjamin Kramer d1d76b2da7 Remove unused private member variables found by clang's new -Wunused-private-field.
llvm-svn: 158086
2012-06-06 17:32:50 +00:00
Eli Friedman 7919beaaf2 Fix a bug with va_arg and vectors on Darwin x86-32. <rdar://problem/11592208>.
llvm-svn: 158017
2012-06-05 19:40:46 +00:00
Eric Christopher beafa44be8 Reapply "Only emit debug information for methods that are user defined, there's"
As the failing testcase has been fixed.

This reverts commit 0637f407e6ee7fdccde17fbf9a5fcc4853187b3e.

llvm-svn: 158009
2012-06-05 18:16:22 +00:00
John McCall 65485d7694 Revert "Only emit debug information for methods that are user defined, there's"
This reverts r157970, which was not passing on
  clang-x86_64-darwin10-nobootstrap-RA

llvm-svn: 157983
2012-06-05 06:10:39 +00:00
Eric Christopher f5dad49a65 Only emit debug information for methods that are user defined, there's
not much reason to emit for constructors and destructors that aren't
user defined.

rdar://11593099

llvm-svn: 157970
2012-06-05 00:15:06 +00:00
Eric Christopher 31a1fc6654 Support C++11 enum forward declarations.
Part of rdar://11570854

llvm-svn: 157787
2012-06-01 00:22:57 +00:00
Fariborz Jahanian b5dd2cb13c objective-c: fix a sema and IRGen crash when property
getter result type is safe but does not match with property 
type resulting in spurious warning followed by crash in
IRGen. // rdar://11515196

llvm-svn: 157641
2012-05-29 19:56:01 +00:00
Peter Collingbourne aac265cc78 OpenCL: Fix vector conditional operator CodeGen for the case where
the operands are vectors of doubles.

llvm-svn: 157596
2012-05-29 00:35:18 +00:00
Chris Lattner a2db6f2bd8 adjust to mainline llvm API change.
llvm-svn: 157557
2012-05-28 01:47:53 +00:00
Nuno Lopes f491fbd715 fix codegen support for alloc_size attribute for static C++ methods
add test case for C++ codegen

llvm-svn: 157500
2012-05-25 21:45:08 +00:00
Nuno Lopes 147dcd8c33 add CodeGen support for the alloc_size attribute
llvm-svn: 157483
2012-05-25 17:04:42 +00:00
Justin Holewinski 83e9668133 Replace PTX back-end with NVPTX back-end in all places where Clang cares
NV_CONTRIB

llvm-svn: 157403
2012-05-24 17:43:12 +00:00
Richard Smith 01ade177e9 If the first argument of __builtin_object_size can be folded to a constant
pointer, but such folding encounters side-effects, ignore the side-effects
rather than performing them at runtime: CodeGen generates wrong code for
__builtin_object_size in that case.

llvm-svn: 157310
2012-05-23 04:13:20 +00:00
Eric Christopher a91af14b8d Emit C++11 enum class information if it exists.
Part of rdar://11496790

llvm-svn: 157304
2012-05-23 00:09:47 +00:00
Nuno Lopes a425589fea wire -fbounds-checking to the new LLVM bounds checking pass
llvm-svn: 157262
2012-05-22 17:19:45 +00:00
Nuno Lopes 2b1ff46ed1 revert the usage of the objectsize intrinsic with 3 parameters (to match LLVM r157255)
llvm-svn: 157256
2012-05-22 15:26:48 +00:00
Eric Christopher 246bb99397 Revert r115805. An array type is required to have a range type,
however, the range can be unknown for the upper bound.

Testcase to follow.

Part of rdar://11457152

llvm-svn: 157212
2012-05-21 22:13:23 +00:00
Peter Collingbourne c947aaeeae Teach Clang about the NVPTX backend.
llvm-svn: 157173
2012-05-20 23:28:41 +00:00
Peter Collingbourne f44bdf9c5f CUDA: add CodeGen support for global variable address spaces.
Because in CUDA types do not have associated address spaces,
globals are declared in their "native" address space, and accessed
by bitcasting the pointer to address space 0.  This relies on address
space 0 being a unified address space.

llvm-svn: 157167
2012-05-20 21:08:35 +00:00
Eli Friedman 022900079b Zap a bogus assert for delegating constructors. PR12890, part 2.
I'm pretty sure we are in fact doing the right thing here, but someone who knows the standard better should double-check that we are in fact supposed to zero out the member in the given testcase.

llvm-svn: 157138
2012-05-20 00:46:05 +00:00
Eric Christopher fe0913b026 Update API usage for llvm DIBuilder changes for rvalue reference
types and ensure we are actually creating the type.

rdar://11479676

llvm-svn: 157095
2012-05-19 01:36:50 +00:00
Eric Christopher de098cd08f Remove unnecessary temporary.
llvm-svn: 156953
2012-05-16 22:02:36 +00:00
Douglas Gregor 26b51746ec Fix code generation of variables reference expressions when mixing
blocks and lambdas, based heavily on a patch from Meador Inge. Fixes
PR12746 / <rdar://problem/11465120>.

llvm-svn: 156925
2012-05-16 16:50:20 +00:00
Richard Smith bb653bd5f9 Implement IRGen for C++11's "T{1, 2, 3}", where T is an aggregate and the
expression is treated as an lvalue.

llvm-svn: 156781
2012-05-14 21:57:21 +00:00
Benjamin Kramer 29c2b4330c Add support for __attribute__((hot)) and __attribute__((cold)).
Currently cold functions are marked with the "optsize" attribute in CodeGen
so they are always optimized for size.  The hot attribute is just ignored,
LLVM doesn't have a way to express hotness at the moment.

llvm-svn: 156723
2012-05-12 21:10:52 +00:00
Akira Hatanaka 8ab86cb344 Coerce byval aggregate arguments to integers whose size matches the integer
register size of the target architecture.
 

llvm-svn: 156650
2012-05-11 21:56:58 +00:00
Akira Hatanaka c37eddf7a7 Fix handling of vector return types.
A vector should be returned via the hidden pointer argument except if its size
is equal to or smaller than 16-bytes and the target ABI is N32 or N64.

llvm-svn: 156642
2012-05-11 21:01:17 +00:00
Sirish Pande 84dce5d0c2 Hexagon V5 intrinsics support in clang.
llvm-svn: 156630
2012-05-11 19:39:08 +00:00
Roman Divacky d966e723f7 Implement PPC64TargetCodeGenInfo.
llvm-svn: 156491
2012-05-09 18:22:46 +00:00
Nuno Lopes ddcce0bb90 update calls to objectsize intrinsic to match LLVM r156473
add a test for -fbounds-checking code generation

llvm-svn: 156474
2012-05-09 15:53:34 +00:00
Nuno Lopes 3d6311d5f7 add -fbounds-checking option.
When enabled, clang generates bounds checks for array and pointers dereferences. Work to follow in LLVM's backend.

OK'ed by Chad; thanks for the review.

llvm-svn: 156431
2012-05-08 22:10:46 +00:00
Eric Christopher c0e7a3d78c The address of a vla is actually complex and requires a dereference.
Part of rdar://11352000

llvm-svn: 156407
2012-05-08 18:56:47 +00:00
Eric Christopher 40d057fd7d Whitespace.
llvm-svn: 156406
2012-05-08 18:56:42 +00:00
Nuno Lopes f463abc0e7 remove code to add bound checks for simple array accesses, since those are already covered by the check with the objectsize builtin
remove the comparison of objectsize with -1. since it's an unsigned comparison, it will always succeed if objectsize returns -1, which is enough to have the check removed

llvm-svn: 156311
2012-05-07 17:57:00 +00:00
Craig Topper c83dff0993 Convert AVX non-temporal store builtins to LLVM-native IR. This was previously done for SSE builtins.
llvm-svn: 156296
2012-05-07 06:25:45 +00:00
Argyrios Kyrtzidis bbff3da622 Make BuiltinType::getName return a StringRef and introduce BuiltinType::getNameAsCString
to get a const char* if necessary.

This avoids unnecessary conversions when we want to use the result of getName as
a StringRef.

Part of rdar://10796159

llvm-svn: 156227
2012-05-05 04:20:28 +00:00
Alexey Samsonov 74a3868dbb This patch adds a new Clang compiler flag "-gline-tables-only".
It reduces the amount of emitted debug information:
1) DIEs in .debug_info have types DW_TAG_compile_unit, DW_TAG_subprogram,
DW_TAG_inlined_subroutine (for opt builds) and DW_TAG_lexical_block only.
2) .debug_str contains only function names.
3) No debug data for types/namespaces/variables is emitted.
4) The data in .debug_line is enough to produce valid stack traces with
function names and line numbers.

Reviewed by Eric Christopher.

llvm-svn: 156160
2012-05-04 07:39:27 +00:00
John McCall 1db0a2fab2 During block layout, after padding up to the max field alignment,
the alignment might actually exceed the max field alignment;  don't
assert in this case.

llvm-svn: 155937
2012-05-01 20:28:00 +00:00
Chad Rosier 5a032fa6d5 Spacing.
llvm-svn: 155931
2012-05-01 19:53:37 +00:00
Ted Kremenek db74d0b28b Push variable declaration into nested scope (the only place where it is used). Found by static analyzer.
llvm-svn: 155922
2012-05-01 17:56:53 +00:00
John McCall e42a336604 Add support for laying out vtordisps according to our current
working knowledge of the Microsoft ABI.  Based on a patch by
Dmitry Sokolov.

llvm-svn: 155905
2012-05-01 08:55:32 +00:00
John McCall c84ed6a336 Abstract the emission of global destructors into ABI-specific code
and only consider using __cxa_atexit in the Itanium logic.  The
default logic is to use atexit().

Emit "guarded" initializers in Microsoft mode unconditionally.
This is definitely not correct, but it's closer to correct than
just not emitting the initializer.

Based on a patch by Timur Iskhodzhanov!

llvm-svn: 155894
2012-05-01 06:13:13 +00:00
John McCall b91cd6687c Refactor the C++ ABI code a little bit to take advantage of
what I'm going to treat as basically universal properties of
array-cookie code.  Implement MS array cookies on top of that.
Based on a patch by Timur Iskhodzhanov!

llvm-svn: 155886
2012-05-01 05:23:51 +00:00