Commit Graph

32160 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 5234b49854 Avoid using the 'index' namespace as scope.
This should fix the bogus ambiguous reference errors reported by gcc 4.2.1 that the FreeBSD bot is using.

llvm-svn: 188850
2013-08-21 00:49:25 +00:00
Fariborz Jahanian b834352609 ObjectiveC migrator. make sure to embed audited
candidate functions in their CF_IMPLICIT_BRIDGING_ENABLED
pragma before exiting the header file.

llvm-svn: 188846
2013-08-20 23:35:26 +00:00
Eli Friedman 85698c8d7b Remove Extension warning for GNU local labels.
We generally don't warn about extensions involving keywords reserved
for the implementation, so we shouldn't warn here either: the
standard doesn't require it, and it doesn't provide useful information
to the user.

llvm-svn: 188840
2013-08-20 22:44:32 +00:00
Fariborz Jahanian 301b52145f ObjectiveC migrator: make sure audited pragams are
dumped for last declarations in the current TU. wip.

llvm-svn: 188838
2013-08-20 22:42:13 +00:00
Rafael Espindola 22ce34aee8 Centralize the handling of -target-cpu (-cc1, -cc1as) and -mcpu (gold plugin).
llvm-svn: 188837
2013-08-20 22:12:08 +00:00
David Blaikie ce76304627 DebugInfo: comment/inlining based on feedback from Eric & Adrian
llvm-svn: 188834
2013-08-20 21:49:21 +00:00
David Blaikie 8d5e128bd4 DebugInfo: Simplify/clarify propagation of typemembers between declaration and definition
Based on code review feedback from Eric Christopher (on r188739) and
Adrian Prantl (r188642).

llvm-svn: 188829
2013-08-20 21:03:29 +00:00
Fariborz Jahanian 5874e6d384 ObjectiveC migrator: More tweaking of heuristics
for an audited cf function to not include those
which are annotated by user.

llvm-svn: 188823
2013-08-20 20:45:28 +00:00
Richard Smith e156254d4c During typo correction, check for an exact match in an unimported module. If we
find one, then report the error as a missing import instead of as a typo.

llvm-svn: 188821
2013-08-20 20:35:18 +00:00
Rafael Espindola db0fcfbfae Centralize the logic for handling -m* options and fix pr16943.
This moves the logic for handling -mfoo -mno-foo from the driver to -cc1. It
also changes -cc1 to apply the options in order, fixing pr16943.

The handling of -mno-mmx -msse is now an explicit special case.

llvm-svn: 188817
2013-08-20 18:57:55 +00:00
Fariborz Jahanian 9427939f65 ObjectiveC migrator: More tweaking of heuristics
for an audited cf function and addition of
a test case.

llvm-svn: 188816
2013-08-20 18:54:39 +00:00
Rafael Espindola a38ce29576 Remove duplicated error checking.
The driver validates its options, so we don't need to redo the work in
"clang -cc1".

llvm-svn: 188806
2013-08-20 15:30:32 +00:00
Rafael Espindola d9401d664b Remove dead code.
llvm-svn: 188802
2013-08-20 14:18:24 +00:00
Rafael Espindola e62e279f97 Refactor the x86 feature handling.
This removes the very long chains of
Feature["avx"] = Feature["sse42"] = ... = true;

llvm-svn: 188799
2013-08-20 13:44:29 +00:00
Tim Northover b9facf72aa ARM: default to arm1176jzf-s for hard-float platforms.
It makes no sense to try and compile for arm7tdmi when we're targeting
something like gnueabihf. Although not strictly the most basic hardware
conceivable, I believe arm1176jzf-s is a reasonable compromise (that can always
be overridden explicitly if needed) since it's still in reasonably common use
unlike earlier cores.

Patch by Stephen Kelly.

llvm-svn: 188796
2013-08-20 13:13:38 +00:00
Daniel Jasper 2b41a82e61 clang-format: Format enum struct/class like enum.
Patch by Joe Hermaszewski. Thank you!

llvm-svn: 188794
2013-08-20 12:42:50 +00:00
Daniel Jasper b55acad91c clang-format: Additional options for spaces around parentheses.
This patch adds four new options to control:
- Spaces after control keyworks (if(..) vs if (..))
- Spaces in empty parentheses (f( ) vs f())
- Spaces in c-style casts (( int )1.0 vs (int)1.0)
- Spaces in other parentheses (f(a) vs f( a ))

Patch by Joe Hermaszewski. Thank you for working on this!

llvm-svn: 188793
2013-08-20 12:36:34 +00:00
Benjamin Kramer 5e5e5a92b4 ARCMigrate depends on the static analyzer.
llvm-svn: 188792
2013-08-20 12:33:59 +00:00
Craig Topper 007b059c33 Change 'avx512' to 'avx-512' to match llvm backend.
llvm-svn: 188762
2013-08-20 07:39:54 +00:00
Craig Topper 449314e1ec Add AVX-512 feature flag and knl cpu to clang.
llvm-svn: 188758
2013-08-20 07:09:39 +00:00
Craig Topper 33b4cde2f2 Revert r188756 because some other changes snuck in with it.
llvm-svn: 188757
2013-08-20 07:07:29 +00:00
Craig Topper ffb7180e96 Add AVX-512 feature flag and knl cpu to clang.
llvm-svn: 188756
2013-08-20 07:05:05 +00:00
David Blaikie 6943dea321 Revert "Revert "Revert "Revert "DebugInfo: Omit debug info for dynamic classes in TUs that do not have the vtable for that class""""
This reverts commit r188687 (reverts r188642 (reverts 188600 (reverts
188576))).

With added test coverage & fix for -gline-tables-only.

Thanks Michael Gottesman for reverting this patch when it demonstrated
problems & providing a reproduction/details to help me track this down.

llvm-svn: 188739
2013-08-20 01:28:15 +00:00
Eli Friedman 0eaf10bc94 Fix name lookup with dependent using decls.
We previously mishandled UnresolvedUsingValueDecls in
NamedDecl::declarationReplaces, which caused us to forget decls
when there are multiple dependent using decls for the same name.

Fixes PR16936.

llvm-svn: 188737
2013-08-20 00:39:40 +00:00
Fariborz Jahanian d38ad47cfa ObjectiveC migrator: More work towards
insertion of ObjC audit pragmas.

llvm-svn: 188733
2013-08-20 00:07:23 +00:00
Juergen Ributzka 53e2f275d2 Fix last commit.
llvm-svn: 188724
2013-08-19 23:08:53 +00:00
Juergen Ributzka c6ab1f8bfd Simplify code by using CreateMemTemp. No functional change intended.
Reviewer: Eli
llvm-svn: 188722
2013-08-19 22:20:37 +00:00
Eli Friedman 4628cf763b Handle init lists and _Atomic fields.
Fixes PR16931.

llvm-svn: 188718
2013-08-19 22:12:56 +00:00
Richard Smith a6c8703e5b PR16727: don't try to evaluate a potentially value-dependent expression when
checking for missing parens in &&/|| expressions.

llvm-svn: 188716
2013-08-19 22:06:05 +00:00
Fariborz Jahanian c6dfd3f8f2 ObjectiveC migrator: Start inserting
CF_IMPLICIT_BRIDGING_ENABLE/CF_IMPLICIT_BRIDGING_DISABLED
pair. wip.

llvm-svn: 188714
2013-08-19 22:00:50 +00:00
David Blaikie 4a9ec7b59d PR16933: Don't try to codegen things after we've seen errors.
Refactor the underlying code a bit to remove unnecessary calls to
"hasErrorOccurred" & make them consistently at all the entry points to
the IRGen ASTConsumer.

llvm-svn: 188707
2013-08-19 21:02:26 +00:00
Robert Wilhelm 27b2c9a352 const'ify Sema::ActOnCompoundStmt by
changing Parameter of Sema::ActOnCompoundStmt from MutableArrayRef to
ArrayRef.
No functionality change intended.

llvm-svn: 188705
2013-08-19 20:51:20 +00:00
Bob Wilson 834400b484 Bump the value of the __APPLE_CC__ predefined macro up to 6000.
The previous value was set to match some ancient version of Apple's GCC.
The value should be higher than anything used by Apple's GCC, but we don't
intend for this value to be updated in the future. We have other macros to
identify compiler versions. <rdar://problem/14749599>

llvm-svn: 188700
2013-08-19 20:23:37 +00:00
Fariborz Jahanian 9ef4a26de8 ObjectiveC migrator. Start auditing CF functions
for possible use of CF_IMPLICIT_BRIDGING_ENABLE
pragma.

llvm-svn: 188691
2013-08-19 19:13:34 +00:00
Michael Gottesman 349542b171 Revert "Revert "Revert "DebugInfo: Omit debug info for dynamic classes in TUs that do not have the vtable for that class"""
This reverts commit r188642.

This change is causing LTO builds to cause our 16 GB machines to swap and OOM
all weekend. I am going to work with Dave Blaikie to resolve the issue.

Sorry Dave =(.

llvm-svn: 188687
2013-08-19 18:46:16 +00:00
Jordan Rose 95cdf9d603 [analyzer] Don't run unreachable code checker on inlined functions.
This is still an alpha checker, but we use it in certain tests to make sure
something is not being executed.

This should fix the buildbots.

llvm-svn: 188682
2013-08-19 17:03:12 +00:00
Jordan Rose 60619a639b [analyzer] Assume that strings are no longer than SIZE_MAX/4.
This keeps the analyzer from making silly assumptions, like thinking
strlen(foo)+1 could wrap around to 0. This fixes PR16558.

Patch by Karthik Bhat!

llvm-svn: 188680
2013-08-19 16:27:34 +00:00
Jordan Rose 5374c07ab9 Omit arguments of __builtin_object_size from the CFG.
This builtin does not actually evaluate its arguments for side effects,
so we shouldn't include them in the CFG. In the analyzer, rely on the
constant expression evaluator to get the proper semantics, at least for
now. (In the future, we could get ambitious and try to provide path-
sensitive size values.)

In theory, this does pose a problem for liveness analysis: a variable can
be used within the __builtin_object_size argument expression but not show
up as live. However, it is very unlikely that such a value would be used
to compute the object size and not used to access the object in some way.

<rdar://problem/14760817>

llvm-svn: 188679
2013-08-19 16:27:28 +00:00
Pavel Labath 71bb987997 [analyzer] Fix inefficiency in dead symbol removal
Summary:
ScanReachableSymbols uses a "visited" set to avoid scanning the same object
twice. However, it did not use the optimization for LazyCompoundVal objects,
which resulted in exponential complexity for long chains of temporary objects.
Adding this resulted in a decrease of analysis time from >3h to 3 seconds for
some files.

Reviewers: jordan_rose

CC: cfe-commits

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

llvm-svn: 188677
2013-08-19 15:23:34 +00:00
Alexey Samsonov 0c127d7c71 Re-apply r188666
llvm-svn: 188675
2013-08-19 13:59:22 +00:00
Alexey Samsonov eb4690c76c Fix -Wcovered-switch-default warning from r188664
llvm-svn: 188672
2013-08-19 13:07:12 +00:00
NAKAMURA Takumi 053704f959 clang/Driver: [PR12920] Don't forward any -W arguments to gcc-as and gcc-ld.
AFAIK, there are no -W options for gcc-as and gcc-ld.
It caused failure to build clang with gcc-4.7 on cygwin.

FIXME: Could we recategorize Options for gcc-as and gcc-ld?
llvm-svn: 188668
2013-08-19 11:51:51 +00:00
Alexey Samsonov bca169c185 Revert r188666: it breaks the buildbots
llvm-svn: 188667
2013-08-19 11:42:54 +00:00
Alexey Samsonov 828e5e141d Fix PR16768: properly report malformed sanitizer blacklist file contents
llvm-svn: 188666
2013-08-19 10:41:30 +00:00
Daniel Jasper 5364306e12 clang-format: Fix return type line break decision.
This accidentally introduced by r186077, as function names were not
correctly recognized in templated declarations.

Before:
  template <class TemplateIt>
  SomeReturnType
  SomeFunction(TemplateIt begin, TemplateIt end, TemplateIt* stop) {}

After:
  template <class TemplateIt>
  SomeReturnType SomeFunction(TemplateIt begin, TemplateIt end,
                              TemplateIt* stop) {}

llvm-svn: 188665
2013-08-19 10:16:18 +00:00
Robert Lytton 7d1db15ae1 XCore target: Add target specific EmitVAArg
This is so aggregates can be passed as var args too.

llvm-svn: 188664
2013-08-19 09:46:39 +00:00
Alexey Samsonov 609213f9eb Move SanitizerArgs to the clang Driver
Summary:
This change turns SanitizerArgs into high-level options
stored in the Driver, which are parsed lazily. This fixes an issue of multiple copies of the same diagnostic message produced by sanitizer arguments parser.

Reviewers: rsmith

Reviewed By: rsmith

CC: chandlerc, eugenis, cfe-commits

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

llvm-svn: 188660
2013-08-19 09:14:21 +00:00
Robert Wilhelm 88e024969b Omit llvm:: before makeArrayRef. We have using directive in this file.
llvm-svn: 188659
2013-08-19 07:57:02 +00:00
David Blaikie 7fceebf5aa DebugInfo: Do not include line/file info for artificial parameters & parameters of artificial functions
llvm-svn: 188651
2013-08-19 03:37:48 +00:00
Craig Topper e691fce6e4 Make the version of Stmt::operator new that takes ASTContext* call the ASTContext& version in Stmt inline instead of having two out of line functions that both call to the global versions.
llvm-svn: 188648
2013-08-19 03:11:34 +00:00
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