Commit Graph

32160 Commits

Author SHA1 Message Date
David Majnemer af71402e7b Sema: Remove dead code in CheckTemplateArgumentAddressOfObjectOrFunction
Summary:
DeclRefExpr::getDecl gives us back a ValueDecl, this isa<> check will
never fire.

Reviewers: eli.friedman, doug.gregor, majnemer

Reviewed By: majnemer

CC: cfe-commits

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

llvm-svn: 188647
2013-08-19 02:43:08 +00:00
Craig Topper 048b883416 Revert r188644 to unbreak buildbots.
llvm-svn: 188645
2013-08-18 20:38:37 +00:00
Craig Topper 260f7e6893 Remove Stmt::operator new that takes a ASTContext*. All callers use the ASTContext& version.
llvm-svn: 188644
2013-08-18 20:03:21 +00:00
David Blaikie 25b2085490 Revert "Revert "DebugInfo: Omit debug info for dynamic classes in TUs that do not have the vtable for that class""
This reverts commit r188600.

r188640/r188639 fixed the root cause of the crash-on-valid that r188600
originally introduced. This now appears to bootstrap debug clang
successfully to the best of my testing.

llvm-svn: 188642
2013-08-18 17:59:12 +00:00
Craig Topper 5a050016bb Remove throw() from Stmt::operator new so the compiler will omit the null check on the result since ASTContext allocator won't return null.
llvm-svn: 188641
2013-08-18 17:45:38 +00:00
David Blaikie d278589329 DebugInfo: Avoid duplicating types that may be created during the process of creating their context
A partner to r188639, this is a somewhat heavy-handed fix to the general
issue, since even after that prior change the issue does still
unavoidably arise with template parameters (see test case).

There are other ways we could consider addressing this (see FIXME).

llvm-svn: 188640
2013-08-18 17:36:19 +00:00
David Blaikie adfbf993d6 DebugInfo: Don't emit vbase 'containing types' for context chain limited types
Possible minor reduction in debug info & avoid some cases where creating
a context chain could lead to the type the context chain is being
created for, being created. (this is still possible with template
parameters - tests/fixes/improvements to follow)

llvm-svn: 188639
2013-08-18 16:55:33 +00:00
NAKAMURA Takumi c96c699a16 InitHeaderSearch.cpp: [Cygwin] Add 4.7.3.
llvm-svn: 188638
2013-08-18 15:03:03 +00:00
Craig Topper 3793291d50 Make expression allocation methods use a 'const' reference to the ASTContext since the underlying operator new only needs a const reference.
llvm-svn: 188636
2013-08-18 10:09:15 +00:00
Chandler Carruth 7deaae76ec Fix a use-after-free found in libclang when doing code completion. The
loop processing the candidates can cause new declerations to be added to
the context, invalidating lookup_result. To avoid that, make a copy of
the list of declarations to iterate over.

I don't have a way to check in a test case for this as it involves
a giant pile of source code and a generated PCH file used to accelerate
code completion, all of this running under ASan.

llvm-svn: 188623
2013-08-18 07:20:52 +00:00
David Blaikie 5043815a60 DebugInfo: don't require full definitions for friend classes
Fixes a crash-on-valid introduced by r188486 (which should've occurred
earlier but for a blatant bug where calling createFwdDecl from the
requireCompleteType callback was useless under -flimit-debug-info and we
were just getting lucky with other later callbacks requiring the type
anyway).

llvm-svn: 188622
2013-08-18 04:50:23 +00:00
David Blaikie 949939cdbb PR16927: Don't assert (or, previously, skip) static data members of enumeration type
llvm-svn: 188612
2013-08-17 20:01:53 +00:00
Juergen Ributzka 2c2dbf4542 Fix the name and the type of the argument for intrinisc
_mm256_broadcastsi128_si256 to align with the Intel documentation.

This fixes bug PR 16581 and rdar:14747994.

llvm-svn: 188609
2013-08-17 16:40:09 +00:00
Richard Smith f9b1510576 Refactor all diagnosing of TypoCorrections through a common function, in
preparation for teaching this function how to diagnose a correction that
includes importing a module.

llvm-svn: 188602
2013-08-17 00:46:16 +00:00
Argyrios Kyrtzidis 15a2fccb78 Rename libIDE to libIndex.
Per feedback from Chandler, it's better to have libraries with more specific functionality.
LibIndex will contain the indexing functionality of libclang, which includes USR generation.

llvm-svn: 188601
2013-08-17 00:40:41 +00:00
David Blaikie 7d5d7c7e90 Revert "DebugInfo: Omit debug info for dynamic classes in TUs that do not have the vtable for that class"
This reverts commit r188576.

Reverting while I investigate a selfhosting buildbot failure on Darwin.

llvm-svn: 188600
2013-08-17 00:06:55 +00:00
Fariborz Jahanian 2ec4d7ba07 ObjectiveC migrator: Add some more routines
for future work. No change otherwise.

llvm-svn: 188591
2013-08-16 23:35:05 +00:00
Rafael Espindola 87198cd35c Don't reject attribute used in an "extern const" variable definition.
Before this patch we would warn and drop the attribute in
extern const char test3[] __attribute__((used)) = "";

llvm-svn: 188588
2013-08-16 23:18:50 +00:00
Ted Kremenek e19529b3d8 Use the number of parameters in the actual method or function to determine the CallEffects size.
llvm-svn: 188587
2013-08-16 23:14:22 +00:00
David Blaikie 9fdedec489 DebugInfo: Canonicalize namespaces to avoid emitting multiple namespaces with the same name but different lines
Updated test case to not rely on line numbers in more cases (it's hard
to use the @ check syntax for debug info test cases (due to the
interesting ordering of metadata) and this case in particular (given the
hash-line directive)) - left a few in there to cover the line number
information for these.

llvm-svn: 188585
2013-08-16 22:52:07 +00:00
Benjamin Kramer ab3838ab98 RetainCountChecker: Replace some loops with std:: algorithms.
llvm-svn: 188581
2013-08-16 21:57:14 +00:00
Benjamin Kramer 91c9867049 Replace some DenseMap keys with simpler structures that don't need another DenseMapInfo specialization.
llvm-svn: 188580
2013-08-16 21:57:06 +00:00
Ted Kremenek 63234c1bbd Revert r188574. Turns out it isn't needed.
llvm-svn: 188578
2013-08-16 21:54:22 +00:00
David Blaikie 9eddbbd563 DebugInfo: Omit debug info for dynamic classes in TUs that do not have the vtable for that class
This reduces Clang's .dwo (fission debug info) size by 23% over
Clang+LLVM.

llvm-svn: 188576
2013-08-16 20:40:29 +00:00
David Blaikie ab255bb9cf DebugInfo: Contrain the record type parameter for CollectRecordFields
This is the correct type (as is demonstrated by the fact that the caller
didn't need to change) & will be useful in a future patch.

llvm-svn: 188575
2013-08-16 20:40:25 +00:00
Fariborz Jahanian 36362016d3 Need summary info. about arguments to
CF functions coming from static analyzer API.

llvm-svn: 188574
2013-08-16 20:23:36 +00:00
Argyrios Kyrtzidis 4b2b460893 Introduce the clangIDE library.
Libclang has a lot of functionality that is inaccessible.
The purpose of clangIDE is to move most of the functionality of libclang to it so we
can expose it and have libclang be more of a thin C wrapper over clangIDE.

Start by moving the USR generation functionality into clangIDE.

llvm-svn: 188569
2013-08-16 18:17:55 +00:00
Samuel Benzaquen bd7d887f18 Refactor ArgumentAdaptativeMatcher matchers to remove the template from their declaration.
Summary:
Refactor ArgumentAdaptativeMatcher matchers to remove the template from their declaration.
This facilitates dynamic registration. Change the registry code to use the regular overload resolution mechanism for adaptative matchers.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 188560
2013-08-16 16:19:42 +00:00
Edwin Vane 19f66290e4 Tweak Replacement comparisons
* Introduce operator< to replace Replacement::Less
* Make operator== and operator< on Replacements non-member functions
* Change order of comparisons in operator< to do string comparisons last

llvm-svn: 188550
2013-08-16 12:18:53 +00:00
Daniel Jasper de0328aea8 Split UnwrappedLineFormatter into individual components.
Goals: Structure code better and make components easier to use for
future features (e.g. column layout for long braced initializers).

No functional changes intended.

llvm-svn: 188543
2013-08-16 11:20:30 +00:00
Evgeniy Stepanov 37b3f73690 Revert r188498.
This change broke release+asserts build with compiler-rt.

llvm-svn: 188539
2013-08-16 10:35:31 +00:00
David Majnemer f0a84f200a Parse: Do not 'HandleTopLevelDecl' on templated functions.
Summary:
HandleTopLevelDecl on a templated function leads us to try and mangle
it.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits

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

llvm-svn: 188536
2013-08-16 08:29:13 +00:00
Hans Wennborg 2393799609 Windows ToolChain: add VS bin dir to PogramPaths
We have a lot of fancy logic to find Visual Studio, which is currently used
to set the system header include paths.

Use the same code to set the ProgramPaths, which is used for finding programs
such as link.exe. Previously, Clang would just search PATH for link.exe,
but now it should find it if it's able to find Visual Studio.

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

llvm-svn: 188531
2013-08-16 03:15:10 +00:00
Jordan Rose 367843a04c [analyzer] Merge TextPathDiagnostics and ClangDiagPathDiagConsumer.
This once again restores notes to following their associated warnings
in -analyzer-output=text mode. (This is still only intended for use as a
debugging aid.)

One twist is that the warning locations in "regular" analysis output modes
(plist, multi-file-plist, html, and plist-html) are reported at a different
location on the command line than in the output file, since the command
line has no path context. This commit makes -analyzer-output=text behave
like a normal output format, which means that the *command line output
will be different* in -analyzer-text mode. Again, since -analyzer-text is
a debugging aid and lo-fi stand-in for a regular output mode, this change
makes sense.

Along the way, remove a few pieces of stale code related to the path
diagnostic consumers.

llvm-svn: 188514
2013-08-16 01:06:30 +00:00
Eli Friedman 9ee175d8f0 Don't allow unary negation on scoped enums.
PR16900.

llvm-svn: 188511
2013-08-16 00:09:18 +00:00
Eli Friedman 2a1d9a9290 Fix for dependent contexts in alias templates.
When we are parsing a type for an alias template, we are not entering
the context, so we can't look into dependent classes.  Make sure the
parser handles this correctly.

PR16904.

llvm-svn: 188510
2013-08-15 23:59:20 +00:00
DeLesley Hutchins 9f5193cf61 Thread Safety Analysis: fix bug when using TryLock with && and || expressions.
llvm-svn: 188505
2013-08-15 23:06:33 +00:00
David Blaikie ae01946afa DebugInfo: CollectRecordStaticField -> CreateRecordStaticField to return its result.
llvm-svn: 188501
2013-08-15 22:50:29 +00:00
David Blaikie 952dac3b7f Remove unnecessary explicit cast.
llvm-svn: 188500
2013-08-15 22:42:12 +00:00
David Blaikie 6dc689670c DebugInfo: Split out the implementation of getStaticDataMemberDeclaration for future use
llvm-svn: 188498
2013-08-15 22:30:23 +00:00
David Blaikie b840c48de2 Fix assert added in r188494
llvm-svn: 188496
2013-08-15 22:18:13 +00:00
Eli Friedman 89fe0d5842 Properly track l-paren of a CXXFucntionalCastExpr.
In addition to storing more useful information in the AST, this
fixes a semantic check in template instantiation which checks whether
the l-paren location is valid.

Fixes PR16903.

llvm-svn: 188495
2013-08-15 22:02:56 +00:00
David Blaikie 35b22f6985 DebugInfo: Remove unused conditional
llvm-svn: 188494
2013-08-15 21:55:56 +00:00
Fariborz Jahanian 84ac1ded83 ObjectiveC migrator. Start annotating CF functions
with CF_RETURNS_RETAINED/CF_RETURNS_NOT_RETAINED as
appropriate.

llvm-svn: 188493
2013-08-15 21:44:38 +00:00
David Blaikie a0ef9fa6bf DebugInfo: Make CGDebugInfo::getStaticDataMemberDeclaration's argument type match the semantics
Rather than having a cast immediately inside the function, push that
type requirement out to the callers.

llvm-svn: 188492
2013-08-15 21:42:43 +00:00
David Blaikie 6a7234472e DebugInfo: Add a FIXME, remove a FIXME.
(the removed FIXME no longer applies since we made this debug info
optimization not apply to C)

llvm-svn: 188491
2013-08-15 21:21:19 +00:00
Renato Golin 3d510b3db8 make arm-use-movt available for all ARM
This updates clang according to a pending patch for llvm to
rename of the -arm-darwin-use-movt to arm-use-movt to make
it available for all of ARM.

note: please apply this close to the llvm change.

Patch by Jeroen Hofstee.

llvm-svn: 188488
2013-08-15 20:54:45 +00:00
David Blaikie b2e86eb64a DebugInfo: Unify & optimize the lazy addition of record types
Rather than going through the whole getOrCreateType machinery to
manifest a type, cut straight to the implementation because we know we
have to do work.

While the previous implementation was sufficient for the two cases
(completeness and required completeness) we have already (the general
machinery could inspect the type for those attributes & go down the full
definition path), a pending change (to emit info for types when we emit
their vtables) won't have that luxury & we'll need to force the creation
rather than relying on the general purpose routine.

llvm-svn: 188486
2013-08-15 20:49:17 +00:00
David Blaikie 4e7ef80e68 DebugInfo: Revert change to the return type of createRecordFwdDecl
It still does only return DICompositeType, but I've no need to make that
change right now.

llvm-svn: 188482
2013-08-15 20:17:25 +00:00
David Majnemer bbecd09658 CodeGen: __uuidof should work even with an incomplete _GUID type
Summary:
We would crash in CodeGen::CodeGenModule::EmitUuidofInitializer
because our attempt to enter CodeGen::CodeGenModule::EmitConstantValue
will be foiled: the type of the constant value is incomplete.

Instead, create an unnamed type with the proper layout on all platforms.
Punt the problem of wrongly defined struct _GUID types to the user.
(It's impossible because the TU may never get to see the type and thus
we can't verify that it is suitable.)

This fixes PR16856.

Reviewers: rsmith, rnk, thakis

Reviewed By: rnk

CC: cfe-commits

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

llvm-svn: 188481
2013-08-15 19:59:14 +00:00
David Blaikie d18fcc7a22 DebugInfo: remove unnecessary type registration
This happens in the caller a few frames up anyway.

llvm-svn: 188475
2013-08-15 18:59:44 +00:00
David Blaikie d816e2d3b0 DebugInfo: Don't create duplicate forward declaration metadata unnecessarily.
No functionality change, at best a slight (questionable) optimization,
but necessary for correctness of future work.

llvm-svn: 188474
2013-08-15 18:59:40 +00:00
Fariborz Jahanian 0b48e7c6bd Fixes a gross conditional in my last patch.
- This line, and those below, will be ignored--

M    lib/ARCMigrate/ObjCMT.cpp

llvm-svn: 188473
2013-08-15 18:58:00 +00:00
Fariborz Jahanian be7bc11f94 ObjectiveC migrator: In deciding NS_OPTION over
NS_ENUM, at least one power of 2 enumerator 
must be greater than two.

llvm-svn: 188470
2013-08-15 18:46:37 +00:00
Jordan Rose 2f8b0229cb [analyzer] If realloc fails on an escaped region, that region doesn't leak.
When a region is realloc()ed, MallocChecker records whether it was known
to be allocated or not. If it is, and the reallocation fails, the original
region has to be freed. Previously, when an allocated region escaped,
MallocChecker completely stopped tracking it, so a failed reallocation
still (correctly) wouldn't require freeing the original region. Recently,
however, MallocChecker started tracking escaped symbols, so that if it were
freed we could check that the deallocator matched the allocator. This
broke the reallocation model for whether or not a symbol was allocated.

Now, MallocChecker will actually check if a symbol is owned, and only
require freeing after a failed reallocation if it was owned before.

PR16730

llvm-svn: 188468
2013-08-15 17:22:06 +00:00
DeLesley Hutchins 16b4ff5c4d Thread safety analysis: move warnings within lock/unlock functions out of beta.
llvm-svn: 188465
2013-08-15 15:31:25 +00:00
Jack Carter 24bef98f96 [Mips][msa] Add support for half
Add support for half (a.k.a. __fp16) in builtin descriptions. 
The second argument to BUILTIN() now accepts 'h' to represent half.

Patch by Daniel Sanders

llvm-svn: 188464
2013-08-15 15:16:57 +00:00
Joerg Sonnenberger 51f358209f Build unwind tables by default on NetBSD.
llvm-svn: 188463
2013-08-15 15:08:33 +00:00
Joerg Sonnenberger 88d4c53e7d Use the integrated assembler on NetBSD/powerpc by default.
llvm-svn: 188462
2013-08-15 15:04:56 +00:00
Hao Liu 0e9837a385 Fix the build failure of Realease version
llvm-svn: 188456
2013-08-15 11:38:54 +00:00
Hao Liu 4efa1402fe Clang and AArch64 backend patches to support shll/shl and vmovl instructions and ACLE functions
llvm-svn: 188452
2013-08-15 08:26:30 +00:00
David Majnemer 6dda7bb08d [-cxx-abi microsoft] Mangle member pointers better
Summary:
There were several things going wrong:
- We mangled in useless qualifiers like "volatile void" return types.
- We didn't propagate 64-bit pointer markers sufficiently.
- We mangled qualifiers belonging to the pointee incorrectly.

This fixes PR16844 and PR16848.

Reviewers: rnk, whunt

Reviewed By: rnk

CC: cfe-commits

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

llvm-svn: 188450
2013-08-15 08:13:23 +00:00
Stefanus Du Toit 403f6ddce1 Add ctorInitializer to the dynamic AST Matcher registry.
llvm-svn: 188439
2013-08-15 00:33:08 +00:00
Fariborz Jahanian 8181caa44e ObjectiveC [Sema]. This patch makes sure that all inherited
properties (direct or indirect) setter/getter (or declared 
methods as well) are seen by the method implementation type 
matching logic before declaration of method in super class 
is seen. This fixes the warning coming out of that method mismatch.
// rdar://14650159

llvm-svn: 188438
2013-08-14 23:58:55 +00:00
Ted Kremenek 71c080f625 [static analyzer] add a simple "CallEffects" API to query the retain count semantics of a method.
This is intended to be a simplified API, whose internals are
deliberately less efficient for the purpose of a simplified interface,
for use with clients that want to query the analyzer's heuristics for
determining retain count semantics.

There are no immediate clients, but it is intended to be used
by the ObjC modernizer.

llvm-svn: 188433
2013-08-14 23:41:49 +00:00
Ted Kremenek 243c08585b [static analyzer] Factor out ArgEffect and RetEffect into public header file.
This is a WIP change to allow other clients to query the retain count
heuristics of the static analyzer.

llvm-svn: 188432
2013-08-14 23:41:46 +00:00
Richard Smith c58f38f220 PR16875: The return type of a dependent function type is visible when it's
referenced as a member of the current instantiation. In that case, deduce the
type of the function to a dependent type rather than exposing an undeduced auto
type to the rest of the current instantiation.

The standard doesn't really say that the type is dependent in this case; I'll
bring this up with CWG.

llvm-svn: 188410
2013-08-14 20:16:31 +00:00
Larisse Voufo dbd6577964 Bug fix: note diagnosis on expression narrowing should say "variable template" instead of "static data member" when appropriate
llvm-svn: 188409
2013-08-14 20:15:02 +00:00
Peter Collingbourne 276be3c57c Add support for -fsanitize-blacklist and default blacklists for DFSan.
Also add some documentation.

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

llvm-svn: 188403
2013-08-14 18:54:18 +00:00
Benjamin Kramer a97e4d1376 Enhance the clang -v gcc debug printing to skip obviously bad and duplicate paths.
Otherwise it lists all files (e.g. shared libraries) that happen to be in the
same paths the GCC installations usually reside in.

On a x86_64 Debian 7 system with i386 multilibs.
before: clang -v 2>&1|wc -l
        3059
after:  clang -v 2>&1|wc -l
        10

llvm-svn: 188400
2013-08-14 18:38:51 +00:00
Shuxin Yang 5f22d5263a revert 188352
llvm-svn: 188353
2013-08-14 04:47:39 +00:00
Shuxin Yang 538a17691c Driver::IsUsingLTO() no longer return true when seeing -emit-llvm.
The rationale for this change is to differentiate following two situations:
  1) clang -c -emit-llvm a.c
  2) clang -c -flto a.c 

Reviewed by Eric Christopher. Thanks a lot!

llvm-svn: 188352
2013-08-14 04:36:53 +00:00
Larisse Voufo d8dd97c0a2 Bug fix: disallow a variable template to be redeclared as a non-templated variable
llvm-svn: 188350
2013-08-14 03:09:19 +00:00
Hans Wennborg be4a6768f1 Driver: Forward -Wl, and -Xlink arguments when using windows linker
Differential Revision: http://llvm-reviews.chandlerc.com/D1394

llvm-svn: 188346
2013-08-14 01:24:35 +00:00
Richard Smith 0d905476f8 Don't produce duplicate notes if we have deduction failure notes when resolving
the address of an overloaded function template.

llvm-svn: 188334
2013-08-14 00:00:44 +00:00
Fariborz Jahanian a802c3526b ObjectiveC [QoI] issue warning if an element of an nsarray
expresison is a concatenated nsstring element.
// rdar://14303083

llvm-svn: 188332
2013-08-13 23:44:55 +00:00
Hans Wennborg 2e27459d6c clang-cl: Support /link option and set target to win32
This adds support for the /link option, which forwards
subsequent arguments to the linker.

The test for this will only work when targetting win32.
Since that's the only target where clang-cl makes sense,
use that target by default.

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

llvm-svn: 188331
2013-08-13 23:38:57 +00:00
Eli Friedman 7a15c4af90 Fix Altivec vector literal parser hack for C++11.
It doesn't make any sense to accept "..." in the argument to a C-style cast,
so use a separate expression list parsing routine which rejects it. PR16874.

llvm-svn: 188330
2013-08-13 23:38:34 +00:00
Nick Lewycky bbd6db8032 Link in the ubsan runtime when building shared objects.
llvm-svn: 188325
2013-08-13 22:32:35 +00:00
Eli Friedman 4e28b26589 sizeof(void) etc. should be a hard error in C++.
PR16872.

llvm-svn: 188324
2013-08-13 22:26:42 +00:00
Hans Wennborg ed1d07282c Handle "--" explicitly in the driver
Anything that comes after -- is treated as an input file. This
used to be handled automagically by the option parsing library,
but after LLVM r188314, we should handle it ourselves.

No functionality change.

llvm-svn: 188316
2013-08-13 21:32:29 +00:00
Richard Smith 1c34fb78e7 Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:
When a local extern declaration redeclares some other entity, the type of that
entity is merged with the prior type if the prior declaration is visible (in C)
or is declared in the same scope (in C++).

 - Make LookupRedeclarationWithLinkage actually work in C++, use it in the right
   set of cases, and make it track whether it found a shadowed declaration.
 - Track whether we found a declaration in the same scope (for C++) including
   across serialization and template instantiation.

llvm-svn: 188307
2013-08-13 18:18:50 +00:00
Fariborz Jahanian c13c1b0f0d ObjectiveC migrator: Fixes a crash and makes couple
of harmless changes.

llvm-svn: 188303
2013-08-13 18:01:42 +00:00
Edwin Vane 349e1c18eb Adding a vector version of tooling::applyAllReplacements
One day soon, tooling::Replacements will be changed from being implemented as
an std::set to being implemented as an std::vector. Until then, some new code
using vectors of Replacements would enjoy having a version of
applyAllReplacements that takes a vector.

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

llvm-svn: 188295
2013-08-13 17:38:19 +00:00
Edwin Vane f59b1a9211 Fixing a conflict detection bug in tooling::deduplicate
If a Replacment is contained within the conflict range being built, the
conflict range would be erroneously shortened. Now fixed. Tests updated to
catch this case.

llvm-svn: 188287
2013-08-13 16:26:44 +00:00
Arnold Schwaighofer 7f994ce294 Move logic to enable the vectorizer to clang
We used to decide whether to really vectorize depending on the optimization
level in PassManagerBuilder.

This patch moves this decision to the clang driver. We look at the optimization
level and whether the f(no-)vectorize is set and decide whether to vectorize.

This allows us to simplify the logic in PassManagerBuilder to just a check for
whether the vectorizer should run or not.

We now do the right thing for:
$ clang -O1 -fvectorize
$ clang -fno-vectorize -O3

llvm-svn: 188280
2013-08-13 15:46:23 +00:00
Samuel Benzaquen 0239b69167 Refactor "MatcherList" into "VariantMatcher" and abstract the notion of a list of matchers for the polymorphic case.
Summary:
Refactor "MatcherList" into "VariantMatcher" and abstract the notion of a list of matchers for the polymorphic case.
This work is to support future changes needed for eachOf/allOf/anyOf matchers. We will add a new type on VariantMatcher.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 188272
2013-08-13 14:54:51 +00:00
Daniel Jasper cdaffa45d4 clang-format: Add option for the offset of constructor initializers.
Some coding styles use a different indent for constructor initializers.

Patch by Klemens Baum. Thank you.
Review: http://llvm-reviews.chandlerc.com/D1360

Post review changes: Changed data type to unsigned as a negative indent
width does not make sense and added test for configuration parsing.

llvm-svn: 188260
2013-08-13 10:58:30 +00:00
Robert Lytton 0e07649ae5 Add XCore target
llvm-svn: 188258
2013-08-13 09:43:10 +00:00
David Majnemer e9cab2faa6 Fix typo in comment.
Thanks Kim Gräsman!

llvm-svn: 188257
2013-08-13 09:17:25 +00:00
Daniel Jasper 29a98cfca0 clang-format: Improve boolean expression formatting in macros.
Before:
  #define IF(a, b, c) if (a&&(b == c))

After:
  #define IF(a, b, c) if (a && (b == c))

llvm-svn: 188256
2013-08-13 09:09:09 +00:00
Daniel Jasper 301d017139 clang-format: Slightly adapt line break penalties.
Before:
  aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa)
                               ->aaaaaaaaa());
After:
  aaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa)->aaaaaaaaa());

llvm-svn: 188253
2013-08-13 06:50:04 +00:00
David Majnemer 8eaab6ff8e [-cxx-abi microsoft] Mangle __uuidof correctly into template parameters
Summary:
It seems that __uuidof introduces a global extern "C" declaration of
type __s_GUID.  However, our implementation of __uuidof does not provide
such a declaration and thus must open-code the mangling for __uuidof in
template parameters.

This allows us to codegen scoped COM pointers and other such things.

This fixes PR16836.
Depends on D1356.

Reviewers: rnk, cdavis5x, rsmith

Reviewed By: rnk

CC: cfe-commits

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

llvm-svn: 188252
2013-08-13 06:32:20 +00:00
David Blaikie 80d28de87a Drive by cleanup
llvm-svn: 188251
2013-08-13 04:21:38 +00:00
Larisse Voufo a11bd8a7dc variable templates updated for PCH serialization... Still working on test cases...
llvm-svn: 188249
2013-08-13 02:02:26 +00:00
NAKAMURA Takumi db8d300035 AnalysisBasedWarnings.cpp:: Prune "\param VariableName", possibly copypasto, in comments. [-Wdocumentation]
llvm-svn: 188248
2013-08-13 01:53:21 +00:00
David Majnemer e8fdc06e0d [-cxx-abi microsoft] Mangle TemplateArgument::Declaration for references
Summary:
Properly mangle declarations showing up in template arguments that are
reference parameters.  Fun-fact: undname cannot handle these!

Reviewers: rnk, cdavis5x

Reviewed By: rnk

CC: cfe-commits

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

llvm-svn: 188245
2013-08-13 01:25:35 +00:00
Reid Kleckner 6454d0a0fa Silence a warning from MSVC about not returning a value
llvm-svn: 188237
2013-08-13 00:11:59 +00:00
Reid Kleckner e846deae3c Remove Sema includes from Analysis code to fix layering
This moves a header-only class from Sema to Analysis and puts the option
check in Sema.

Patch by Chris Wailes!

llvm-svn: 188230
2013-08-12 23:49:39 +00:00
Hans Wennborg 13b7fe72a7 clang-cl: Sink /Fe and /Fo diagnostic code into BuildActions
Differential Revision: http://llvm-reviews.chandlerc.com/D1370

llvm-svn: 188226
2013-08-12 23:26:25 +00:00
Fariborz Jahanian dfe6ed9660 ObjectiveC migration. Add couple of routine
, currently unused, for future cf-annotation work.

llvm-svn: 188224
2013-08-12 23:17:13 +00:00
David Blaikie 6b7d060c57 DebugInfo: Simplify declaration building code - relying on the limit debug info checking already in CreateType(RecordType)
llvm-svn: 188222
2013-08-12 23:14:36 +00:00
David Blaikie 4a2b5ef603 DebugInfo: simplify some limited/declaration creation APIs
llvm-svn: 188214
2013-08-12 22:24:20 +00:00
Kaelyn Uhrain 2c351bbc25 Add hooks to ExternalSemaSource for after-the-fact diagnosis of
incomplete types, courtesy of Luke Zarko.

llvm-svn: 188212
2013-08-12 22:11:14 +00:00
Hans Wennborg 812a9ec9c2 Speculative build fix for r188206.
The cmake-clang-x86_64 was upset:
error: 'template<class ImplClass, class RetTy> class clang::ConstStmtVisitor' used without template parameters

llvm-svn: 188211
2013-08-12 22:02:09 +00:00
Hans Wennborg 207fcf0e7b clang-cl: Support the /Fe option
This is used to name the linked output file.

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

llvm-svn: 188210
2013-08-12 21:56:42 +00:00
Eli Friedman 24b3fed69f Fix pretty-printing for unnamed unions.
This is just a couple of minor fixes to account for the existence
of ElaboratedType.

llvm-svn: 188209
2013-08-12 21:54:04 +00:00
Eli Friedman e2358c1deb Fix crash w/BlockDecl and invalid qualified decl.
I'm not really satisfied with the ad-hoc nature of
Sema::diagnoseQualifiedDeclaration, but I'm not sure how to fix it.

Fixes <rdar://problem/14639501>.

llvm-svn: 188208
2013-08-12 21:54:01 +00:00
DeLesley Hutchins 48a317663f Patch by Chris Wailes <chris.wailes@gmail.com>.
Reviewed by delesley, dblaikie.

Add the annotations and code needed to support a basic 'consumed' analysis.

Summary:
This new analysis is based on academic literature on linear types.  It tracks
the state of a value, either as unconsumed, consumed, or unknown.  Methods are
then annotated as CallableWhenUnconsumed, and when an annotated method is
called while the value is in the 'consumed' state a warning is issued.  A value
may be tested in the conditional statement of an if-statement; when this occurs
we know the state of the value in the different branches, and this information
is added to our analysis.  The code is still highly experimental, and the names
of annotations or the algorithm may be subject to change.

llvm-svn: 188206
2013-08-12 21:20:55 +00:00
Kaelyn Uhrain f0aabdadc6 Add hooks for typo correction to ExternalSemaSource, courtesy of Luke Zarko.
llvm-svn: 188196
2013-08-12 19:54:38 +00:00
Hans Wennborg 0d0b19cbe1 clang-cl: Expand warning about /TC and /TP override, and expand test
llvm-svn: 188190
2013-08-12 18:34:17 +00:00
Jack Carter 44ff1e5673 [Mips] MSA frontend option support
This patch adds -mmsa and -mno-msa to the options supported by 
clang to enable and disable support for MSA.

When MSA is enabled, a predefined macro '__mips_msa' is defined to 1.

Patch by Daniel Sanders

llvm-svn: 188184
2013-08-12 17:20:29 +00:00
Benjamin Kramer 3841fa38da SourceManager intialization tweaks.
- Open files before calling stat on them.
- Go through FileManager for getting the buffer of named pipes. It has the
  necessary plumbing to deal with "volatile" files.
- Print the cause when stdin reading fails. The only case I can imagine where
  this happens is when stdin is wired to a device file, so no test case.

llvm-svn: 188178
2013-08-12 13:46:52 +00:00
Daniel Jasper 467ddb161c clang-format: Improve stream-formatting.
Before:
  CHECK(controller->WriteProto(FLAGS_row_key, FLAGS_proto)) << "\""
                                                            << FLAGS_proto
                                                            << "\"";

After:
  SemaRef.Diag(Loc, diag::note_for_range_begin_end)
      << BEF << IsTemplate << Description << E->getType();

llvm-svn: 188175
2013-08-12 12:58:05 +00:00
Daniel Jasper 5903685a28 clang-format: Correctly format alias declarations.
Before:
  template <class CallbackClass>
  using MyCallback = void(CallbackClass::*)(SomeObject * Data);");

After:
  template <class CallbackClass>
  using MyCallback = void (CallbackClass::*)(SomeObject *Data);");

Also fix three wrong indentations.

llvm-svn: 188172
2013-08-12 12:16:34 +00:00
Alexey Samsonov d6e043ba1f Use new llvm::SpecialCaseList API in CodeGenModule
llvm-svn: 188170
2013-08-12 11:48:05 +00:00
Manuel Klimek d57355031c This change fixes the formatting of statements such as catch (E& e).
Previously these were formatting as catch (E & e) because the inner parenthesis
was being marked as an expression.

Patch by Thomas Gibson-Robinson.

llvm-svn: 188153
2013-08-12 03:51:17 +00:00
Richard Smith b3d6c05ea4 Fix misindentation.
llvm-svn: 188151
2013-08-12 02:53:18 +00:00
Robert Wilhelm a65911a785 Omit llvm:: before StringRef and SmallString. We have using directive in include/clang/Basic/LLVM.h.
llvm-svn: 188139
2013-08-10 13:29:01 +00:00
Robert Wilhelm b869a8f596 Omit llvm:: before SmallVector and SmallVectorImpl. We have using directive in include/clang/Basic/LLVM.h.
llvm-svn: 188138
2013-08-10 12:33:24 +00:00
Serge Pavlov 074a518f03 Fix to PR16225 (Assert-on-invalid: isa<LabelDecl>(D) && "declaration not instantiated in this scope")
Differential Revision: http://llvm-reviews.chandlerc.com/D920

llvm-svn: 188137
2013-08-10 12:00:21 +00:00
Enea Zaffanella 6dbe187262 Added source locs for angled parentheses in class/var template partial specs.
llvm-svn: 188134
2013-08-10 07:24:53 +00:00
Serge Pavlov b716b3ca1f Avoid spurious error messages if parent template class cannot be instantiated
Differential Revision: http://llvm-reviews.chandlerc.com/D924

llvm-svn: 188133
2013-08-10 05:54:47 +00:00
Rafael Espindola 0b8e4a1e21 Fix warning in builds without asserts.
llvm-svn: 188132
2013-08-10 04:25:53 +00:00
Rafael Espindola c7367ffdab Simplify now that llvm::sys::current_path checks $PWD.
llvm-svn: 188128
2013-08-10 01:40:10 +00:00
Eli Friedman 8564139c0e Correctly profile CXXPseudoDestructorExprs.
CXXPseudoDestructorExprs may not contain a type.  PR16852.

llvm-svn: 188123
2013-08-09 23:37:05 +00:00
James Dennett ddd36fff49 Expose LambdaIntroducer::DefaultLoc in the AST's LambdaExpr.
Summary:
Source-centric tools need access to the location of a C++11
lambda expression's capture-default ('&' or '=') when it's present.
It's possible for them to find it by re-lexing and re-implementing
rules that Clang's parser has already applied, but the cost of storing
the SourceLocation and making it available to them is 32 bits per
LambdaExpr (a small delta, proportionally), and the simplification in
client code is significant.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits, klimek, revane

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

llvm-svn: 188121
2013-08-09 23:08:25 +00:00
Richard Trieu 4b03d98858 Fix for PR16570: when comparing two function pointers, discard qualifiers when
comparing non-reference function parameters.  The qualifiers don't matter for
comparisons.

This is a re-commit of r187769, which was accidentially reverted in r187770,
with a simplification at the suggestion of Eli Friedman.

llvm-svn: 188112
2013-08-09 21:42:32 +00:00
Argyrios Kyrtzidis 551c83d379 [arcmt] When handling unbridged casts, handle the body of BlockDecl separately because ParentMap does not record
Stmt parent nodes inside a BlockDecl.

Fixes rdar://14686900

llvm-svn: 188101
2013-08-09 20:20:25 +00:00
Robert Wilhelm 16e94b91ef Omit llvm:: before ArrayRef, as we have using llvm::ArrayRef in include/clang/Basic/LLVM.h.
llvm-svn: 188089
2013-08-09 18:02:13 +00:00
Benjamin Kramer 7a7285cc24 Remove "static" on simple temporary StringRef.
llvm-svn: 188088
2013-08-09 17:51:03 +00:00
Hans Wennborg 32e3b720b4 clang-cl: Don't pass /defaultlib to the linker
Since r187945, clang-cl will add the runtime library dependency to
the .obj file.

llvm-svn: 188086
2013-08-09 17:38:42 +00:00
David Blaikie fd07c604a9 Only emit debug info for implicit members that actually get codegen, not just ODR use.
This includes special members (copy/default ctor, copy assign, default
ctor) and template specializations for member function templates.

Good for a 5% decrease (1.80 to 1.71 GB) in size on Clang+LLVM's .dwo
files (when using fission).

llvm-svn: 188085
2013-08-09 17:20:05 +00:00
Benjamin Kramer 604e848655 Add a convenient way to compare GCCVersions without creating temporary objects.
No functionality change.

llvm-svn: 188084
2013-08-09 17:17:48 +00:00
Benjamin Kramer 27bc504285 DirectIvarAssignment: Replace vtable'd objects with simple functions.
Avoids unnecessary static constructors.

llvm-svn: 188083
2013-08-09 17:17:42 +00:00
Alexey Samsonov 71c197b81c Fixup for r188058: assume hasAsanZeroBaseShadow() is false if ASan is not needed
llvm-svn: 188068
2013-08-09 10:56:42 +00:00
Benjamin Kramer 989ab8b5a0 Put back a microoptimization with a comment to make it more obvious.
llvm-svn: 188063
2013-08-09 09:39:17 +00:00
David Majnemer 89085340be Sema: Assertion failure during CodeGen in CodeGenModule::EmitUuidofInitializer
Make sure we can properly generate code when the UUID has curly braces
on it, strip the curly braces at the sema layer.

This fixes PR16813.

llvm-svn: 188061
2013-08-09 08:56:20 +00:00
David Majnemer cf963cece8 [-cxx-abi microsoft] Mangle UUIDs correctly, stick them in the proper section
Revert r188055 which reverted r188053. An unrelated change previously snuck in.

llvm-svn: 188060
2013-08-09 08:35:59 +00:00
Pavel Labath 375e18e32c [analyzer] Enable usage of temporaries in InitListExprs
Summary:
ExprEngine had code which specificaly disabled using CXXTempObjectRegions in
InitListExprs. This was a hack put in r168757 to silence a false positive.

The underlying problem seems to have been fixed in the mean time, as removing
this code doesn't seem to break anything. Therefore I propose to remove it and
solve PR16629 in the process.

Reviewers: jordan_rose

CC: cfe-commits

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

llvm-svn: 188059
2013-08-09 07:46:29 +00:00
Alexey Samsonov e620366aa3 Make SanitizerArgs parsing toolchain-independent
llvm-svn: 188058
2013-08-09 07:42:13 +00:00
Alexander Kornienko dfec0b036d Use isCharInSet from llvm/Support/UnicodeCharRanges.h, added a test for double-width characters in FixIt-hints.
Summary: This is a follow-up to r187837.

Reviewers: gribozavr, jordan_rose

Reviewed By: jordan_rose

CC: cfe-commits

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

llvm-svn: 188056
2013-08-09 06:35:06 +00:00
David Majnemer a2724ae4b3 Revert "[-cxx-abi microsoft] Mangle UUIDs correctly, stick them in the proper section"
This commit reverts r188053.

It is breaking the build bots.

llvm-svn: 188055
2013-08-09 05:56:24 +00:00
David Majnemer 94a76b64e0 [-cxx-abi microsoft] Mangle UUIDs correctly, stick them in the proper section
We mangled them like:
L___uuid_12345678-1234-1234-1234-123456789abc

We should've mangled them like:
__GUID_12345678_1234_1234_1234_123456789abc

Furthermore, they are external symbols.

llvm-svn: 188053
2013-08-09 05:09:04 +00:00
Richard Smith 114394f824 Implement [class.friend]p11's special name lookup rules for friend declarations
of local classes. We were previously handling this by performing qualified
lookup within a function declaration(!!); replace it with the proper scope
lookup.

llvm-svn: 188050
2013-08-09 04:35:01 +00:00
Jordan Rose 867b185e63 [analyzer] Warn when using 'delete' on an uninitialized variable.
Patch by Karthik Bhat, modified slightly by me.

llvm-svn: 188043
2013-08-09 00:55:47 +00:00
Hans Wennborg 0fd6207d37 clang-cl: Support /showIncludes
This option prints information about #included files to stderr. Clang could
already do it, this patch just teaches the existing code about the /showIncludes
style and adds the flag.

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

llvm-svn: 188037
2013-08-09 00:32:23 +00:00
Fariborz Jahanian db8bf8313a unbreak buildbot on Windows.
llvm-svn: 188018
2013-08-08 21:51:06 +00:00
Fariborz Jahanian 261fdb7a9a ObjectiveC migrator: tighten rule about when to
migrate to @property with getter name starting with
'is'.

llvm-svn: 188013
2013-08-08 21:20:01 +00:00
Fariborz Jahanian cf2ff9ba32 ObjectiveC migration: Handle another special case of
setter/getter methods which can be migrated to
a @property.

llvm-svn: 188005
2013-08-08 20:51:58 +00:00
Hans Wennborg 614f707362 clang-cl: use MS C++ ABI
Differential Revision: http://llvm-reviews.chandlerc.com/D1329

llvm-svn: 188000
2013-08-08 19:54:30 +00:00
Rafael Espindola 71eccb39b8 Fix alignof computation of large arrays on x86_64.
We were exposing the extra alignment given to large arrays. The new behavior
matches gcc, which is a good thing since this is a gcc extension.

Thanks to Joerg Sonnenberger for noticing it.

While at it, centralize the method description in the .h file.

llvm-svn: 187999
2013-08-08 19:53:46 +00:00
Reid Kleckner 6beca0e1cf Revert "clang-cl: Hook up /Za to prevent adding oldnames.lib dependency"
This reverts commit r187991 and adjusts the comment.  /Za is much more
involved, and we don't want to give anyone the impression we actually
support it.

llvm-svn: 187998
2013-08-08 19:33:10 +00:00
Hans Wennborg 61db3478dc clang-cl: Hook up /Za to prevent adding oldnames.lib dependency
The /Za flag should probably do more, but let's start with this.

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

llvm-svn: 187991
2013-08-08 16:54:31 +00:00
Edwin Vane 938f68816a Introduce Replacement deduplication and conflict detection function
Summary:
This patch adds tooling::deduplicate() which removes duplicates from and
looks for conflicts in a vector of Replacements.

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

llvm-svn: 187979
2013-08-08 13:31:14 +00:00
Alexey Samsonov bb14f34cde Factor out parsing sanitizer arguments to a separate function
llvm-svn: 187977
2013-08-08 11:32:17 +00:00
Benjamin Kramer f62e81db91 Remove unused variable. No functionality change.
llvm-svn: 187975
2013-08-08 11:08:26 +00:00
Alexey Samsonov cf0559644f Move SanitizerArgs implementation from .h to .cpp
llvm-svn: 187972
2013-08-08 10:11:02 +00:00
Chandler Carruth 54c2910692 The only useful loop unrolling flag to give realistically is
'-fno-unroll-loops'. The option to the backend is even called
'DisableUnrollLoops'. This is precisely the form that Clang *didn't*
support. We didn't recognize the flag, we didn't pass it to the CC1
layer, and even if we did we wouldn't use it. Clang only inspected the
positive form of the flag, and only did so to enable loop unrolling when
the optimization level wasn't high enough. This only occurs for an
optimization level that even has a chance of running the loop unroller
when optimizing for size.

This commit wires up the 'no' variant, and switches the code to actually
follow the standard flag pattern of using the last flag and allowing
a flag in either direction to override the default.

I think this is still wrong. I don't know why we disable the loop
unroller entirely *from Clang* when optimizing for size, as the loop
unrolling pass *already has special logic* for the case where the
function is attributed as optimized for size! We should really be
trusting that. Maybe in a follow-up patch, I don't really want to change
behavior here.

llvm-svn: 187969
2013-08-08 08:34:35 +00:00
Arnold Schwaighofer a8177a02ca Revert r187935 "Support for double width characters."
It broke a public build bot.

llvm-svn: 187957
2013-08-08 02:19:56 +00:00
Richard Trieu 493df1a14f Emit an error for enum increments and decrements in C++ mode.
Fixes PR16394.

llvm-svn: 187955
2013-08-08 01:50:23 +00:00
Filipe Cabecinhas 178a8df660 UBSan: Fix alignment checks emitted in downcasts.
Summary:
UBSan was checking for alignment of the derived class on the pointer to
the base class, before converting. With some class hierarchies, this could
generate false positives.

Added test-case.

llvm-svn: 187948
2013-08-08 01:08:17 +00:00
Hans Wennborg 75958c41e2 clang-cl: Support the run-time selection options (/MD, /MT et al.)
These flags set some preprocessor macros and injects a dependency
on the runtime library into the object file, which later is picked up
by the linker.

This also adds a new CC1 flag for adding a dependent library.

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

llvm-svn: 187945
2013-08-08 00:17:41 +00:00
Alexander Kornienko ca3e6311a1 Support for double width characters.
Summary: Only works for UTF-8-encoded files.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 187935
2013-08-07 23:29:01 +00:00
Peter Collingbourne c377275a4a DataFlowSanitizer; Clang changes.
DataFlowSanitizer is a generalised dynamic data flow analysis.

Unlike other Sanitizer tools, this tool is not designed to detect a
specific class of bugs on its own.  Instead, it provides a generic
dynamic data flow analysis framework to be used by clients to help
detect application-specific issues within their own code.

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

llvm-svn: 187925
2013-08-07 22:47:34 +00:00
Richard Smith e40f2baa5d PR9992: Serialize and deserialize the token sequence for a function template in
-fdelayed-template-parsing mode. Patch by Will Wilson!

llvm-svn: 187916
2013-08-07 21:41:30 +00:00
Argyrios Kyrtzidis acfbbd77f8 [PCH] Fix a PCH serialization crash, with invalid code related to forward enum references.
The problem was that an enum without closing semicolon could be associated as a forward enum
in an erroneous declaration, leading to the identifier being associated with the enum decl but
without a declaration actually referencing it.
This resulted in not having it serialized before serializing the identifier that is associated with.

Also prevent the ASTUnit from querying the serialized DeclID for an invalid top-level decl; it may not
have been serialized.

rdar://14539667

llvm-svn: 187914
2013-08-07 21:17:33 +00:00
Manuel Klimek a027f306a6 Fixes a couple of bugs with the Allman brace breaking.
In particular, left braces after an enum declaration now occur on their
own line.  Further, when short ifs/whiles are allowed these no longer
cause the left brace to be on the same line as the if/while when a
brace is included.

Patch by Thomas Gibson-Robinson.

llvm-svn: 187901
2013-08-07 19:20:45 +00:00
Rafael Espindola 885727581c Correctly allign arrays on 32 bit systems.
Before this patch we would align

long long int big[1024];

to 4 bytes on 32 bit systems. The problem is that we were only looking
at the element type when getLargeArrayMinWidth returned non zero.

llvm-svn: 187897
2013-08-07 18:08:19 +00:00
Fariborz Jahanian 3ab6222fd1 Patch to fix doxygen trailing comments for ObjectiveC methods.
// rdar://14258334

llvm-svn: 187893
2013-08-07 16:40:29 +00:00
Daniel Jasper 9613c81fd2 clang-format: Fix corner case in OpenMP pragma formatting.
Before:
  #pragma omp reduction( | : var)
After:
  #pragma omp reduction(| : var)

llvm-svn: 187892
2013-08-07 16:29:23 +00:00
Jordan Rose 54533f73a8 Eliminate CXXConstructorDecl::IsImplicitlyDefined.
This field is just IsDefaulted && !IsDeleted; in all places it's used,
a simple check for isDefaulted() is superior anyway, and we were forgetting
to set it in a few cases.

Also eliminate CXXDestructorDecl::IsImplicitlyDefined, for the same reasons.

No intended functionality change.

llvm-svn: 187891
2013-08-07 16:16:48 +00:00
Rafael Espindola 958297dabf Indicate success for simple options when clang called with -cc1.
Patch by David Wiberg.

llvm-svn: 187888
2013-08-07 12:54:47 +00:00
Daniel Jasper d6877f0561 clang-format: Improve formatting of builder-type calls.
This removes a formatting choice that was added at one point, but is
not generally liked by users. Specifically, in builder-type calls, do
(easily) break if the object before the ./-> is either a field or a
parameter-less function call. I.e., don't break after "aa.aa.aa" or
"aa.aa.aa()". In general, these sequences in builder-type calls are
seen as a single entity and thus breaking them up is a bad idea.

llvm-svn: 187865
2013-08-07 05:34:02 +00:00
Hans Wennborg 0a0faa98d1 clang-cl: Use .obj as object file extension instead of .o
Differential Revision: http://llvm-reviews.chandlerc.com/D1302

llvm-svn: 187840
2013-08-07 00:32:15 +00:00
Fariborz Jahanian fad2854058 Patch to fix doxygen trailing comments for ObjectiveC properties.
// rdar://14258334

llvm-svn: 187835
2013-08-06 23:29:00 +00:00
Hans Wennborg 2b89a2692c clang-cl: Implement support for the /Fo option
This implements support for the /Fo option, which is used
to set the filename or output dir for object files.

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

llvm-svn: 187820
2013-08-06 22:11:28 +00:00
Richard Trieu 4e7c962891 Add a new warning to -Wloop-analysis to detect suspicious increments or
decrements inside for loops.  Idea for this warning proposed in PR15636:

http://llvm.org/bugs/show_bug.cgi?id=15636

llvm-svn: 187817
2013-08-06 21:31:54 +00:00
Fariborz Jahanian cf387c6afb ObjectiveC migration: tweak setting of lifetime attribute
on @property migration. Don't set unsafe_unretained
on non-object properties. Set 'retain' on strong
properties. Makecertain properties with specific
names unsafe_unretained as well.

llvm-svn: 187810
2013-08-06 18:06:23 +00:00
Larisse Voufo 833b05a273 A bit of clean up based on peer's feedback...
llvm-svn: 187784
2013-08-06 07:33:00 +00:00
Richard Smith 49ca8aab58 PR16755: When initializing or modifying a bitfield member in a constant
expression, truncate the stored value to the size of the bitfield.

llvm-svn: 187782
2013-08-06 07:09:20 +00:00
Larisse Voufo b959c3c6ae Removed hack that was used to properly restore the nested name specifier of qualified variable template ids. It turns out that the current implementation was just not logical setup for it. This commit has made it so.
llvm-svn: 187776
2013-08-06 05:49:26 +00:00
Larisse Voufo 4154f46c5a Fixing commit r187768: Moved diagnosis of forward declarations of variable templates from Parser to Sema.
llvm-svn: 187770
2013-08-06 03:57:41 +00:00
Richard Trieu 08d5085d43 Fix for PR16570: when comparing two function pointers, discard qualifiers when
comparing non-reference function parameters.  The qualifiers don't matter for
comparisons.

llvm-svn: 187769
2013-08-06 03:44:10 +00:00
Larisse Voufo 21de36ba66 Moved diagnosis of forward declarations of variable templates from Parser to Sema.
llvm-svn: 187768
2013-08-06 03:43:07 +00:00
NAKAMURA Takumi 8c2d367dcd SemaTemplateInstantiateDecl.cpp: Suppress a warning. [-Wunused-variable]
llvm-svn: 187765
2013-08-06 03:28:54 +00:00
Larisse Voufo 39a1e507ff Started implementing variable templates. Top level declarations should be fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention...
llvm-svn: 187762
2013-08-06 01:03:05 +00:00
Hans Wennborg 6ee64d52cf clang-cl: Implement the /Tc, /TC, /Tp and /TP options.
These are used to specify source files, and whether to treat source
files as C or C++.

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

llvm-svn: 187760
2013-08-06 00:20:31 +00:00
David Majnemer 89594f3733 [ms-cxxabi] Properly mangle member pointers
There were three things missing from the original implementation:

- We would omit the 'E' qualifier for members int 64-bit mode.
- We would not exmaine the qualifiers in 'IsMember' mode.
- We didn't generate the correct backref to the base class.

llvm-svn: 187753
2013-08-05 22:43:06 +00:00
David Majnemer 0db0ca4364 [ms-cxxabi] Handle template-template arguments
Template-template arguments appear to be a rather simple encoding of the
template's templated tag type.

llvm-svn: 187751
2013-08-05 22:26:46 +00:00
David Majnemer ae465ef7cc [ms-cxxabi] Mangle nullptr template arguments
MSVC mangles nullptr template arguments identically to zero literals.

llvm-svn: 187741
2013-08-05 21:33:59 +00:00
Daniel Jasper 07e6c407bc Add option to disable module loading.
This patch was created by Lawrence Crowl and reviewed in:
http://llvm-reviews.chandlerc.com/D963

llvm-svn: 187738
2013-08-05 20:26:17 +00:00
Richard Smith d7293d7fcb Implement C++'s restrictions on the type of an expression passed to a vararg
function: it can't be 'void' and it can't be an initializer list. We give a
hard error for these rather than treating them as undefined behavior (we can
and probably should do the same for non-POD types in C++11, but as of this
change we don't).

Slightly rework the checking of variadic arguments in a function with a format
attribute to ensure that certain kinds of format string problem (non-literal
string, too many/too few arguments, ...) don't suppress this error.

llvm-svn: 187735
2013-08-05 18:49:43 +00:00
Jordan Rose 74ef34f2be [analyzer] Clarify that r187624 is a hack and should be fixed better later.
Tracked by <rdar://problem/14648821>.

llvm-svn: 187729
2013-08-05 16:02:02 +00:00
Craig Topper c5244512c8 Use a shuffle with undef elements instead of inserting 0s in the 128-bit to 256-bit casting intrinsics to improve performance. Thanks to Katya Romanova for identifying this issue.
llvm-svn: 187716
2013-08-05 06:17:21 +00:00
David Majnemer 1365781b5b Sema: Don't assume a nested name specifier holds a type
Sema::PerformObjectMemberConversion assumed that the Qualifier it was
given holds a type. However, the specifier could hold just a namespace.
In this case, we should ignore the qualifier and not attempt to cast to
it.

llvm-svn: 187715
2013-08-05 04:53:41 +00:00
Timur Iskhodzhanov 40f2fa9a45 Emit the constructor for abstract classes when using -cxx-abi microsoft, fixes PR16735
llvm-svn: 187709
2013-08-04 17:30:04 +00:00
Craig Topper 50ad5b7354 Add support for passing -1 to __builtin_shufflevector to signify an undefined element value to match IR capabilities.
llvm-svn: 187694
2013-08-03 17:40:38 +00:00
Fariborz Jahanian 3bfc35e26a ObjectiveC migrator. Differentiate 'instancetype'
from 'id' result type when deciding on migration
to instancetype.

llvm-svn: 187684
2013-08-02 22:34:18 +00:00
Bob Wilson 3d27dad728 Only use the Darwin linker's -export_dynamic option with supported versions.
Related to <rdar://problem/14578094>.

llvm-svn: 187680
2013-08-02 22:25:34 +00:00
Hans Wennborg 96d5484219 Re-commit r187637: "clang-cl: add more options"
> This adds a bunch of options to clang-cl. Notably, this includes
> all the options that get passed when doing a default build of a
> command-line project with msbuild.exe in Debug and Release modes,
> and I believe all flags from Reid's original patch.

The original commit was reverted in r187640 after it broke the Mac build.

This should now be fixed, by Clang r187668, LLVM r187675, and putting
a -- before %s in the test.

llvm-svn: 187679
2013-08-02 22:24:50 +00:00
Manuel Klimek d3ed59ae15 Implement Allman style.
Patch by Frank Miller.

llvm-svn: 187678
2013-08-02 21:31:59 +00:00
Manuel Klimek 1863e505ce Fix crash when encountering alias templates in isDerivedFrom matches.
- pull out function to drill to the CXXRecordDecl from the type,
  to allow recursive resolution
- make the analysis more robust by rather skipping values we don't
  understand

llvm-svn: 187676
2013-08-02 21:24:09 +00:00
Fariborz Jahanian 9275c688ea ObjectiveC migrator: Add another family of factory
methods which can be migrated to instancetype.

llvm-svn: 187672
2013-08-02 20:54:18 +00:00
Hans Wennborg d1ddb9afd4 CC1: Only parse command-line options that have the CC1Option flag.
We already reject flags that don't have the CC1Option flag,
but we would previously do so after parsing the command-line
arguments.

Since the option parser now has a parameter for excluding options,
we should just use that instead.

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

llvm-svn: 187668
2013-08-02 20:16:22 +00:00
Fariborz Jahanian c4291852a4 ObjectiveC migrator: Fixes public buildbot failures,
in my previous patch which was reverted in r187657

llvm-svn: 187661
2013-08-02 18:00:53 +00:00
Fariborz Jahanian 87dc0bc078 revert patch I added in r187655. It still breaks public
buildbot.

llvm-svn: 187657
2013-08-02 16:25:41 +00:00
Fariborz Jahanian 11fe914549 ObjectiveC migration. Check-in patch reverted in r187634.
Also removed check for "NS" prefix for class name.

llvm-svn: 187655
2013-08-02 16:00:08 +00:00
Rafael Espindola 6df7083be4 Convert last use of st_dev in clang.
llvm-svn: 187654
2013-08-02 15:31:35 +00:00
Tim Northover 0389d883fc Remove rather oddly merged logic from AArch64 commit.
We seem to have ended up with both an inlined check of permitted NEON base
types and a call to a function.

Since the outer if was (I believe) strictly weaker than the one in the
function, there's no actual user-visible behaviour change, so no tests.

llvm-svn: 187652
2013-08-02 11:38:46 +00:00
Daniel Jasper 3dcd7eca7a clang-format: Fix string breaking after "<<".
Before, clang-format would not break overly long string literals
following a "<<" with FormatStyle::AlwaysBreakBeforeMultilineStrings
being set.

llvm-svn: 187650
2013-08-02 11:01:15 +00:00
Craig Topper 470059472a Fix indentation. No functional change.
llvm-svn: 187644
2013-08-02 05:10:31 +00:00
Hans Wennborg 007af3d14c Revert r187537 "clang-cl: add more options"
It broke the "phase1 - sanity" buildbot. Reverting until
we can figure out what's going on.

And Eric says it broke all current Mac builds actually.

llvm-svn: 187640
2013-08-02 01:29:28 +00:00
Richard Smith 7ecc31b032 When merging redeclaration chains across modules, if a declaration is visible
in one module but is only declared as a friend in another module, keep it
visible in the result of the merge.

This is incomplete on two axes:

1) Our handling of local extern declarations is basically broken (we put them
in the wrong decl context, and don't find them in redeclaration lookup, unless
they've previously been declared), and this results in them making friends
visible after a merge.

2) Eventually we'll need to mark that this has happened, and more carefully
check whether a declaration should be visible if it was only visible in some
of the modules in which it was declared. Fortunately it's rare for the
identifier namespace of a declaration to change along its redeclaration chain.

llvm-svn: 187639
2013-08-02 01:09:12 +00:00
Hans Wennborg 5762a04f12 clang-cl: add more options
This adds a bunch of options to clang-cl. Notably, this includes
all the options that get passed when doing a default build of a
command-line project with msbuild.exe in Debug and Release modes,
and I believe all flags from Reid's original patch.

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

llvm-svn: 187637
2013-08-02 00:30:15 +00:00
Rafael Espindola 6cbcc10e84 Revert "ObjectiveC migrator. Migrate to instancetype return type for mehods with certain prefix selector matching their class names' suffix."
This reverts commit r187626.

It is breaking the bots.

llvm-svn: 187634
2013-08-02 00:01:14 +00:00
Rafael Espindola f818ef4c37 Revert "If -fslp-vectorize or -fno-slp-vectorize are given, honor this selection. If no flag is given, enable it for -O3."
This reverts commit r187630.

Looks like it is breaking the bots.

llvm-svn: 187633
2013-08-01 23:56:42 +00:00
Daniel Jasper 7cdc78b39b clang-format: Operator precendence in ObjC method exprs.
Patch (mostly) by Adam Strzelecki. Thanks!

Before:
  [self aaaaaa:bbbbbbbbbbbbb
      aaaaaaaaaa:bbbbbbbbbbbbbbbbb
           aaaaa:bbbbbbbbbbb +
      bbbbbbbbbbbb aaaa:bbb];

After:
  [self aaaaaa:bbbbbbbbbbbbb
      aaaaaaaaaa:bbbbbbbbbbbbbbbbb
           aaaaa:bbbbbbbbbbb + bbbbbbbbbbbb
            aaaa:bbb];

This fixes llvm.org/PR16150.

llvm-svn: 187631
2013-08-01 23:13:03 +00:00
Nadav Rotem 9562d4a2d7 If -fslp-vectorize or -fno-slp-vectorize are given, honor this selection. If no flag is given, enable it for -O3.
llvm-svn: 187630
2013-08-01 22:56:53 +00:00
Fariborz Jahanian 8234d40843 ObjectiveC migrator. Migrate to instancetype return type
for mehods with certain prefix selector matching their class names'
suffix.

llvm-svn: 187626
2013-08-01 22:29:32 +00:00
Jordan Rose 7699e4a50b [analyzer] Don't process autorelease counts in synthesized function bodies.
We process autorelease counts when we exit functions, but if there's an
issue in a synthesized body the report will get dropped. Just skip the
processing for now and let it get handled when the caller gets around to
processing autoreleases.

(This is still suboptimal: objects autoreleased in the caller context
should never be warned about when exiting a callee context, synthesized
or not.)

Second half of <rdar://problem/14611722>

llvm-svn: 187625
2013-08-01 22:16:36 +00:00
Jordan Rose 5fbe7f9766 [analyzer] Silently drop all reports within synthesized bodies.
Much of our diagnostic machinery is set up to assume that the report
end path location is valid. Moreover, the user may be quite confused
when something goes wrong in our BodyFarm-synthesized function bodies,
which may be simplified or modified from the real implementations.
Rather than try to make this all work somehow, just drop the report so
that we don't try to go on with an invalid source location.

Note that we still handle reports whose /paths/ go through invalid
locations, just not those that are reported in one.

We do have to be careful not to lose warnings because of this.
The impetus for this change was an autorelease being processed within
the synthesized body, and there may be other possible issues that are
worth reporting in some way. We'll take these as they come, however.

<rdar://problem/14611722>

llvm-svn: 187624
2013-08-01 22:16:30 +00:00
Daniel Jasper b1ae734ffc clang-format: Don't break empty 2nd operand of ternary expr.
Before:
  some_quite_long_variable_name_ptr
      ?
      : argv[9] ? ptr : argv[8] ? : argv[7] ? ptr : argv[6];
After:
  some_quite_long_variable_name_ptr
      ?: argv[9] ? ptr : argv[8] ?: argv[7] ? ptr : argv[6];

Patch by Adam Strzelecki, thank you!!

This fixed llvm.org/PR16758.

llvm-svn: 187622
2013-08-01 22:05:00 +00:00
Rafael Espindola f8f91b8976 Use llvm::sys::fs::UniqueID for windows and unix.
This unifies the unix and windows versions of FileManager::UniqueDirContainer
and FileManager::UniqueFileContainer by using UniqueID.

We cannot just replace "struct stat" with llvm::sys::fs::file_status, since we
want to be able to construct fake ones, and file_status has different members
on unix and windows.

What the patch does is:

* Record only the information that clang is actually using.
* Use llvm::sys::fs::status instead of stat and fstat.
* Use llvm::sys::fs::UniqueID
* Delete the old windows versions of UniqueDirContainer and
UniqueFileContainer since the "unix" one now works on windows too.

llvm-svn: 187619
2013-08-01 21:42:11 +00:00
Bill Wendling d8f4950862 Use function attributes to indicate if we don't want to realign the stack.
llvm-svn: 187617
2013-08-01 21:41:02 +00:00
David Blaikie 79af384d72 DebugInfo: Don't prefer declarations over definitions in -flimit-debug-info in C
Without an ODR, the -flimit-debug-info debug info size optimization of
emitting declarations for fully defined types when only a declaration is
needed by the TU, is incorrect. Emit the full definition whenever it's
available in non-C++.

llvm-svn: 187611
2013-08-01 20:57:40 +00:00
David Blaikie 4a5b8958a8 DebugInfo: Emit template arguments for limited types used for context.
We emit definitions with no members when a nested type is
referenced/required (GCC does the same, to be fair) but failed to attach
the template arguments in such a case.

llvm-svn: 187608
2013-08-01 20:31:40 +00:00
Nadav Rotem f479b74a95 Enable the SLP-vectorizer by default
llvm-svn: 187596
2013-08-01 18:28:23 +00:00
David Blaikie 6f8f6008c2 Reduce a variable's scope (no functionality change)
llvm-svn: 187594
2013-08-01 18:23:24 +00:00
Daniel Jasper 8b1c63543b Teach clang-format to understand static_asserts better.
Before:
  template <bool B, bool C>
  class A {
    static_assert(B &&C, "Something is wrong");
  };

After:
  template <bool B, bool C>
  class A {
    static_assert(B && C, "Something is wrong");
  };

(Note the spacing around '&&'). Also change the identifier table to always
understand all C++11 keywords (which seems like the right thing to do).

llvm-svn: 187589
2013-08-01 17:58:23 +00:00
David Majnemer 62f0ffd733 AST: Treat inline function declarations in -fms-compatibility as if it were in C++ when in C mode
This essentially fixes PR16766.

llvm-svn: 187586
2013-08-01 17:26:42 +00:00
Hans Wennborg a203b50317 Options: Use AliasArgs for -O -> -O2 translation.
This way we can do the translation in the .td file rather than manually.

llvm-svn: 187583
2013-08-01 16:21:57 +00:00
Daniel Jasper 9688ff197e clang-format: Improve line breaks in @property.
Before:
  @property(nonatomic, assign,
            readonly) NSString *looooooooooooooooooooooooooooongName;

After:
  @property(nonatomic, assign, readonly)
      NSString *looooooooooooooooooooooooooooongName;

llvm-svn: 187577
2013-08-01 13:46:58 +00:00
Benjamin Kramer dca8abde77 Make helper function static.
llvm-svn: 187574
2013-08-01 11:08:06 +00:00
Daniel Jasper 8698af49fc Silence unused variable warning in non-assert builds.
llvm-svn: 187572
2013-08-01 10:30:11 +00:00
Tim Northover 2fe823a6c3 AArch64: initial NEON support
Patch by Ana Pazos

- Completed implementation of instruction formats:
AdvSIMD three same
AdvSIMD modified immediate
AdvSIMD scalar pairwise

- Completed implementation of instruction classes
(some of the instructions in these classes
belong to yet unfinished instruction formats):
Vector Arithmetic
Vector Immediate
Vector Pairwise Arithmetic

- Initial implementation of instruction formats:
AdvSIMD scalar two-reg misc
AdvSIMD scalar three same

- Intial implementation of instruction class:
Scalar Arithmetic

- Initial clang changes to support arm v8 intrinsics.
Note: no clang changes for scalar intrinsics function name mangling yet.

- Comprehensive test cases for added instructions
To verify auto codegen, encoding, decoding, diagnosis, intrinsics.

llvm-svn: 187568
2013-08-01 09:23:19 +00:00
Arnaud A. de Grandmaison cb6f943ada Check dynamic_cast is not used with -fno-rtti, unless it is a noop or can be resolved statically.
llvm-svn: 187564
2013-08-01 08:28:32 +00:00
Craig Topper ad5ccc2d75 Remove more odd code that tries to account for an off by 1 problem in vec3 shuffles that doesn't really exist.
llvm-svn: 187561
2013-08-01 06:59:29 +00:00
Craig Topper b9b7ea697b Fix to handle all non-power-of-2 vector sizes in the mask form of _builtin_shuffle_vector.
Previously a 2-bit mask was used to mask each element of a vec6 mask before doing the extracts instead of 3-bit mask necessary to cover 0-5. vec3 was the only non-power-of-2 that worked correctly because a +1 conditionally added before calculating floor(log2(elements)).

llvm-svn: 187560
2013-08-01 06:42:40 +00:00
David Majnemer a4f7c7a600 Sema: Diagnose explicitly bound unresolved member expressions decaying into pointers to function type
We would disallow the case where the overloaded member expression is
coming from an address-of operator but we wouldn't issue any diagnostics
when the overloaded member expression comes by way of a function to
pointer decay cast.

Clang's implementation of DR61 is now seemingly complete.

llvm-svn: 187559
2013-08-01 06:13:59 +00:00
Craig Topper 0ed37bd525 Remove broken and unnecessary vec3 handling from VisitShuffleVectorExpr.
llvm-svn: 187558
2013-08-01 04:51:48 +00:00
David Majnemer 23252a3672 Parse: Don't consider attributes of broken member declarators
ParseCXXClassMemberDeclaration was trying to use the result of
ActOnCXXMemberDeclarator to attach it to some late parsed attributes.

However when failures arise, we have no decl to attach to which
eventually leads us to a NULL pointer dereference.

While we are here, clean up the code a bit.

Fixes PR16765

llvm-svn: 187557
2013-08-01 04:22:55 +00:00
Richard Smith b71782b7e5 Fix assert when instantiating a default argument of a template defined in a
module.

llvm-svn: 187556
2013-08-01 04:12:04 +00:00
Hans Wennborg 39afc19fc2 Remove the SUPPORT_ALIASARGS define
It is not needed after LLVM r187546.

llvm-svn: 187550
2013-08-01 00:12:13 +00:00
Daniel Jasper 552f4a7e27 clang-format: Make alignment of trailing comments optional ..
.. in order to support WebKit style properly.

llvm-svn: 187549
2013-07-31 23:55:15 +00:00
Hans Wennborg 28c96319c8 Make -m[no-]pascal-strings an alias of -f[no]pascal-strings in the .td file
This way we don't have to translate it manually in Clang::ConstructJob.

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

llvm-svn: 187547
2013-07-31 23:39:13 +00:00
Fariborz Jahanian 3a25d0d593 ObjectiveC ARC: finishing off issuing error when
retainable pointer is passed to an audited CF function
expecting CF type. // rdar://14569171

llvm-svn: 187543
2013-07-31 23:19:34 +00:00
Daniel Jasper 65ee347285 clang-format: Add more options to namespace indentation.
With this patch, clang-format can be configured to:
* not indent in namespace at all (former behavior).
* indent in namespace as in other blocks.
* indent only in inner namespaces (as required by WebKit style).

Also fix alignment of access specifiers in WebKit style.

Patch started by Marek Kurdej. Thank you!

llvm-svn: 187540
2013-07-31 23:16:02 +00:00
Hans Wennborg 212e7ec772 Option parsing tables: pick up AliasArgs from the OPTION macro.
This depends on LLVM r187537.

The SUPPORT_ALIASARGS macro will be removed once all option parsing
clients have been updated.

llvm-svn: 187538
2013-07-31 23:07:21 +00:00
Fariborz Jahanian 25eef19b48 ObjectiveC ARC: Do not issue bridge cast diagnostic when
passing a retainable object arg to a CF audited function
expecting a CF object type. Issue a normal type mismatch
diagnostic. This is wip // rdar://14569171

llvm-svn: 187532
2013-07-31 21:40:51 +00:00
Reid Kleckner a09e44c75d Fix declaring class template methods with an attributed typedef
This change unifies the logic for template instantiation of methods and
functions declared with typedefs.

It ensures that SubstFunctionType() always fills the Params out param
with non-null ParmVarDecls or returns null.

Reviewers: rsmith

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

llvm-svn: 187528
2013-07-31 21:00:18 +00:00
Hans Wennborg 1907610d4e clang-cl: add the /c, /W0 and /W1 options
This adds a few more clang-cl options. It also exposes two core clang
options to the clang-cl mode: we need to be able to claim --driver_mode
so it doesn't show up as unused in cl mode, and we need -### for tests.

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

llvm-svn: 187527
2013-07-31 20:51:53 +00:00
Kaelyn Uhrain 957c8b1c70 A few small cleanups to r187504. Thanks to dblaikie for the assist.
llvm-svn: 187521
2013-07-31 20:16:17 +00:00
Fariborz Jahanian 48d94c8d76 ObjectiveC arc: minor refactoring in my last patch
to avoid future false positives. // rdar://14569171

llvm-svn: 187509
2013-07-31 18:39:08 +00:00
Fariborz Jahanian 131996b169 ObjectiveC arc: Introduce a new initialization kind
for parameters passed to CF audited functions
to be used for better diagnostics. Current set but
unused. // rdar://14569171

llvm-svn: 187508
2013-07-31 18:21:45 +00:00
Kaelyn Uhrain 0c51de4ab1 Improve the diagnostic experience, including adding recovery, for
changing '->' to '.' when there is no operator-> defined for a class.

llvm-svn: 187504
2013-07-31 17:38:24 +00:00
Fariborz Jahanian 374089e7b8 ObjectiveC arc: Move check for type conversions in arc
out of ImpCastExprToType and to the caller site
as appropriate. This is in prep. to do more work for
// rdar://14569171 

llvm-svn: 187503
2013-07-31 17:12:26 +00:00
Hans Wennborg ec99382b54 Fix a comment.
llvm-svn: 187502
2013-07-31 16:57:56 +00:00
Richard Trieu 2ac682a671 Fix a crasher than manifests when typo correction suggests a function template.
llvm-svn: 187467
2013-07-31 00:48:10 +00:00
Chandler Carruth 7f8042c8f3 Find a better compromise with the default library search paths used by
Clang when linking and using a GCC installation from a GCC
cross-compiler.

This was desired already by two special case platforms (Android and
Mips), and turns out to be generally (if frustratingly) true. I've added
a substantial comment to the code clarifying the underlying assumptions
of doing actual cross compiles with Clang (or GCC for that matter!) and
help avoid further confusion here.

The end result is to realize that fully general form of PR12478 cannot
be resolved while we support existing cross-compiling GCC toolchains,
and linking with them (namely, linking against their libgcc and
libstdc++ installs). GCC installs these target libraries under
a target-specific prefix but one that may not be available within the
actual sysroot in use. When linking in this world, GCC works and Clang
should as well, but caveat emptor: DSOs from this tree must be
replicated and rpath-fixed to be found at runtime within the sysroot.

I've extended the cross compile test cases to cover these issues by
pointing them at a sysroot and actually checking the library search
paths.

llvm-svn: 187466
2013-07-31 00:37:07 +00:00
Richard Smith 629ff3628a Fix read of uninitialized enum value in test, caught by UBSan. No functionality
change, other than removal of undefined behavior.

llvm-svn: 187465
2013-07-31 00:26:46 +00:00
Daniel Jasper 62c0ac0acf clang-format: Improve detection of templates.
Before:
  template <typename... Types>
        typename enable_if < 0<sizeof...(Types)>::type Foo() {}
After:
  template <typename... Types>
  typename enable_if<0 < sizeof...(Types)>::type Foo() {}

llvm-svn: 187458
2013-07-30 22:37:19 +00:00
Chandler Carruth 0ae39aaefd Start keeping track of what work was done to detect a GCC installation
on the system, and report it when running the driver in verbose mode.
Without this it is essentially impossible to understand why a particular
GCC toolchain is used by Clang for libstdc++, libgcc, etc.

This also required threading a hook through the toolchain layers for
a specific toolchain implementation to print custom information under
'clang -v'. The naming here isn't spectacular. Suggestions welcome.

llvm-svn: 187427
2013-07-30 17:57:09 +00:00
Aaron Ballman 9744ffd652 err_attribute_missing_parameter_name has been replaced by err_attribute_argument_type.
llvm-svn: 187420
2013-07-30 14:29:12 +00:00
Aaron Ballman 9d695091fd Replacing err_attribute_argument_not_int with err_attribute_not_type_attr
llvm-svn: 187419
2013-07-30 14:10:17 +00:00
Timur Iskhodzhanov df7e7fb642 Add MicrosoftVFTableContext to AST
llvm-svn: 187409
2013-07-30 09:46:19 +00:00
Aaron Ballman 3bf758cd65 err_attribute_not_string has been subsumed by err_attribute_argument_type.
llvm-svn: 187400
2013-07-30 01:31:03 +00:00
Aaron Ballman be50eb86e6 Refactor some attributes to use checkFunctionOrMethodArgumentIndex instead of using custom logic. No functional changes intended.
llvm-svn: 187398
2013-07-30 00:48:57 +00:00
Alexander Kornienko 6d8cf83a4d Simplified SourceManager::translateLineCol a bit.
Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits

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

llvm-svn: 187386
2013-07-29 22:26:10 +00:00
Rafael Espindola 073ff10138 Update for llvm api change.
llvm-svn: 187379
2013-07-29 21:26:52 +00:00
Richard Smith 1235a8dac6 PR16715: Fix assert in verifier: only mark call to 'operator new' as 'builtin' if
corresponding 'operator new' was actually emitted as a function marked 'nobuiltin'.

llvm-svn: 187374
2013-07-29 20:14:16 +00:00
Rafael Espindola 74ca78ed9b Convert a use of status with llvm::sys::fs::getUniqueID.
llvm-svn: 187367
2013-07-29 18:43:40 +00:00
David Blaikie 021221db7c Support for Thread Safety Analysis in C
Patch by Ethan Jackson.

llvm-svn: 187365
2013-07-29 18:24:03 +00:00
Rafael Espindola e4777f4638 Convert a use of stat with sys::fs::status.
llvm-svn: 187364
2013-07-29 18:22:23 +00:00
Rafael Espindola ee30546c00 Fix handling of "clang c:foo"
On windows, c:foo is a valid file path, but stat fails on just "c:". This
causes a problem for clang since its file manager wants to cache data about
the parent directory.

There are refactorings to be done in here, but this gives clang the correct
behavior and testing first.

Patch by Yunzhong Gao!

llvm-svn: 187359
2013-07-29 15:47:24 +00:00
Craig Topper baca389e28 Return ExprError if both arguments to the mask form of __builtin_shufflvector don't have the same number of elements or the mask isn't an integer vector.
Previously a diagnostic was issued, but the code went ahead and built the ShuffleVectorExpr. While I'm here also simplify a couple lines by wrapping the return ExprError around the Diag calls.

llvm-svn: 187344
2013-07-29 06:47:04 +00:00
Craig Topper 304602acc9 Fix up formatting. No functional change.
llvm-svn: 187334
2013-07-28 21:50:10 +00:00
Rafael Espindola 5150f2f558 Avoid crashing if a directory has no pch files.
Should fix some of the bots that have assertions disabled.

llvm-svn: 187329
2013-07-28 13:23:37 +00:00
Bob Wilson 5721735025 Reduce stack frame size by avoiding a large token vector on an error path.
Beginning with svn r186971, we noticed an internal test started to fail when
using clang built with LTO. After much investigation, it turns out that there
are no blatant bugs here, we are just running out of stack space and crashing.
Preprocessor::ReadFunctionLikeMacroArgs already has one vector of 64 Tokens,
and r186971 added another.  When built with LTO, that function is inlined into
Preprocessor::HandleMacroExpandedIdentifier, which for our internal test is
invoked in a deep recursive cycle. I'm leaving the original 64 Token vector
alone on the assumption that it is important for performance, but the new
FixedArgTokens vector is only used on an error path, so it should be OK if it
requires additional heap storage. It would be even better if we could avoid
the deep recursion, but I think this change is a good thing to do regardless.
<rdar://problem/14540345>

llvm-svn: 187315
2013-07-27 21:59:57 +00:00
Craig Topper 18243fb5c4 Fix formatting. No functional change.
llvm-svn: 187294
2013-07-27 05:00:42 +00:00
Aaron Ballman a5e9c5b865 Using the function pointer instead of the function type; this allows us to re-enable a warning in MSVC by default.
llvm-svn: 187292
2013-07-27 03:34:50 +00:00
Hans Wennborg 6ddc6901ef clang-cl: add support for the /? and /help options
This establishes a new Flag in Options.td, which can be assigned to
options that should be made available in clang's cl.exe compatible
mode, and updates the Driver to make use of the flag.

(The whitespace change to CMakeLists forces the build to re-run CMake
 and pick up the include dependency on the new .td file. This makes the
 build work if someone moves backwards in commit history after this change.)

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

llvm-svn: 187280
2013-07-27 00:23:45 +00:00
Eli Friedman 3fd26b8514 Don't build expressions for invalid casts.
This matches how we normally perform semantic analysis for other sorts
of invalid expressions: it means we don't have to reason about invalid
sub-expressions.

Fixes PR16680.

llvm-svn: 187276
2013-07-26 23:47:47 +00:00
Richard Smith 1836e60023 Handle a difference in lambda return type deduction between C++11 and C++1y: if
no return type is specified, C++11 will deduce a cv-qualified return type in
some cases, but C++1y never will.

llvm-svn: 187275
2013-07-26 23:45:07 +00:00
Richard Smith fff926670b PR16708: If a lambda has an implicit return type, don't get confused if its return type has already been determined to be a type containing an 'auto'.
llvm-svn: 187266
2013-07-26 22:53:54 +00:00
Bill Wendling f69f594512 Use the new boolean to StringRef function to generate the proper StringRefs.
llvm-svn: 187251
2013-07-26 21:51:11 +00:00
Adrian Prantl ca64c3e136 Debug Info / EmitCallArgs: arguments may modify the debug location.
Restore it after each argument is emitted. This fixes the scope info for
inlined subroutines inside of function argument expressions. (E.g.,
anything STL).

rdar://problem/12592135

llvm-svn: 187240
2013-07-26 20:42:57 +00:00
Daniel Jasper 91f1c8ca27 Add matcher for float literals.
Patch by Chris Gray! Thanks!

llvm-svn: 187232
2013-07-26 18:52:58 +00:00
Argyrios Kyrtzidis b534d3a0ef [libclang] Remove comma from the blacklist of characters that prevent a comment to be attached to a decl.
It's common to use an availability function macro at the start of a decl.
rdar://13965065

llvm-svn: 187230
2013-07-26 18:38:12 +00:00
Daniel Jasper e33d4afa47 clang-format: Add two new style options to support WebKit style.
New options:
* Break before the commas of constructor initializers and align
  the commas with the colon.
* Break before binary operators

Additionally, for styles without column limit, don't just accept
linebreaks done by the user, but instead remove 'invalid' (according
to the current style) linebreaks and add 'required' ones.

llvm-svn: 187210
2013-07-26 16:56:36 +00:00
Argyrios Kyrtzidis 17ff2e577f [frontend] '-frewrite-includes' should not ignore headers included from command-line.
rdar://14556182

llvm-svn: 187207
2013-07-26 15:32:04 +00:00
Pavel Labath cf878bbe65 [analyzer] Fix FP warnings when binding a temporary to a local static variable
Summary:
When binding a temporary object to a static local variable, the analyzer would
complain about a dangling reference even though the temporary's lifetime should
be extended past the end of the function. This commit tries to detect these
cases and construct them in a global memory region instead of a local one.

Reviewers: jordan_rose

CC: cfe-commits

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

llvm-svn: 187196
2013-07-26 11:50:42 +00:00
Craig Topper a97d7e77a6 Remove trailing whitespace.
llvm-svn: 187190
2013-07-26 06:16:11 +00:00
Craig Topper 99e7927d06 Remove trailing whitespace.
llvm-svn: 187189
2013-07-26 05:59:26 +00:00
Bill Schmidt 778d387684 [PowerPC] Support powerpc64le as a syntax-checking target.
This patch provides basic support for powerpc64le as an LLVM target.
However, use of this target will not actually generate little-endian
code.  Instead, use of the target will cause the correct little-endian
built-in defines to be generated, so that code that tests for
__LITTLE_ENDIAN__, for example, will be correctly parsed for
syntax-only testing.  Code generation will otherwise be the same as
powerpc64 (big-endian), for now.

The patch leaves open the possibility of creating a little-endian
PowerPC64 back end, but there is no immediate intent to create such a
thing.

The new test case variant ensures that correct built-in defines for
little-endian code are generated.

llvm-svn: 187180
2013-07-26 01:36:11 +00:00
Eli Friedman efe9fa62f5 Tighten type-checking for vector attributes.
Based on patch by Yunzhong Gao.

llvm-svn: 187176
2013-07-26 00:53:47 +00:00
Eli Friedman bf44f366a1 Fix gcc search for cross-compiler on Ubuntu 13.04.
Just more craziness to find crtbegin.o etc.

Patch by Stephen Kelly.

llvm-svn: 187175
2013-07-26 00:53:40 +00:00
Eli Friedman f24bd3bdba Fix GNU ObjC ABI for a message returning a struct.
This allows the ObjFW runtime to correctly implement message forwarding
for messages which return a struct.

Patch by Jonathan Schleifer.

llvm-svn: 187174
2013-07-26 00:53:29 +00:00
Eli Friedman ab09187553 Partially revert r186903.
It turns out that Plum Hall depends on us not emitting an error on
integer literals which fit into long long, but fit into
unsigned long long.  So C99 conformance requires not conforming to C99. :)

llvm-svn: 187172
2013-07-26 00:06:45 +00:00
Hans Wennborg 83859acd91 Options.td: fold the NoForward flag into DriverOption
They seemed to have the same implications, and this makes for one
less flag to worry about.

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

llvm-svn: 187168
2013-07-25 23:09:00 +00:00