Commit Graph

37459 Commits

Author SHA1 Message Date
Chad Rosier a750d46c9f Make sure EmitMoveFromReturnSlot is passing the correct alignment to
EmitFinalDestCopy (and thus pass EmitAggregateCopy the correct alignment).
rdar://11220251

llvm-svn: 154883
2012-04-17 00:35:38 +00:00
Eric Christopher 365e309ccb Typo.
llvm-svn: 154880
2012-04-16 23:55:04 +00:00
Fariborz Jahanian 35f6e12bf0 Modern objective-c translator:'self' used inside
block literal is imported. // rdar://11259664

llvm-svn: 154876
2012-04-16 23:00:57 +00:00
Argyrios Kyrtzidis 17dddd21f5 [libclang] Make sure that when we have multiple @class references in the same line,
that later ones do not override the previous ones.

If we have:
   @class Foo, Bar;
source ranges for both start at '@', so 'Bar' will end up overriding
'Foo' even though the cursor location was at 'Foo'.

rdar://11257578

llvm-svn: 154873
2012-04-16 22:42:01 +00:00
Fariborz Jahanian cc1722818b modern objective-c translator: translation of implicit
cast to/from block pointer types. // rdar://11202764
Also, many more modern translator tests.

llvm-svn: 154869
2012-04-16 22:14:01 +00:00
Anna Zaks 51244c22be [analyzer] Fix a false alarm in SelfInitChecker (radar://11235991).
Along with it, fix a couple of other corner cases and add more tests.

llvm-svn: 154866
2012-04-16 21:51:09 +00:00
Anna Zaks 43195d55d7 [analyzer] +comments
llvm-svn: 154865
2012-04-16 21:51:06 +00:00
Anna Zaks fa76ff0e53 [analyzer] Fixup for a test case.
llvm-svn: 154864
2012-04-16 21:51:03 +00:00
Fariborz Jahanian 29898f4565 objective-c modern translator: buildit objc bool
type for rewriter project will be BoolTy.
// rdar://11231426. 

llvm-svn: 154861
2012-04-16 21:03:30 +00:00
Argyrios Kyrtzidis 365cfb4d1e [libclang] Spelling range for a objc category should the category name range, not the class one.
rdar://11249386

llvm-svn: 154853
2012-04-16 20:01:28 +00:00
Duncan Sands 54c05faade Remove support for -fast-math metadata for the moment.
llvm-svn: 154851
2012-04-16 19:40:49 +00:00
Eli Friedman 2f5b7c542e Per Richard's comments on r154794, add the checks necessary to handle constant-folding relational comparisons safely in case the user is using -fwrapv or equivalent.
llvm-svn: 154849
2012-04-16 19:23:57 +00:00
Rafael Espindola 78158af59c Revert r154749 for now at John McCall's request.
llvm-svn: 154846
2012-04-16 18:46:26 +00:00
Douglas Gregor 433e05306f Implement the last part of C++ [class.mem]p2, delaying the parsing of
exception specifications on member functions until after the closing
'}' for the containing class. This allows, for example, a member
function to throw an instance of its own class. Fixes PR12564 and a
fairly embarassing oversight in our C++98/03 support.

llvm-svn: 154844
2012-04-16 18:27:27 +00:00
Rafael Espindola 505a7c818d Use ordering and the explicit visibility bit instead of modifying
ConsiderGlobalVisibility. No functionality change.

llvm-svn: 154843
2012-04-16 18:25:01 +00:00
David Blaikie 96b1cd62dc Readd lost "undef BUILTIN" to fix the build.
llvm-svn: 154837
2012-04-16 17:57:39 +00:00
Duncan Sands 8030b810de Generate fpmath metadata when -ffast-math. Note that no optimizations are hooked
up to this yet.

llvm-svn: 154835
2012-04-16 17:24:31 +00:00
Sirish Pande f02eebef2a Hexagon V5(Floating Point) support.
llvm-svn: 154828
2012-04-16 17:04:05 +00:00
Rafael Espindola 0a487a7e14 Remove unused method.
llvm-svn: 154827
2012-04-16 16:41:02 +00:00
Duncan Sands 65229ed99a Adjust for LLVM name tweaks requested by Chandler.
llvm-svn: 154824
2012-04-16 16:29:47 +00:00
Rafael Espindola 9d2874033d Add another constructor to LVFlags and use it to simplify the code a bit.
llvm-svn: 154814
2012-04-16 13:44:41 +00:00
Douglas Gregor 3024f07c12 Implement C++11 [expr.prim.general]p3, which permits the use of 'this'
in the declaration of a non-static member function after the
(optional) cv-qualifier-seq, which in practice means in the exception
specification and late-specified return type. 

The new scheme here used to manage 'this' outside of a member function
scope is more general than the Scope-based mechanism previously used
for non-static data member initializers and late-parsesd attributes,
because it can also handle the cv-qualifiers on the member
function. Note, however, that a separate pass is required for static
member functions to determine whether 'this' was used, because we
might not know that we have a static function until after declaration
matching.

Finally, this introduces name mangling for 'this' and for the implicit
'this', which is intended to match GCC's mangling. Independent
verification for the new mangling test case would be appreciated.

Fixes PR10036 and PR12450.

llvm-svn: 154799
2012-04-16 07:05:22 +00:00
Eli Friedman 250ae4a775 Add note to hacking.html that running the test harness directly from the command-line requires making sure the relevant files are generated first. Patch by Matt Fowles, with some minor modifications.
llvm-svn: 154795
2012-04-16 05:04:45 +00:00
Eli Friedman 6c31cb4d8d Make constant evaluation for pointer comparisons work correctly for some uncommon cases. <rdar://problem/10962435>.
llvm-svn: 154794
2012-04-16 04:30:08 +00:00
Sebastian Pop 980920a321 use DEFAULT_SYSROOT
llvm-svn: 154792
2012-04-16 04:16:43 +00:00
Francois Pichet 0066db9039 The result of the Microsoft __uuidof operator must be considered a global lvalue during constant expression evaluation.
Otherwise we would get this error in C++11 mode (because of a recent change):
   error: non-type template argument of type 'const _GUID *' is not a constant expression

For code like:
template <const GUID* g = &__uuidof(struct_with_uuid)>
class COM_CLASS { };

llvm-svn: 154790
2012-04-16 04:08:35 +00:00
Eli Friedman 7f1ff60021 Propagate alignment on lvalues through EmitLValueForField. PR12395.
llvm-svn: 154789
2012-04-16 03:54:45 +00:00
Nick Lewycky 247b4d54ed Add 'env' in hopes of making this test pass on Windows.
llvm-svn: 154785
2012-04-16 03:22:35 +00:00
Nick Lewycky 2bd0ab2b11 Implement the all_lookups_iterator for PCH as a follow-up to r153970. This
includes a patch from Matthias Kleine with a regression testcase!

Adds a new iterator 'data_iterator' to OnDiskHashTable which doesn't try to
reconstruct the external_key from the internal_key, which is useful for traits
that don't store enough information to do that mapping in their key. Also
deletes the 'item_iterator' from OnDiskHashTable as dead code.

llvm-svn: 154784
2012-04-16 02:51:46 +00:00
Sylvestre Ledru 21a3f764c7 Like for LLVM / shlib, we also provide a SONAME to libclang.so
llvm-svn: 154779
2012-04-15 23:17:25 +00:00
Craig Topper 8e57855ea0 Change _mm256_permute4x64_epi64 and _mm256_permute4x64_pd to use builtin_shufflevector instead of specific builtins. Old builtins will be removed from llvm now that vpermq/vpermpd are supported by shuffle lowering code.
llvm-svn: 154777
2012-04-15 22:18:10 +00:00
David Blaikie 83261063d1 Fix tests that weren't actually verifying anything.
Passing -verify to clang without -cc1 or -Xclang silently passes (with a
printed warning, but lit doesn't care about that). This change adds -cc1 or,
as is necessary in one case, -Xclang to fix this so that these tests are
actually verifying as intended.

I'd like to change the driver so this kind of mistake could not be made, but
I'm not entirely sure how. Further, since the driver only warns about unknown
flags in general, we could have similar bugs with a misspellings of arguments
that would be nice to find.

llvm-svn: 154776
2012-04-15 22:09:44 +00:00
David Blaikie 6f9f4ebc9f Correct indentation
llvm-svn: 154774
2012-04-15 21:22:10 +00:00
Gregory Szorc 5a833d6680 [clang.py] Implement TypeKind.spelling
llvm-svn: 154769
2012-04-15 18:51:10 +00:00
Duncan Sands c720e78ebc Use MDBuilder to help with metadata creation.
llvm-svn: 154767
2012-04-15 18:04:54 +00:00
Benjamin Kramer 89f0b2d8a2 Use forward declarations for ASTDeclContextNameLookupTable and add a missing delete.
It would be nice to use OwningPtr here, but DeclContextInfo is stored in a DenseMap.

llvm-svn: 154763
2012-04-15 12:36:49 +00:00
Benjamin Kramer ccdf735e52 Actually, this tree isn't necessarily binary.
llvm-svn: 154762
2012-04-15 11:35:18 +00:00
Benjamin Kramer c2a4475caa Recursively delete rewrite rope nodes when tearing down the tree.
llvm-svn: 154760
2012-04-15 11:09:40 +00:00
Seth Cantrell b0dfdfe790 %clang -cc1 -> %clang_cc1
llvm-svn: 154757
2012-04-15 04:41:49 +00:00
Richard Smith 9ec1e48b59 PR12226: don't generate wrong code if a braced string literal is used to
initialize an array of unsigned char. Outside C++11 mode, this bug was benign,
and just resulted in us emitting a constant which was double the required
length, padded with 0s. In C++11, it resulted in us generating an array whose
first element was something like  i8 ptrtoint ([n x i8]* @str to i8).

llvm-svn: 154756
2012-04-15 02:50:59 +00:00
Fariborz Jahanian 1b085428e8 objective-c modern translator: Make metadata
definition for protocols static. // rdar://11248048

llvm-svn: 154753
2012-04-14 17:13:08 +00:00
Anna Zaks d682741136 [analyzer] Add .cxx and .txx as known file extensions to ccc-analyzer.
A patch by Sean McBride.

llvm-svn: 154751
2012-04-14 16:30:00 +00:00
Rafael Espindola 0aec8ece52 Consider visibility attributes last, so that they take precedence.
I am working on a cleaner fix, but this gets the case in PR12552 passing.

llvm-svn: 154749
2012-04-14 15:21:19 +00:00
Benjamin Kramer e298063669 Replace manual delete[] with OwningArrayPtr.
llvm-svn: 154748
2012-04-14 14:13:43 +00:00
Benjamin Kramer 1d1d2d289a Don't leak vtable thunks.
llvm-svn: 154747
2012-04-14 13:21:23 +00:00
Benjamin Kramer bafc49a89c Delete late parsed attributes instead of leaking them.
llvm-svn: 154746
2012-04-14 12:44:47 +00:00
Duncan Sands 6fc461984a Rename "fpaccuracy" metadata to the more generic "fpmath". That's because I'm
thinking of generalizing it to be able to specify other freedoms beyond accuracy
(such as that NaN's don't have to be respected).  I'd like the 3.1 release (the
first one with this metadata) to have the more generic name already rather than
having to auto-upgrade it in 3.2.

llvm-svn: 154745
2012-04-14 12:37:26 +00:00
Benjamin Kramer 1e6b6060f9 Parser: Don't manage TemplateAnnotationIds in a delayed cleanup pool.
Instead, make it the allocation function's responsibility to add them
to a list and clear it when a top-level decl is finished.

This plugs leakage of TemplateAnnotationIds. DelayedCleanupPool is
ugly and unused, remove it.

llvm-svn: 154743
2012-04-14 12:14:03 +00:00
Benjamin Kramer ffe7c7f4b2 ASTUnit: Don't clone the new DiagnosticConsumer, causing it to get leaked.
llvm-svn: 154739
2012-04-14 09:11:56 +00:00
Benjamin Kramer af7ae314db c-index-test: dispose spelling string after use.
llvm-svn: 154738
2012-04-14 09:11:51 +00:00
Benjamin Kramer 73faad6409 Directly store TypoResultsMaps in the TypoEditDistanceMap, getting rid of manual deletion.
llvm-svn: 154736
2012-04-14 08:26:28 +00:00
Richard Smith c202b2809a Add an AttributedStmt type to represent a statement with C++11 attributes
attached. Since we do not support any attributes which appertain to a statement
(yet), testing of this is necessarily quite minimal.

Patch by Alexander Kornienko!

llvm-svn: 154723
2012-04-14 00:33:13 +00:00
Benjamin Kramer ac9b31a404 Delete the TypoResultsMap when erasing the pointer to it.
This manual deleting is error-prone, but we can't just put an OwningPtr in a
std::map :(

llvm-svn: 154707
2012-04-13 23:09:10 +00:00
John McCall 8c38d35b05 Don't enter cleanups for unreachable variables. It's impossible to
jump into these scopes, and the cleanup-entering code sometimes wants
to do some operations first (e.g. a GEP), which can leave us with
unparented IR.

llvm-svn: 154684
2012-04-13 18:44:05 +00:00
Fariborz Jahanian 3a5d552cd7 modern objective-c translator: Fixes translation of
__typeof which is a regression by reverting
r154360. // rdar://11233924

llvm-svn: 154679
2012-04-13 18:00:54 +00:00
Benjamin Kramer 6d3f11142d Avoid string thrashing when we can concatenate them in the final buffer.
llvm-svn: 154678
2012-04-13 18:00:37 +00:00
John McCall cf6ce28f71 Serialize and deserialize some missing bits from BlockDecl.
llvm-svn: 154676
2012-04-13 17:33:29 +00:00
Douglas Gregor 1840cc2cc6 Kill the last vestiges of clangIndex
llvm-svn: 154675
2012-04-13 17:26:32 +00:00
Douglas Gregor 11f91b9fe7 Remove clangIndex reference from clang-interpreter CMake build
llvm-svn: 154674
2012-04-13 17:22:46 +00:00
Douglas Gregor 0481c8f206 Remove the unused, unmaintained, incomplete 'Index' library.
llvm-svn: 154672
2012-04-13 16:31:46 +00:00
Fariborz Jahanian 4af0e9efdd modern objective-c translator: When translating
call to 'super' use __rw_objc_super as type of the
'super' meta-data instead of objc_super.
// rdar://11239894

llvm-svn: 154670
2012-04-13 16:20:05 +00:00
Douglas Gregor aa0df2d373 Make control flow more explicit for rebuilding property reference expressions without their OpaqueValueExprs
llvm-svn: 154669
2012-04-13 16:05:42 +00:00
Douglas Gregor adfb842fc1 Remove the -cc1-level option "-pubnames-dump". Such things should stay
out of the tree and use the tooling infrastructure.

llvm-svn: 154668
2012-04-13 16:03:00 +00:00
Douglas Gregor eba02fecdd super and class property reference expressions don't need to be
rebuilt. Fixes <rdar://problem/11052352>. 

llvm-svn: 154667
2012-04-13 15:53:08 +00:00
Anton Korobeynikov 20735d2df8 First set of tests for ARM homogenous aggregates. C only. C++ will follow.
llvm-svn: 154666
2012-04-13 11:23:39 +00:00
Anton Korobeynikov 4215ca7564 Step forward with supporting of ARM homogenous aggregates:
- Handle unions
  - Handle C++ classes

llvm-svn: 154664
2012-04-13 11:22:00 +00:00
Richard Smith d65cee9423 Implement __atomic_fetch_nand and __atomic_nand_fetch to complete our set of
GNU __atomic builtins.

llvm-svn: 154659
2012-04-13 06:31:38 +00:00
Richard Smith 822698412b PR12500: Improve the wording of the diagnostic for a redefinition of a name
in the wrong namespace scope. Patch by Jonathan Sauer!

llvm-svn: 154656
2012-04-13 04:07:40 +00:00
Seth Cantrell e83c731cad Support -Wc++98-compat-pedantic as requested:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120409/056126.html

llvm-svn: 154655
2012-04-13 03:43:23 +00:00
Richard Smith 0a465bb28e all-std-headers.cpp: Include the C++11 headers when building with clang
in -std=gnu++11 mode.

llvm-svn: 154654
2012-04-13 03:39:16 +00:00
John McCall 32233a7c1a Fix a trivial oversight with apple-kext static local destructors
and add a test case.

llvm-svn: 154653
2012-04-13 02:53:27 +00:00
Richard Smith 165039d49d Mention atomics support in the release notes.
Thanks to Nico Weber for the suggestion.

llvm-svn: 154648
2012-04-13 01:24:35 +00:00
John McCall d239387098 When we're flagging a protected scope to prevent jumps into the
shadow of a block expression with non-trivial destructed cleanups,
we should flag that in the enclosing function, not in the block
that we're about to pop.

llvm-svn: 154646
2012-04-13 01:08:17 +00:00
Richard Smith d3b64878ff Now that we provide sufficient support for three C11/C++11 atomics
implementations, mark the atomics-related parts of the C++11 status page
as done. I've not marked 'Strong Compare and Exchange' done, since although
we implement supporting builtins, we don't yet produce different code for
the weak and strong forms.

llvm-svn: 154644
2012-04-13 01:02:19 +00:00
Seth Cantrell 10ac7205ce C++11 no longer requires files to end with a newline
llvm-svn: 154643
2012-04-13 01:00:34 +00:00
Richard Smith 01ba47d7b6 Implement the missing pieces needed to support libstdc++4.7's <atomic>:
__atomic_test_and_set, __atomic_clear, plus a pile of undocumented __GCC_*
predefined macros.

Implement library fallback for __atomic_is_lock_free and
__c11_atomic_is_lock_free, and implement __atomic_always_lock_free.

Contrary to their documentation, GCC's __atomic_fetch_add family don't
multiply the operand by sizeof(T) when operating on a pointer type.
libstdc++ relies on this quirk. Remove this handling for all but the
__c11_atomic_fetch_add and __c11_atomic_fetch_sub builtins.

Contrary to their documentation, __atomic_test_and_set and __atomic_clear
take a first argument of type 'volatile void *', not 'void *' or 'bool *',
and __atomic_is_lock_free and __atomic_always_lock_free have an argument
of type 'const volatile void *', not 'void *'.

With this change, libstdc++4.7's <atomic> passes libc++'s atomic test suite,
except for a couple of libstdc++ bugs and some cases where libc++'s test
suite tests for properties which implementations have latitude to vary.

llvm-svn: 154640
2012-04-13 00:45:38 +00:00
Fariborz Jahanian 27db0b3754 objective-c modern translator: beautify rewrite of
struct __rw_objc_super; no functionality change.

llvm-svn: 154632
2012-04-12 23:52:52 +00:00
Daniel Dunbar 0d40030490 Config.h: Add another definition which the Darwin build (sometimes) uses.
llvm-svn: 154630
2012-04-12 23:19:46 +00:00
David Blaikie 9455da0ea9 Warn on 64-to-32 for source value of x bits where 64 >= x > 32.
The codepath already only works for source bits > target bits, it's just that
it was testing for the source expr bits to be exactly 64. This meant simple
cases (int i = x_long / 2) were missed & ended up under the general
-Wconversion warning, which a user might not have enabled.

llvm-svn: 154626
2012-04-12 22:40:54 +00:00
Anna Zaks 8e0785286a [analyzer] PCH deserialization optimization.
We should not deserialize unused declarations from the PCH file. Achieve
this by storing the top level declarations during parsing
(HandleTopLevelDecl ASTConsumer callback) and analyzing/building a call
graph only for those.

Tested the patch on a sample ObjC file that uses PCH. With the patch, 
 the analyzes is 17.5% faster and clang consumes 40% less memory.
Got about 10% overall build/analyzes time decrease on a large Objective
C project.

A bit of CallGraph refactoring/cleanup as well..

llvm-svn: 154625
2012-04-12 22:36:48 +00:00
Anna Zaks 9fcb055917 [analyzer] Test case for r154451 (redefining system functions).
llvm-svn: 154624
2012-04-12 22:36:43 +00:00
Fariborz Jahanian e2b037d6ea objective-c literals: Issue warning and ignore
when BOOL is not of an intergal type when
boolean literals are used. // rdar://11231426

llvm-svn: 154619
2012-04-12 21:24:56 +00:00
Douglas Gregor f9e36cccb5 s/isAtomicConversion/tryAtomicConversion/g, per Jordy's suggestion.
llvm-svn: 154613
2012-04-12 20:48:09 +00:00
Douglas Gregor 298f43df14 Fix some i1/i8 confusion within _Atomic(bool) in IR generation, both
in general (such an atomic has boolean representation) and
specifically for IR generation of __c11_atomic_init. The latter also
means actually using initialization semantics for this initialization,
rather than just creating a store.

On a related note, make sure we actually put in non-atomic-to-atomic
conversions when performing an implicit conversion sequence. IR
generation is far too kind here, but we still want the ASTs to make
sense.

llvm-svn: 154612
2012-04-12 20:42:30 +00:00
Ted Kremenek da76a94bcb Include lambda capture init expressions in CFG.
llvm-svn: 154611
2012-04-12 20:34:52 +00:00
Ted Kremenek 49a7ef5c23 Add -Wuninitialized test for C++11 lambdas.
llvm-svn: 154608
2012-04-12 20:03:47 +00:00
Ted Kremenek e2499844a2 Fix CFGBuilder to not include the body of a LambdaExpr in the CFG of the enclosing function.
llvm-svn: 154607
2012-04-12 20:03:44 +00:00
Simon Atanasyan ce74e9d896 MIPS: Initialize MIPS CPU's name by default value.
Otherwise MipsTargetInfoBase::getDefaultFeatures() might return an invalid
features set with an empty feature name.

llvm-svn: 154606
2012-04-12 19:59:24 +00:00
Douglas Gregor c79862f017 Compute standard conversion sequences for conversions to atomic
types. The second and third conversions in the sequence are based on
the conversion for the underlying type, so that we get sensible
overloading behavior for, e.g., _Atomic(int) vs. _Atomic(float).

As part of this, actually implement the lvalue-to-rvalue conversion
for atomic types. There is probably a pile of code in SemaExpr that
can now be deleted, but I haven't tracked it down yet.

llvm-svn: 154596
2012-04-12 17:51:55 +00:00
Fariborz Jahanian 30c3de97a9 objective-c numeric literal: type of boolean is
that of typedef BOOL if found.
// rdar://11231426

llvm-svn: 154595
2012-04-12 17:49:18 +00:00
Fariborz Jahanian e1240fe743 modern objective-c translator. ifdef'out
__weak and __block when rewriting.
// rdar://11236342

llvm-svn: 154592
2012-04-12 16:33:31 +00:00
Chad Rosier 2c5154224b Fix the signatures for the _mm256_storeu2_* intrinsics.
PR12532

llvm-svn: 154591
2012-04-12 16:29:08 +00:00
Erik Verbruggen 2fca3c2c87 Changed all direct calls to CompletionConsumer.reset(..) to go call
CompilerInstance::setCodeCompletionConsumer instead, in order to change
the SkipFunctionBodies flag accordingly. Also fixed
setCodeCompletionConsumer to take a reset() to null into account.

llvm-svn: 154585
2012-04-12 10:31:12 +00:00
Erik Verbruggen 6e92251f9b Added a flag to the parser to skip method bodies.
llvm-svn: 154584
2012-04-12 10:11:59 +00:00
Nick Lewycky 02f75673dd There's some code in the PCH reader that looks like it's needlessly complex, but
turns out that it's actually needed for C++ modules support. Since simplifying
it didn't cause any test failures, I'll add a test for it.

llvm-svn: 154582
2012-04-12 07:56:21 +00:00
Richard Smith feea883de4 Implement support for 18 of the GNU-compatible __atomic builtins.
This is not quite sufficient for libstdc++'s <atomic>: we still need
__atomic_test_and_set and __atomic_clear, and may need a more complete
__atomic_is_lock_free implementation.

We are also missing an implementation of __atomic_always_lock_free,
__atomic_nand_fetch, and __atomic_fetch_nand, but those aren't needed
for libstdc++.

llvm-svn: 154579
2012-04-12 05:08:17 +00:00
Eric Christopher 0b1aef2bb0 These functions too have no prototypes. Audited the rest of Sema for
FunctionDecl::Create calls as well.

rdar://11079003

llvm-svn: 154578
2012-04-12 02:16:49 +00:00
Eric Christopher 5d7fe46ceb Testcase for previous commit.
rdar://11079003

llvm-svn: 154571
2012-04-12 00:36:10 +00:00
Eric Christopher db1554c035 static functions have a need for mangled name debug information too.
The mangler doesn't like non-prototyped functions so only use a mangled
name for prototyped functions.

rdar://11079003

llvm-svn: 154570
2012-04-12 00:35:06 +00:00
Eric Christopher 56ef374611 The copy and destroy helper functions aren't prototyped, don't call them
so.

llvm-svn: 154569
2012-04-12 00:35:04 +00:00
Ted Kremenek 26a6d498ee Implement clang_getDiagnosticCategoryText() to provide a way for a client of libclang to accurately
get the diagnostic category name from a serialized diagnostic when the version of libclang used
to read the diagnostic file is newer than the clang that emitted the diagnostic file.

llvm-svn: 154567
2012-04-12 00:03:31 +00:00
Fariborz Jahanian 5811fd6cc4 modern objective-c translator. Fixes a mis-translation when
of a __block struct object. // rdar://11230308

llvm-svn: 154566
2012-04-11 23:57:12 +00:00
Eli Friedman e9c64d104f Add test for a construct we currently reject, constant-evaluating a load from a constant string. Given that gcc doesn't accept this, we should continue to not accept it, even though it was accidentally supported by clang for a brief period.
llvm-svn: 154564
2012-04-11 23:32:29 +00:00
Anna Zaks 918d52cc53 [analyzer] Another dynamic_cast false positive/negative.
llvm-svn: 154543
2012-04-11 22:29:38 +00:00
Anna Zaks f36a6f54ae [analyzer] dynamic_cast Simplify null value generation.
As per Jordy's review. Creating a symbol here is more flexible; however
I could not come up with an example where it was needed. (What
constrains can be added on of the symbol constrained to 0?)

llvm-svn: 154542
2012-04-11 22:20:07 +00:00
Anna Zaks 1a3a247041 [analyzer] Better test cases for explaining where tracking types of
symbolic regions would help.

Thanks to Richard Smith.

llvm-svn: 154541
2012-04-11 22:20:05 +00:00
Fariborz Jahanian aaf4d69ac1 modern objective-c translator. Fixes a translation bug when
first ivar in the list is a bitfield.
// rdar://11229770

llvm-svn: 154534
2012-04-11 21:12:36 +00:00
Richard Smith b8caac8e32 Part of PR10101: after a parse error in a declaration, try harder to find the
right place to pick up parsing. In C++, this had a tendency to skip everything
declared within headers if the TU starts with garbage.

llvm-svn: 154530
2012-04-11 20:59:20 +00:00
Argyrios Kyrtzidis 088041721f [libclang] Apparently it's important to build in C89, sigh..
llvm-svn: 154525
2012-04-11 19:54:09 +00:00
Argyrios Kyrtzidis 0c27e4b36b [libclang] Introduce a couple of functions to make it convenient
to get at the parameters (and their types) of a function or objc method cursor.

int clang_Cursor_getNumArguments(CXCursor C);
CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i);

rdar://11201527

llvm-svn: 154523
2012-04-11 19:32:19 +00:00
Argyrios Kyrtzidis 408403c4b5 [libclang] In cxloc::translateSourceRange make sure to handle locations in macro arguments
correctly. clang diagnostics can provide fixits inside a macro argument now.

rdar://11014346

llvm-svn: 154517
2012-04-11 18:15:01 +00:00
Richard Smith be646db000 Update recently-added test to use new __c11_ form of atomic builtins.
llvm-svn: 154514
2012-04-11 18:00:46 +00:00
Richard Smith b1e36c662b Provide, and document, a set of __c11_atomic_* intrinsics to implement C11's
<stdatomic.h> header.

In passing, fix LanguageExtensions to note that C11 and C++11 are no longer
"upcoming standards" but are now actually standardized.

llvm-svn: 154513
2012-04-11 17:55:32 +00:00
David Chisnall eb9496efc7 Make __atomic_init() (soon to be __c11_atomic_init()) work with non-scalar types.
llvm-svn: 154507
2012-04-11 17:24:05 +00:00
David Chisnall f6e07b9951 Clean up last commit as per dgregor's comments.
llvm-svn: 154501
2012-04-11 16:08:14 +00:00
David Chisnall 28397be059 Allow c++ initialisers to initialise _Atomic fields.
llvm-svn: 154499
2012-04-11 15:29:15 +00:00
Eric Christopher 03c50998cb Add a triple to this test.
llvm-svn: 154485
2012-04-11 07:08:37 +00:00
Eric Christopher d79e19ea84 Try to fix the windows buildbots by making this test a little less
dependent upon metadata ordering.

llvm-svn: 154482
2012-04-11 06:09:33 +00:00
Eric Christopher 3d19de9910 Enable debug info for objective c implementations that may not have
an explicit instance variable.

rdar://10590352

llvm-svn: 154481
2012-04-11 05:56:05 +00:00
Richard Smith 2620cd9903 Support C++11 attributes at the start of a parameter-declaration.
llvm-svn: 154476
2012-04-11 04:01:28 +00:00
Argyrios Kyrtzidis 7a9c91c407 [libclang] Fix "error: conflicts with new declaration with ‘C’ linkage" that gcc
emits but not clang.

llvm-svn: 154475
2012-04-11 03:52:18 +00:00
Argyrios Kyrtzidis ac1cc934b3 [libclang] If displayDiagnostics is set (when calling clang_createIndex), make sure to
output the errors that occurred even if we did not get an AST (e.g. because the
PCH failed to load).

Also honor displayDiagnostics in clang_indexSourceFile().

rdar://11203489

llvm-svn: 154472
2012-04-11 02:11:16 +00:00
Anna Zaks b508d29b78 [analyzer] Don't crash even when the system functions are redefined.
(Applied changes to CStringAPI, Malloc, and Taint.)

This might almost never happen, but we should not crash even if it does.
This fixes a crash on the internal analyzer buildbot, where postgresql's
configure was redefining memmove (radar://11219852).

llvm-svn: 154451
2012-04-10 23:41:11 +00:00
Richard Smith aa22a8cdcf AtomicExpr: make ASTStmtReader a friend and remove setters. Also fix saving
of an uninitialized Stmt* in serialization of __atomic_init and add a test of
atomics serialization.

llvm-svn: 154448
2012-04-10 22:49:28 +00:00
Kaelyn Uhrain 606b5291e5 Fix quoting to allow shell expansion to occur for shell variables
introduced by the test harness' expansion of %t.

llvm-svn: 154443
2012-04-10 22:27:27 +00:00
Fariborz Jahanian 31176b1485 modern objective-c translation: writing container
subscripting. // rdar://11203853

llvm-svn: 154441
2012-04-10 22:06:54 +00:00
Anna Zaks 02ecae9282 [analyzer] dynamic_cast: Better model cast from a reference.
Generate a sink when the dynamic_cast from a reference fails to
represent a thrown exception.

llvm-svn: 154438
2012-04-10 21:29:03 +00:00
Argyrios Kyrtzidis c238f06a2c [libclang] For clang_getOverriddenCursors make sure to report overridden objc methods
for methods in categories of super classes. rdar://11220358

llvm-svn: 154436
2012-04-10 21:01:03 +00:00
Anna Zaks 3bc6809ecb [analyzer] Add support for C++ dynamic_cast.
Simulate the C++ dynamic_cast in the analyzer.

llvm-svn: 154434
2012-04-10 20:59:00 +00:00
Anna Zaks daadba5d45 [analyzer] + comments
llvm-svn: 154433
2012-04-10 20:58:55 +00:00
Douglas Gregor 85f3423509 When we determine that an initialization sequence failed due to an
incomplete type, keep track of the actual type that was
incomplete. Otherwise, we might fail to produce a diagnostic. Fixes
PR12498.

llvm-svn: 154432
2012-04-10 20:43:46 +00:00
Douglas Gregor 11a434ab2e Improve the printing of __PRETTY_FUNCTION__ more provide more
information and more closely match GCC's, from Nikola Smiljanic!

llvm-svn: 154430
2012-04-10 20:14:15 +00:00
Douglas Gregor 0598962a7b Add a query macro for C++11 N3276, decltype does not require complete
return types, from Michel Morin!

llvm-svn: 154428
2012-04-10 20:00:33 +00:00
Douglas Gregor 350880c4d8 Improve diagnostics in C++11 when a non-type template argument for a
non-type template parameter of pointer type is not a constant expression.

llvm-svn: 154424
2012-04-10 19:03:30 +00:00
Eric Christopher eacf8056b1 This test actually needs label names.
PR9796

llvm-svn: 154422
2012-04-10 18:36:52 +00:00
Douglas Gregor 2997914ed0 Include the Objective-C parameter- and return-passing qualifiers when
providing code completions for Objective-C method declarations. Fixes
<rdar://problem/11164498>.

llvm-svn: 154421
2012-04-10 18:35:07 +00:00
Eric Christopher 0241e32304 For debug and coverage analysis if we're not optimizing go ahead
and emit a relatively empty block for a plain break statement. This
enables us to track where we went through a switch.

PR9796 & rdar://11215207

llvm-svn: 154420
2012-04-10 18:20:19 +00:00
Douglas Gregor 9489cdf29f Don't include the ':' following code-completion suggestions for
'public', 'private', or 'protected', unless code completion patterns
are enabled. Fixes <rdar://problem/11189132>.

llvm-svn: 154413
2012-04-10 17:56:28 +00:00
Fariborz Jahanian ca5c597fd0 objective-c: remove IsConstProperty as it does not
seem to get called any more. Also add an assert in
isModifiableLvalue.

llvm-svn: 154410
2012-04-10 17:30:10 +00:00
Argyrios Kyrtzidis 141e17ae8b Add a target triple to test/Index/complete-synthesized.m.
llvm-svn: 154409
2012-04-10 17:23:51 +00:00
Argyrios Kyrtzidis 9d7c0fef65 [code-complete] Introduce CodeCompletionTUInfo which will be used for caching
code-completion related strings specific to a translation unit (ASTContext and related data)

CodeCompletionAllocator does such limited caching, by caching the name assigned
to a DeclContext*, but that is not the appropriate place since that object has
a lifetime that can extend beyond that of an ASTContext.

Introduce CodeCompletionTUInfo which will be always tied to a translation unit
to do this kind of caching and move the caching of CodeCompletionAllocator into this
object, and propagate it to all the places where it will be needed.

The plan is to extend the caching where appropriate, using CodeCompletionTUInfo,
to avoid re-calculating code-completion strings.

Part of rdar://10796159.

llvm-svn: 154408
2012-04-10 17:23:48 +00:00
Douglas Gregor 20fdef32dd Rework implementation of null non-type template arguments based on
Richard's feedback, to properly catch non-constant expressions and
type mismatches. Finishes <rdar://problem/11193097>.

llvm-svn: 154407
2012-04-10 17:08:25 +00:00
Fariborz Jahanian e84595d618 objective-c: add an assertion for property
expression enterring IsConstProperty function.

llvm-svn: 154406
2012-04-10 16:44:52 +00:00
Chandler Carruth d8f7d38f07 Fix GCC's pedantic return-type warning -- this enum is fully covered.
llvm-svn: 154399
2012-04-10 16:03:08 +00:00
Manuel Klimek 1baf89eac9 Fix tautological FileCheck by moving the CHECK to an extra line.
llvm-svn: 154393
2012-04-10 12:12:33 +00:00
David Chisnall 3d127c79e8 Don't link lib[std]c++ when -nostdlib is specified (Solaris driver).
Patch by Dmitri Shubin!

llvm-svn: 154392
2012-04-10 11:49:50 +00:00
Evgeniy Stepanov 70cb3d623b Pass -march, -mcpu, -mfpu to linuxtools assembler.
llvm-svn: 154389
2012-04-10 09:05:40 +00:00
Duncan Sands e81111ca71 Express the number of ULPs in fpaccuracy metadata as a real rather than a
rational number, eg as 2.5 rather than 5, 2.  OK'd by Peter Collingbourne.

llvm-svn: 154388
2012-04-10 08:23:07 +00:00
Eric Christopher 3910ec96cb EmitStopPoint already checks if we have debug info.
llvm-svn: 154384
2012-04-10 05:04:07 +00:00
Eric Christopher cdbde6973a Tidy.
llvm-svn: 154383
2012-04-10 05:04:04 +00:00
Richard Smith 3dff251da1 Parsing of C++11 attributes:
* Alternative tokens (such as 'compl') are treated as identifiers in
   attribute names.
 * An attribute-list can start with a comma.
 * An ellipsis may not be used with either of our currently-supported
   C++11 attributes.

llvm-svn: 154381
2012-04-10 03:25:07 +00:00
Richard Smith 7bdcc4a9da Disambiguation of '[[':
* In C++11, '[[' is ill-formed unless it starts an attribute-specifier. Reject
   array sizes and array indexes which begin with a lambda-expression. Recover by
   parsing the lambda as a lambda.
 * In Objective-C++11, either '[' could be the start of a message-send.
   Fully disambiguate this case: it turns out that the grammars of message-sends,
   lambdas and attributes do not actually overlap. Accept any occurrence of '[['
   where either '[' starts a message send, but reject a lambda in an array index
   just like in C++11 mode.

Implement a couple of changes to the attribute wording which occurred after our
attributes implementation landed:
 * In a function-declaration, the attributes go after the exception specification,
   not after the right paren.
 * A reference type can have attributes applied.
 * An 'identifier' in an attribute can also be a keyword. Support for alternative
   tokens (iso646 keywords) in attributes to follow.

And some bug fixes:
 * Parse attributes after declarator-ids, even if they are not simple identifiers.
 * Do not accept attributes after a parenthesized declarator.
 * Accept attributes after an array size in a new-type-id.
 * Partially disamiguate 'delete' followed by a lambda. More work is required
   here for the case where the lambda-introducer is '[]'.

llvm-svn: 154369
2012-04-10 01:32:12 +00:00
Rafael Espindola fc1562dbca Fix the testcase :-(
llvm-svn: 154363
2012-04-10 00:13:42 +00:00
Fariborz Jahanian 2c00acd67f objective-c modern translator: rewriting specific
implicit casts which is needed to produce good c++
code. // rdar://11202764

llvm-svn: 154360
2012-04-10 00:08:18 +00:00
Rafael Espindola 9446d76e80 Fix an annoying little bug I found while debugging another LTO issue. Gold
requires the -plugin to come before any -plugin-opt options, we were passing
them the other way around. With this one can run (for example):

clang -o foo foo.c -O4 -Wl,-plugin-opt=generate-api-file

llvm-svn: 154357
2012-04-09 23:53:34 +00:00
Fariborz Jahanian b5aa43210d Remove -fobjc-default-synthesize-properties as the option
to c-index-test.

llvm-svn: 154347
2012-04-09 22:17:37 +00:00
John McCall dd1eca34b5 My original patch missed the virtual-base case for destroying
base-class subojects.

Incidentally, thinking about virtual bases makes it clear to me that
we're not appropriately computing the access to the virtual base's
member because we're not computing the best possible access to the
virtual base at all;  in fact, we're basically assuming it's public.
I'll file a separate PR about that.

llvm-svn: 154346
2012-04-09 21:51:56 +00:00
John McCall d42742143c Fix the access check performed as part of the determination of whether
to define a special member function as deleted so that it properly
establishes an object context for the accesses to the base subobject
members.

llvm-svn: 154343
2012-04-09 20:53:23 +00:00
Daniel Dunbar 883f2bb1f9 Author: Daniel Dunbar <daniel@zuster.org>
--- log message follows this test ---
[tests] Fixup some tests to work in "CLANG_IS_PRODUCTION" mode.

llvm-svn: 154342
2012-04-09 20:40:11 +00:00
Manuel Klimek 35fa2655dd Implementing a test for the use of PWD to base finding the
correct compile commands on, based on an idea by Jordan Rose.

llvm-svn: 154335
2012-04-09 19:10:04 +00:00
Fariborz Jahanian 0568407543 objective-c: remove -fobjc-default-synthesize-properties from the driver.
cc1 option remains though to invoke default property synthesis.
// rdar://11209719

llvm-svn: 154334
2012-04-09 18:58:55 +00:00
Fariborz Jahanian ba8ef296e4 objective-c: Remove -fno-objc-default-synthesize-properties
as the driver option.
// rdar://11209719

llvm-svn: 154331
2012-04-09 18:20:28 +00:00
Manuel Klimek 3521ae9580 Fixes a fix to finding the current directory:
We currently want to look whether PWD is available - if PWD is available it will
get us the non-resolved current path, while fs::current_path will resolve
symlinks. The long term fix is to not rely on that behavior any more.

llvm-svn: 154330
2012-04-09 18:08:23 +00:00
David Chisnall 58464d0fe1 Revert r154321, pending more discussion.
llvm-svn: 154327
2012-04-09 17:25:11 +00:00
David Blaikie 80cdddc504 Fix bugs found by -Wconstant-conversion improvements currently under review.
Specifically, using a an integer outside [0, 1] as a boolean constant seems to
be an easy mistake to make with things like "x == a || b" where the author
intended "x == a || x == b".

The bug caused by calling SkipUntil with three token kinds was also identified
by a VC diagnostic & reported by Francois Pichet as review feedback for my
commit r154163. I've included test cases to verify the error recovery that was
broken/poorly implemented due to this bug.

The other fix (lib/Sema/SemaExpr.cpp) seems like that code was never actually
reached in any of Clang's tests & is related to Objective C features I'm not
familiar with, so I've not been able to construct a test case for it. Perhaps
someone else can.

llvm-svn: 154325
2012-04-09 16:37:11 +00:00
David Chisnall 4ec2af2fab Add -fobjc-trace to emit a call before and after each Objective-C message send
for hooking in code flow visualisation applications.  

llvm-svn: 154321
2012-04-09 15:42:15 +00:00
Anton Korobeynikov a29e4627bc Factor out ARM floating ABI determination to new routine
llvm-svn: 154318
2012-04-09 13:38:30 +00:00
David Chisnall a27cf0e6e1 Make a modern Objective-C runtime the default target for *BSD. Don't yet change this on GNU/Linux, where the GCC runtime still tends to be used.
llvm-svn: 154315
2012-04-09 12:33:41 +00:00
Chandler Carruth 097d019c6c Wire up -fpie and -fPIE to LLVM's newly added TargetOptions. No test
case as we don't currently have any way of dumping target options or
otherwise observing this. Another small step toward fixing PR12380. With
this we generate TLS accesses using the static model instead of the
dynamic model, but we're still generating suboptimal code under the
mistaken assumption that the TLS offset might be greater than 2^32, and
therefor not viable as an immediate offset of a segment register.

llvm-svn: 154298
2012-04-08 21:09:51 +00:00
Chandler Carruth c0c0455f55 Teach Clang about PIE compilations. This is the first step of PR12380.
First, this patch cleans up the parsing of the PIC and PIE family of
options in the driver. The existing logic failed to claim arguments all
over the place resulting in kludges that marked the options as unused.
Instead actually walk all of the arguments and claim them properly.

We now treat -f{,no-}{pic,PIC,pie,PIE} as a single set, accepting the
last one on the commandline. Previously there were lots of ordering bugs
that could creep in due to the nature of the parsing. Let me know if
folks would like weird things such as "-fPIE -fno-pic" to turn on PIE,
but disable full PIC. This doesn't make any sense to me, but we could in
theory support it.

Options that seem to have intentional "trump" status (-static, -mkernel,
etc) continue to do so and are commented as such.

Next, a -pie-level flag is threaded into the frontend, rigged to
a language option, and handled preprocessor, setting up the appropriate
defines. We'll now have the correct defines when compiling with -fpie.

The one place outside of the preprocessor that was inspecting the PIC
level (as opposed to the relocation model, which is set and handled
separately, yay!) is in the GNU ObjC runtime. I changed it to exactly
preserve existing behavior. If folks want to change its behavior in the
face of PIE, they can do that in a separate patch.

Essentially the only functionality changed here is the preprocessor
defines and bug-fixes to the argument management.

Tests have been updated and extended to test all of this a bit more
thoroughly.

llvm-svn: 154291
2012-04-08 16:40:35 +00:00
Chandler Carruth 4e97337914 Rephrase the preprocessor test to directly use CC1 and not bother
testing any of the strange driver behavior. We already have some tiny
tests for the driver behavior, and I'm going to expand them greatly in
the next commit.

llvm-svn: 154290
2012-04-08 16:40:31 +00:00
Chandler Carruth f4725b468e FileCheck-ize this test.
llvm-svn: 154289
2012-04-08 16:40:30 +00:00
Richard Smith 4051ff7650 Don't forget to evaluate the subexpression in a null pointer cast. If we're
converting from std::nullptr_t, the subexpression might have side-effects.

llvm-svn: 154278
2012-04-08 08:02:07 +00:00
Francois Pichet 7ebc4c1910 ext_reserved_user_defined_literal must not default to Error in MicrosoftMode. Hence create ext_ms_reserved_user_defined_literal that doesn't default to Error; otherwise MSVC headers won't parse.
Fixes PR12383.

llvm-svn: 154273
2012-04-07 23:09:23 +00:00
Simon Atanasyan 571d7bde3c MIPS: Pass -mabi option to the assmbler when compile MIPS targets.
llvm-svn: 154270
2012-04-07 22:31:29 +00:00
Simon Atanasyan 3b7589a6c3 MIPS: Move code calculates CPU and ABI names to the separate function to reuse this function later.
llvm-svn: 154269
2012-04-07 22:09:23 +00:00
NAKAMURA Takumi a7d49883bb [Cygwin] Work around to flush stdout in a thread, or stdout in threads won't be flushed at exit.
llvm-svn: 154254
2012-04-07 06:59:28 +00:00
John McCall 5dadb65e07 Fix several problems with protected access control:
- The [class.protected] restriction is non-trivial for any instance
    member, even if the access lacks an object (for example, if it's
    a pointer-to-member constant).  In this case, it is equivalent to
    requiring the naming class to equal the context class.
  - The [class.protected] restriction applies to accesses to constructors
    and destructors.  A protected constructor or destructor can only be
    used to create or destroy a base subobject, as a direct result.
  - Several places were dropping or misapplying object information.

The standard could really be much clearer about what the object type is
supposed to be in some of these accesses.  Usually it's easy enough to
find a reasonable answer, but still, the standard makes a very confident
statement about accesses to instance members only being possible in
either pointer-to-member literals or member access expressions, which
just completely ignores concepts like constructor and destructor
calls, using declarations, unevaluated field references, etc.

llvm-svn: 154248
2012-04-07 03:04:20 +00:00
NAKAMURA Takumi c4d558a43e test/lit.cfg: Please pass %INCLUDE% to clang.exe on Win32. MS-compatible clang may refer to %INCLUDE%. It fixes r154188.
llvm-svn: 154240
2012-04-07 01:02:53 +00:00
Chad Rosier 706c235013 [driver] In general, the driver claims redundant args and uses the last arg.
However, the '-x' option has special handling and wasn't following this
paradigm.  Fix it to do so by claiming the arg as we parse the '-x' option.
rdar://11203340

llvm-svn: 154231
2012-04-07 00:01:31 +00:00
David Blaikie 89f13cb5bf Remove "parse error" in favor of more descriptive diagnostics.
In a few cases clang emitted a rather content-free diagnostic: 'parse error'.
This change replaces two actual cases (template parameter parsing and K&R
parameter declaration parsing) with more specific diagnostics and removes a
third dead case of this in the BalancedDelimiterTracker (the ctor already
checked the invariant necessary to ensure that the diag::parse_error was never
actually used).

llvm-svn: 154224
2012-04-06 23:33:59 +00:00
Fariborz Jahanian 668b9e9c65 more testing of objc's dictionary literal translation.
llvm-svn: 154220
2012-04-06 22:51:48 +00:00
Douglas Gregor 31f55dced5 Implement support for null non-type template arguments for non-type
template parameters of pointer, pointer-to-member, or nullptr_t
type in C++11. Fixes PR9700 / <rdar://problem/11193097>.

llvm-svn: 154219
2012-04-06 22:40:38 +00:00
Fariborz Jahanian 4460e0f805 modern objective-c translation: support for
dictionary literals. This concludes // rdar://10803676

llvm-svn: 154218
2012-04-06 22:29:36 +00:00
Ted Kremenek a85f38ba3a Rework ExprEngine::evalLoad and clients (e.g. VisitBinaryOperator) so that when we generate a new ExplodedNode
we use the same Expr* as the one being currently visited.  This is preparation for transitioning to having
ProgramPoints refer to CFGStmts.

This required a bit of trickery.  We wish to keep the old Expr* bindings in the Environment intact,
as plenty of logic relies on it and there is no reason to change it, but we sometimes want the Stmt* for
the ProgramPoint to be different than the Expr* being used for bindings.  This requires adding an extra
argument for some functions (e.g., evalLocation).  This looks a bit strange for some clients, but
it will look a lot cleaner when were start using CFGStmt* in the appropriate places.

As some fallout, the diagnostics arrows are a bit difference, since some of the node locations have changed.
I have audited these, and they look reasonable.

llvm-svn: 154214
2012-04-06 22:10:18 +00:00
Benjamin Kramer 543036a447 SourceManager: Vectorize ComputeLineNumbers for SSE2.
This method is very hot, it is called when emitting diagnostics, in -E mode
and for many #pragma handlers. It scans through the whole source file to
count newlines, records and caches them in a vector.

The speedup from vectorization isn't very large, as we fall back to bytewise
scanning when we hit a newline. There might be a way to avoid leaving the sse
loop but everything I tried didn't work out because a call to push_back
clobbers xmm registers.

About 2% speedup on average on "clang -E > /dev/null" of all .cpp files in
clang's lib/Sema.

llvm-svn: 154204
2012-04-06 20:49:55 +00:00
Simon Atanasyan 1e1e2e2d9a MIPS: Provide a correct path to the dynamic linker when build for MIPS 64-bit targets.
llvm-svn: 154200
2012-04-06 20:14:27 +00:00
DeLesley Hutchins 481d5abf45 Thread safety analysis: downgraded requirement that mutex expressions refer to a lockable type from error to warning.
llvm-svn: 154198
2012-04-06 20:02:30 +00:00
Fariborz Jahanian e110fe4ac7 modern objective-c translator: translate array literal
expressions. // rdar://10803676

llvm-svn: 154196
2012-04-06 19:47:36 +00:00
Simon Atanasyan 2390aa1813 MIPS: Pass -EB/-EL argument to the assembler according to selected endian when compile for MIPS targets.
llvm-svn: 154195
2012-04-06 19:15:24 +00:00
Jordy Rose c0230d7a35 [analyzer] Check that the arguments to NSOrderedSet creation methods are valid ObjC objects.
Patch by Sean McBride!

llvm-svn: 154194
2012-04-06 19:06:01 +00:00
Matt Beaumont-Gay 6fb26f8c7e Test for r154189/PR12481
llvm-svn: 154193
2012-04-06 18:47:27 +00:00
John McCall 76cc43a2a4 Use atexit when __cxa_atexit isn't available instead of adding a
global destructor entry.  For some reason this isn't enabled for
apple-kexts;  it'd be good to have documentation for that.

Based on a patch by Nakamura Takumi!

llvm-svn: 154191
2012-04-06 18:21:06 +00:00
John McCall ee08c53478 Rename GenerateCXXGlobalDtorFunc to GenerateCXXGlobalDtorsFunc.
llvm-svn: 154190
2012-04-06 18:21:03 +00:00
John McCall ed7b27830d Fix a Sema invariant bug that I recently introduced involving
the template instantiation of statement-expressions.

I think it was jyasskin who had a crashing testcase in this area;
hopefully this fixes it and he can find his testcase and check it in.

llvm-svn: 154189
2012-04-06 18:20:53 +00:00
Jordy Rose 0e09facb85 Clear environment variables that might affect Clang before running tests.
llvm-svn: 154188
2012-04-06 18:14:01 +00:00
Patrick Beard acfbe9e1f2 Added a new attribute, objc_root_class, which informs the compiler when a root class is intentionally declared.
The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger
the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698>

llvm-svn: 154187
2012-04-06 18:12:22 +00:00
Simon Atanasyan 5e21c800e8 MIPS: Move tests check float ABI macros definitions to the more appropriate place.
llvm-svn: 154184
2012-04-06 17:51:49 +00:00
Chandler Carruth 69a125bf02 Fix using Clang as a cross compiler installed on a host machine and not
inside of a sysroot targeting a system+sysroot which is "similar" or
"compatible" with the host system. This shows up when trying to build
system images on largely compatible hardware as-if fully cross compiled.

The problem is that previously we *perfectly* mimiced GCC here, and it
turns out GCC has a bug that no one has really stumbled across. GCC will
try to look in thy system prefix ('/usr/local' f.ex.) into which it is
instaled to find libraries installed along side GCC that should be
preferred to the base system libraries ('/usr' f.ex.). This seems not
unreasonable, but it has a very unfortunate consequence when combined
with a '--sysroot' which does *not* contain the GCC installation we're
using to complete the toolchain. That results in some of the host
system's library directories being searched during the link.

Now, it so happens that most folks doing stuff like this use
'--with-sysroot' and '--disable-multilib' when configuring GCC. Even
better, they're usually not cross-compiling to a target that is similar
to the host. As a result, searching the host for libraries doesn't
really matter -- most of the time weird directories get appended that
don't exist (no arm triple lib directory, etc). Even if you're
cross-compiling from 32-bit to 64-bit x86 or vice-versa, disabling
multilib makes it less likely that you'll actually find viable libraries
on the host. But that's just luck. We shouldn't rely on this, and this
patch disables looking in the system prefix containing the GCC
installation if that system prefix is *outside* of the sysroot. For
empty sysroots, this has no effect. Similarly, when using the GCC
*inside* of the sysroot, we still track wherever it is installed within
the sysroot and look there for libraries. But now we can use a cross
compiler GCC installation outside the system root, and only look for the
crtbegin.o in the GCC installation, and look for all the other libraries
inside the system root.

This should fix PR12478, allowing Clang to be used when building
a ChromiumOS image without polluting the image with libraries from the
host system.

llvm-svn: 154176
2012-04-06 16:32:06 +00:00
David Chisnall a79b469d73 zext ivar offsets if required (GNU runtimes).
llvm-svn: 154175
2012-04-06 15:39:12 +00:00