Commit Graph

52012 Commits

Author SHA1 Message Date
Aaron Ballman 8dbbbcd246 Switching back from a static namespace-scoped function to a static class-scope function. No functional change, but resolves a warning.
llvm-svn: 205931
2014-04-09 21:40:14 +00:00
Aaron Ballman 28347a72c9 Thread Safety Analysis: now with less includes. No functional changes.
llvm-svn: 205929
2014-04-09 21:12:04 +00:00
Reid Kleckner 2a24e3ad86 clang-cl: Disable TBAA by default for MSVC compatibility
MSVC doesn't have an option to enable TBAA, so make -fstrict-aliasing
and -fno-strict-aliasing available in clang-cl.

llvm-svn: 205924
2014-04-09 20:07:39 +00:00
Anders Waldenborg 12da50a8e1 Handle difference in signedness of 'char' in test/Index/print-type.c{,pp}
llvm-svn: 205922
2014-04-09 19:39:07 +00:00
Anders Waldenborg ddce74f6f8 Make c-index-test -test-print-type include pointeekind for pointer types
The idea is to give visibility to more type kinds, especially for getting
a better grasp of what appears as unexposed type kind with libclang.

Differential Revision: http://reviews.llvm.org/D3325

llvm-svn: 205921
2014-04-09 19:16:08 +00:00
Bob Wilson 0e011f201d Add a -triple argument so that this new test passes on Darwin.
The section names used here are not valid for Mach-O.

llvm-svn: 205920
2014-04-09 18:51:19 +00:00
Argyrios Kyrtzidis 9ef53ceb51 [Preprocessor/CodeComplete] Don't add include guard macros to code-completion results.
llvm-svn: 205917
2014-04-09 18:21:23 +00:00
Aaron Ballman 91b079a9fc Cannot have the base class destructor be private (or explicitly deleted); fixing the build bots.
llvm-svn: 205916
2014-04-09 17:55:04 +00:00
Aaron Ballman 3f993c1320 Thread Safety Analysis: some minor cleanups to the latest thread safety changes. No functional changes intended.
* Adds an iterator_range interface to CallExpr to get the arguments
* Modifies SExpr such that it must be allocated in the Arena, and cannot be deleted
* Minor const-correctness and nullptr updates
* Adds some operator!= implementations to complement operator==
* Removes unused functionality

llvm-svn: 205915
2014-04-09 17:45:44 +00:00
Daniel Jasper b55248278f clang-format: Update flag documentation, and generation script.
llvm-svn: 205853
2014-04-09 14:05:49 +00:00
Daniel Jasper f9fc215f82 clang-format: Treat a trailing comment like a trailing comma in braced lists.
Before:
  static StructInitInfo module = {MODULE_BUILTIN, /* type */
                                  "streams" /* name */
  };

After:
  static StructInitInfo module = {
      MODULE_BUILTIN, /* type */
      "streams"       /* name */
  };

This fixes llvm.org/PR19378.

llvm-svn: 205851
2014-04-09 13:18:49 +00:00
Daniel Jasper 21397a3232 clang-format: Fix bug where clang-format would break the code.
Before, it would turn:
  SomeFunction([]() { // Cool function..
    return 43;
  });

Into this:
  SomeFunction([]() { // Cool function.. return 43; });

llvm-svn: 205849
2014-04-09 12:21:48 +00:00
Daniel Jasper 3ae6f5a47b clang-format: Improve format of calls with several lambdas.
Before:
  SomeFunction([]() {
                 int i = 42;
                 return i;
               },
               []() {
    int j = 43;
    return j;
  });

After:
  SomeFunction([]() {
                 int i = 42;
                 return i;
               },
               []() {
                 int j = 43;
                 return j;
               });

llvm-svn: 205848
2014-04-09 12:08:39 +00:00
Daniel Jasper f9a0906b98 clang-format: Allow breaking between trailing annotations in more cases.
Before:
  void aaaaaaaaaaaaaa(aaaaaaaa aaa) override AAAAAAAAAAAAAAAAAAAAAAAA(
      aaaaaaaaaaaaaaa);

After:
  void aaaaaaaaaaaaaa(aaaaaaaa aaa) override
      AAAAAAAAAAAAAAAAAAAAAAAA(aaaaaaaaaaaaaaa);

llvm-svn: 205846
2014-04-09 10:29:11 +00:00
Daniel Jasper b48d3afcd5 clang-format: Keep more trailing annotations on the same line.
More precisely keep all short annotations (<10 characters) on the same
line if possible. Previously, clang-format would only prefer to do so
for "const", "override" and "final". However, it seems to be generally
preferable, especially because some codebases have to wrap those in
macros for backwards compatibility.

Before:
  void someLongFunction(int someLongParameter)
      OVERRIDE {}

After:
  void someLongFunction(
      int someLongParameter) OVERRIDE {}

This fixes llvm.org/PR19363.

llvm-svn: 205845
2014-04-09 10:01:49 +00:00
Daniel Jasper b175d57edc clang-format: Recognize lists ending in trailing commas correctly.
Previously, this did not look through trailing comments leading to a few
formatting oddities.

llvm-svn: 205843
2014-04-09 09:53:23 +00:00
Daniel Jasper dfacecbd31 clang-format: Add proto files and JavaScript to git-clang-format.
llvm-svn: 205842
2014-04-09 09:22:35 +00:00
NAKAMURA Takumi f605f76519 Sema::SectionInfo() should have an empty body. Sorry for the breakage.
llvm-svn: 205841
2014-04-09 08:26:33 +00:00
NAKAMURA Takumi cdb365000d Sema::SectionInfo: Prune "default" for now. Defaulted function is unavailable on msc17.
llvm-svn: 205840
2014-04-09 07:59:55 +00:00
Richard Trieu c65a56901f Add missing include.
llvm-svn: 205828
2014-04-09 03:31:44 +00:00
Jordan Rose 0675c87395 [analyzer] When checking Foundation method calls, match the selectors exactly.
This also includes some infrastructure to make it easier to build multi-argument
selectors, rather than trying to use string matching on each piece. There's a bit
more setup code, but less cost at runtime.

PR18908

llvm-svn: 205827
2014-04-09 01:39:22 +00:00
Warren Hunt 975d58c0f9 [MS-ABI] Lit fix for r205810
On linux strings have different linkage than on windows.  This 
patch makes the lit test more general.

llvm-svn: 205812
2014-04-08 22:49:38 +00:00
Warren Hunt c3b18967ed [MS-ABI] Add support for #pragma section and related pragmas
This patch adds support for the msvc pragmas section, bss_seg, code_seg, 
const_seg and data_seg as well as support for __declspec(allocate()).

Additionally it corrects semantics and adds diagnostics for 
__attribute__((section())) and the interaction between the attribute 
and the msvc pragmas and declspec.  In general conflicts should now be 
well diganosed within and among these features.

In supporting the pragmas new machinery for uniform lexing for 
msvc pragmas was introduced.  The new machinery always lexes the 
entire pragma and stores it on an annotation token.  The parser 
is responsible for parsing the pragma when the handling the 
annotation token.

There is a known outstanding bug in this implementation in C mode.  
Because these attributes and pragmas apply _only_ to definitions, we 
process them at the time we detect a definition.  Due to tentative 
definitions in C, we end up processing the definition late.  This means 
that in C mode, everything that ends up in a BSS section will end up in 
the _last_ BSS section rather than the one that was live at the time of 
tentative definition, even if that turns out to be the point of actual 
definition.  This issue is not known to impact anything as of yet 
because we are not aware of a clear use or use case for #pragma bss_seg 
but should be fixed at some point.

Differential Revision=http://reviews.llvm.org/D3065#inline-16241 

llvm-svn: 205810
2014-04-08 22:30:47 +00:00
DeLesley Hutchins f7813c56b4 Thread Safety Analysis. Misc fixes to SExpr code, responding to code review
by Aaron Ballman.

llvm-svn: 205809
2014-04-08 22:21:22 +00:00
Reid Kleckner 10847c3ed1 Fix the funcsig test with an explicit triple
llvm-svn: 205781
2014-04-08 18:28:09 +00:00
Reid Kleckner 52edddaea5 Add support for MSVC's __FUNCSIG__
It is very similar to GCC's __PRETTY_FUNCTION__, except it prints the
calling convention.

Reviewers: majnemer

Differential Revision: http://reviews.llvm.org/D3311

llvm-svn: 205780
2014-04-08 18:13:24 +00:00
Reid Kleckner 6df5254d6f intrin.h: Fix up bugs in the cr3 and msr intrinsics
Don't include input and output regs in clobbers.  Prefix some
identifiers with __.  Add a memory constraint to __readcr3 to prevent
reordering.  This constraint is heavy handed, but conservatively
correct.

Thanks to PaX Team for the suggestions.

llvm-svn: 205778
2014-04-08 17:49:16 +00:00
Ben Langmuir 1e25822f4d Have validate-system-headers override validate-once-per-build-session
llvm-svn: 205773
2014-04-08 15:36:28 +00:00
Daniel Jasper b77105d2ce clang-format: Fix incorrect multi-block-parameter computation.
llvm-svn: 205763
2014-04-08 14:04:31 +00:00
Richard Smith 50996ce1e3 If a header is explicitly included in module A, and excluded from an umbrella
directory in module B, don't include it in module B!

llvm-svn: 205762
2014-04-08 13:13:04 +00:00
Daniel Jasper 139d4a3875 clang-format: Correctly understand arrays of pointers.
Before:
  A<int * []> a;

After:
  A<int *[]> a;

This fixes llvm.org/PR19360.

llvm-svn: 205761
2014-04-08 13:07:41 +00:00
Daniel Jasper d74cf40386 clang-format: Extend AllowShortFunctions.. to only merge inline functions.
Before AllowShortFunctionsOnASingleLine could either be true, merging
all functions, or false, merging no functions. This patch adds a third
value "Inline", which can be used to only merge short functions defined
inline in a class, i.e.:

  void f() {
    return 42;
  }

  class C {
    void f() { return 42; }
  };

llvm-svn: 205760
2014-04-08 12:46:38 +00:00
Richard Smith 6c6bbfab19 PR19346: Adding 0 to a null pointer has defined behavior in C++. Allow it in constant expressions.
llvm-svn: 205757
2014-04-08 12:19:28 +00:00
Reid Kleckner 592dc61acf intrin.h: Implement __readmsr, __readcr3, and __writecr3
Fixes PR19301.

Based on a patch from Steven Graf!

llvm-svn: 205751
2014-04-08 00:28:22 +00:00
DeLesley Hutchins 11bb308739 Thread Safety Analysis: various fixes to new SExpr code.
Implemented ownership policy, updated to use nullptr, const-cleanup.

llvm-svn: 205745
2014-04-07 22:56:24 +00:00
DeLesley Hutchins 43fd21a045 Thread Safety Analysis: fix warning.
llvm-svn: 205733
2014-04-07 19:51:32 +00:00
Reid Kleckner 0dc06b9a3d -fms-extensions: Don't define __PRETTY_FUNCTION__ to __FUNCTION__
This reverts r90596 from 2009. Having this macro definition makes Clang
strictly less useful with -fms-extensions.

llvm-svn: 205729
2014-04-07 19:27:58 +00:00
DeLesley Hutchins b2213910de Thread Safety Analysis: update to internal SExpr handling.
This patch is the first part of a significant refactoring that seeks to restore
sanity to way thread safety analysis deals with capability expressions.  The
current patch merely provides an outline of the structure of the new system.
It's not yet connected to the actual analysis, so there's no change in
functionality.

llvm-svn: 205728
2014-04-07 18:09:54 +00:00
Reid Kleckner bf94e6e14d Mangle the vbptr offset into pointers to member functions
This can actually be non-zero if you override a function from a virtual
base and you have forced the most_general pointer to member
representation.

llvm-svn: 205727
2014-04-07 18:07:03 +00:00
Jordan Rose 7f07fc1fee [analyzer] Fix mistake in example for potential checker "posix.Errno".
Found by Richard Osbourne!

llvm-svn: 205721
2014-04-07 16:36:15 +00:00
Jordan Rose 9c8a5ff161 [analyzer] Re-enable test I accidentally committed commented-out.
Thanks, Alex!

llvm-svn: 205720
2014-04-07 16:36:08 +00:00
Fariborz Jahanian 148c8c8ec2 Revert r205646 (keeping the test in its modified form) as
it is subsumed by r205521.

llvm-svn: 205718
2014-04-07 16:32:54 +00:00
David Majnemer 6c684a727a Fix a typo introduced in r205716
llvm-svn: 205717
2014-04-07 16:19:27 +00:00
David Majnemer dc7a47ce2c clang-cl: make /Gw map to -fdata-sections
Note that /Gy no longer implies -fdata-sections.

llvm-svn: 205716
2014-04-07 16:14:38 +00:00
Richard Smith 151b8a3867 Fix clang-tidy warning (argument comments don't match parameter names).
llvm-svn: 205715
2014-04-07 15:16:58 +00:00
Dmitri Gribenko e570ede5d1 libclang: add clang_CXXMethod_isConst API that allows to determine if a C++
member function or member function template is declared 'const'

Patch by Kevin Funk with testcase updates by me.

llvm-svn: 205714
2014-04-07 14:59:13 +00:00
Serge Pavlov 28310eb751 Updated phabricator server.
llvm-svn: 205695
2014-04-07 03:39:55 +00:00
David Blaikie f1b382e87d DebugInfo: Support type alias templates
We already got the type alias correct (though I've included a test case
here) since Clang represents that like any other typedef - but type
alias templates weren't being handled.

llvm-svn: 205691
2014-04-06 17:14:06 +00:00
David Blaikie 551fb0a4ff DebugInfo: emit namespace aliases as named imported declarations instead of named imported entities
Apparently that's how DWARF4 suggests they be emitted. So let's do that.

llvm-svn: 205686
2014-04-06 06:30:03 +00:00
Argyrios Kyrtzidis 4382fe74bb [Frontend] If the module file lock owner have died, try to get the lock again. Needs llvm r205683.
llvm-svn: 205684
2014-04-06 03:21:44 +00:00
David Blaikie 506a745a0a Reapply r205655, DebugInfo: Place global constants in their appropriate context.
This was reverted in 205664 and seems to be fixed by 205668... though
that may be more by accident than anything well founded.

llvm-svn: 205669
2014-04-05 07:46:57 +00:00
David Blaikie bb11391d04 DebugInfo: Avoid emitting constnants for every use
While the folding set would deduplicate the nodes themselves and LLVM
would handle not emitting the same global twice, it still meant creating
a long/redundant list of global variables.

llvm-svn: 205668
2014-04-05 07:23:17 +00:00
Jordan Rose 4d6da2bb4f [analyzer] Add an ErrnoChecker (PR18701) to the Potential Checkers list.
llvm-svn: 205667
2014-04-05 06:10:28 +00:00
Jordan Rose a32968fc10 [analyzer] Update Open Projects page with BitwiseConstraintManager.
Also, add the names of people most recently working on particular projects,
and remove "relate bugs and checkers" (thanks, Alex!).

llvm-svn: 205666
2014-04-05 06:10:22 +00:00
Richard Trieu f935b562b9 Add a new subgroup to -Wtautological-compare, -Wtautological-overlap-compare,
which warns on compound conditionals that always evaluate to the same value.
For instance, (x > 5 && x < 3) will always be false since no value for x can
satisfy both conditions.

This patch also changes the CFG to use these tautological values for better
branch analysis.  The test for -Wunreachable-code shows how this change catches
additional dead code.

Patch by Anders Rönnholm.

llvm-svn: 205665
2014-04-05 05:17:01 +00:00
David Blaikie 98db356cc1 Revert "DebugInfo: Place global constants in their appropriate context."
This reverts commit r205655.

Breaks the compiler-rt build with an assertion failure in LLVM...
reverting while I investigate.

llvm-svn: 205664
2014-04-05 03:39:29 +00:00
Jordan Rose 8a5a094ec5 [analyzer] Look through temporary destructors when finding a region to construct.
Fixes a false positive when temporary destructors are enabled where a temporary
is destroyed after a variable is constructed but before the VarDecl itself is
processed, which occurs when the variable is in the condition of an if or while.

Patch by Alex McCarthy, with an extra test from me.

llvm-svn: 205661
2014-04-05 02:01:41 +00:00
Fariborz Jahanian 48a01cb5ec Objective-C arc [Sema]. Allow bridge cast of a qualified-id expression
when bridged Objective-C type conforms to the protocols in CF types's
Objective-C class. // rdar://16393330

llvm-svn: 205659
2014-04-04 23:53:45 +00:00
David Blaikie 2f2df07fa4 DebugInfo: Place global constants in their appropriate context.
We also don't need to duplicate the name in the LinkageName field. Just
leave it empty.

llvm-svn: 205655
2014-04-04 23:16:44 +00:00
Kaelyn Takata fb271f0cab Try harder about not suggesting methods as corrections when they
obviously won't work. Specifically, don't suggest methods (static or
not) from unrelated classes when the expression is a method call
through a specific object.

llvm-svn: 205653
2014-04-04 22:16:30 +00:00
David Blaikie a1556556d6 DebugInfo: PR19298: function local const variables duplicated in the root scope
See the comment for CodeGenFunction::tryEmitAsConstant that describes
how in some contexts (lambdas) we must not emit references to the
variable, but instead use the constant directly - because of this we end
up emitting a constant for the variable, as well as emitting the
variable itself.

Should we just skip putting the variable on the stack at all and omit
the debug info for the constant? It's not clear to me - what if the
address of the local is taken?

llvm-svn: 205651
2014-04-04 20:56:17 +00:00
Saleem Abdulrasool f4c9e49f94 Driver: add target definition for Windows on ARM
This introduces the definitions needed for the Windows on ARM target.  Add
target definitions for both the MSVC environment and the MSVC + Itanium C++ ABI
environment.  The Visual Studio definitions correspond to the definitions
provided by Visual Studio 2012.

llvm-svn: 205650
2014-04-04 20:31:19 +00:00
Fariborz Jahanian ad95da7334 Vector [Sema]. Vector "splats" which are truncated should have a warning
with -Wconversion. // rdar://16502418

llvm-svn: 205646
2014-04-04 19:33:39 +00:00
Ben Langmuir f9a6ac213a Add a test where the module map is overriden in the vfs
Specifically, we pass two -ivfsoverlay yaml files, and the topmost one
remaps the module map file.

llvm-svn: 205632
2014-04-04 16:42:53 +00:00
Aaron Ballman 7605072e61 In preparation for being able to use simple Boolean logic expressions involving capabilities, the semantics for attributes now looks through the types of the constituent parts of a capability expression instead of at the aggregate expression type.
llvm-svn: 205629
2014-04-04 15:13:57 +00:00
Joey Gouly 92a47442f4 When printing types for the OpenCL kernel metadata, use the PrintingPolicy.
This allows 'half' to be printed as 'half' and not as '__fp16'.

Patch by Fraser Cormack!

llvm-svn: 205624
2014-04-04 13:43:57 +00:00
Alexey Bataev 444120d4bc [OPENMP][C++11] Renamed loop vars properly.
llvm-svn: 205620
2014-04-04 10:02:14 +00:00
Daniel Jasper 922349cdba clang-format: Don't merge simple blocks in case statements.
Before:
  switch (a) {
  case 1: { return 'a'; }
  }

After:
  switch (a) {
  case 1: {
    return 'a';
  }
  }

llvm-svn: 205611
2014-04-04 06:46:23 +00:00
Saleem Abdulrasool 79ed5d44e7 Basic: rename VisualStudio to Windows
Visual Studio is the Integrated Development Environment.  The toolchain is
generally referred to MSVC.  Rename the target information to be more precise as
per the recommendation of Reid Kleckner.

llvm-svn: 205609
2014-04-04 05:08:53 +00:00
Richard Trieu 0f09774f17 Extend -Wtautological-constant-out-of-range-compare to handle boolean values
better.  This warning will now trigger on the following conditionals:

bool b;
int i;

if (b > 1) {}  // always false
if (0 <= (i > 5)) {} // always true
if (-1 > b) {} // always false

Patch by Per Viberg.

llvm-svn: 205608
2014-04-04 04:13:47 +00:00
Justin Bogner f3aefca7c1 CodeGen: Don't create branch weight metadata from empty profiles
If all of our weights are zero when calculating branch weights, it
means we haven't profiled the code in question. Avoid creating a
metadata node that says all branches are equally likely in this case.

The test also checks constructs that hit the other createBranchWeights
overload. These were already working.

llvm-svn: 205606
2014-04-04 02:48:51 +00:00
Reid Kleckner 9307fba85d Add clang-cl alias to allow users to disable c4005
If we ever want three or more aliases, at that point we should put MSVC
warning ids in DiagnosticGroups.td.  We can use that to support #pragma
warning.

llvm-svn: 205598
2014-04-04 01:36:55 +00:00
Reid Kleckner 98a1266218 Put macro redefinition warnings under -Wmacro-redefined
This is consistent with -Wbuiltin-macro-redefined, and puts this common
extension warning under a flag.

Reviewers: rsmith

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

llvm-svn: 205591
2014-04-04 00:17:16 +00:00
Fariborz Jahanian 5ce227971e Turn off -Wmissing-noreturn warning for blocks
as there is no way to attach this attribute to the
block literal. // rdar://16274746

llvm-svn: 205580
2014-04-03 23:06:35 +00:00
Fariborz Jahanian 275542a40e vector [Sema]. Check for proper use of 's' char prefix
(which indicates vector expression is a string of hex
values) instead of crashing in code gen. // rdar://16492792

llvm-svn: 205557
2014-04-03 19:43:01 +00:00
Reid Kleckner d3923aaa6e -fms-extensions: Error out on #pragma init_seg
By ignoring this pragma with a warning, we're essentially miscompiling
the user's program.  WebKit / Blink use this pragma to disable dynamic
initialization and finalization of some static data, and running the
dtors crashes the program.

Error out for now, so that /fallback compiles the TU correctly with
MSVC.  This pragma should be implemented some time this month, and we
can remove this hack.

llvm-svn: 205554
2014-04-03 19:04:24 +00:00
Roman Divacky 6150990d59 Revert r205436:
Extend the SSE2 comment lexing to AVX2. Only 16byte align when not on AVX2.

        This provides some 3% speedup when preprocessing gcc.c as a single file.


The patch is wrong, it always uses SSE2, and when I fix that there's no speedup
at all. I am not sure where the 3% came from previously.

--Thi lie, and those below, will be ignored--

M    Lex/Lexer.cpp

llvm-svn: 205548
2014-04-03 18:04:52 +00:00
Faisal Vali b90b211eea Teach getTemplateInstantiationPattern to deal with generic lambdas.
No functionality change.

When determining the pattern for instantiating a generic lambda call operator specialization - we must not go drilling down for the 'prototype' (i.e. as written) pattern - rather we must use our partially transformed  pattern (whose DeclRefExprs are wired correctly to any enclosing lambda's decls that should be mapped correctly in a local instantiation scope) that is the templated pattern of the specialization's primary template (even though the primary template might be instantiated from a 'prototype' member-template).  Previously, the drilling down was haltted by marking the instantiated-from primary template as a member-specialization (incorrectly). 

This prompted Richard to remark (http://llvm-reviews.chandlerc.com/D1784?id=4687#inline-10272) 
"It's a bit nasty to (essentially) set this bit incorrectly. Can you put the check into getTemplateInstantiationPattern instead?"

In my reckless youth, I chose to ignore that comment.  With the passage of time, I have come to learn the value of bowing to the will of the angry Gods ;) 

llvm-svn: 205543
2014-04-03 16:32:21 +00:00
Logan Chien 749763eaf7 Code cleanup (re-indent)
llvm-svn: 205536
2014-04-03 13:12:44 +00:00
Samuel Benzaquen 5548eadb1c Revert "Add support for named values in the parser."
This was submitted before it was ready.

This reverts commit 62060a01e095cf35eb9ca42a333752d12714f35c.

llvm-svn: 205533
2014-04-03 12:50:47 +00:00
Daniel Jasper 5c33265c9e clang-format: Prefer an additional line-break over hanging indent.
Don't allow the RHS of an operator to be split over multiple
lines unless there is a line-break right after the operator.

Before:
  if (aaaa && bbbbb || // break
                  cccc) {
  }

After:
  if (aaaa &&
      bbbbb || // break
          cccc) {
  }

In most cases, this seems to increase readability.

llvm-svn: 205527
2014-04-03 12:00:33 +00:00
Daniel Jasper 2b7556ec16 x
llvm-svn: 205526
2014-04-03 12:00:27 +00:00
Stephen Canon 3ba640d7ae Improved semantics for implicit scalar -> extvector conversions.
llvm-svn: 205521
2014-04-03 10:33:25 +00:00
Daniel Jasper cc7bf7fda1 clang-format: Understand that "auto" is a type.
Before:
  MACRO(auto * a);

After:
  MACRO(auto *a);

llvm-svn: 205517
2014-04-03 09:00:49 +00:00
Alexey Bataev e5d1a405b8 [OPENMP] Small update for C++11
llvm-svn: 205506
2014-04-03 02:55:46 +00:00
Ben Langmuir 2b81e8564a Allow ASTFile to be reset to null
Which we do in removeModules().

llvm-svn: 205491
2014-04-03 00:14:16 +00:00
David Majnemer 54e3ba5ace CodeGen: Emit some functions as weak_odr under -fms-compatibility
Summary:
MSVC always emits inline functions marked with the extern storage class
specifier.  The result is something similar to the opposite of
__attribute__((gnu_inline)).

This extension is also available in C.

This fixes PR19264.

Reviewers: rnk, rsmith

CC: cfe-commits

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

llvm-svn: 205485
2014-04-02 23:17:29 +00:00
Fariborz Jahanian 33079ee0e6 Objective-C [IRGen]. Add encoding for 'weak' attribute of a
'readonly' property. // rdar://16136439

llvm-svn: 205477
2014-04-02 22:49:42 +00:00
Richard Smith 7ad0b88396 If a using-declaration names a class member, but appears outside a class, try
to suggest a different syntax to get the same effect.

llvm-svn: 205467
2014-04-02 21:44:35 +00:00
Richard Smith c392617cff PR19305: Don't issue -Wunused-variable warnings on variable templates. It's not
meaningful to odr-use the VarDecl inside a variable template. (Separately, it'd
be nice to track referenced-ness for templates, and warn on unused ones, but
that's really a distinct issue...)

Move a test that generates and tests a warning-suppressing error out to its own
test file, so it doesn't have weird effects on the other tests in the same file.

llvm-svn: 205448
2014-04-02 18:28:36 +00:00
David Blaikie 65813a3bce DebugInfo: Include default template arguments in template type names
This was committed 4 years ago in 108916 with insufficient testing to
explain why the "getTypeAsWritten" case was appropriate. Experience says
that it isn't - the presence or absence of an explicit instantiation
declaration was causing this code to generate either i<int> or i<int,
int>.

That didn't seem to be a useful distinction, and omitting the template
arguments was destructive to debuggers being able to associate the two
types across translation units or across compilers (GCC, reasonably,
never omitted the arguments).

llvm-svn: 205447
2014-04-02 18:21:09 +00:00
Roman Divacky 071e830bbb Extend the SSE2 comment lexing to AVX2. Only 16byte align when not on AVX2.
This provides some 3% speedup when preprocessing gcc.c as a single file.

llvm-svn: 205436
2014-04-02 17:27:03 +00:00
Samuel Benzaquen f10662923a Add matcher for ExprWithCleanups.
Summary: Add matcher for ExprWithCleanups.

Reviewers: klimek

CC: cfe-commits, klimek

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

llvm-svn: 205420
2014-04-02 13:12:14 +00:00
Samuel Benzaquen 2019cea863 Add support for named values in the parser.
Summary:
Add support for named values in the parser.
This allows injection of arbitrary constants using a custom Sema object.
Completions are not supported right now.

Will be used by clang_query to support the 'let' command.
Usage example:
  clang_query> let unique_ptr recordDecl(hasName("unique_ptr"))
  clang_query> match varDecl(hasType(unique_ptr))

Reviewers: klimek, pcc

CC: cfe-commits, klimek

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

llvm-svn: 205419
2014-04-02 13:11:45 +00:00
David Blaikie bdb34beae0 Some more anonymous namespace diagnostics to switch to ()
llvm-svn: 205400
2014-04-02 06:18:49 +00:00
David Blaikie abe1a398e3 Render anonymous entities as '(anonymous <thing>)' (and lambdas as '(lambda at ... )')
For namespaces, this is consistent with mangling and GCC's debug info
behavior. For structs, GCC uses <anonymous struct> but we prefer
consistency between all anonymous entities but don't want to confuse
them with template arguments, etc, so we'll just go with parens in all
cases.

llvm-svn: 205398
2014-04-02 05:58:29 +00:00
David Blaikie 5ee3d0080a Add the location of Decls to ast dump.
While investigating some debug info issues, Eric and I came across a
particular template case where the location of a decl was quite
different from the range of the same decl. It might've been rather
helpful if the dumper had actually showed us this.

llvm-svn: 205396
2014-04-02 05:48:29 +00:00
Reid Kleckner 5e8edbac4f Fix type mismatch assertion related to inalloca and PR19287
Augment the test case from r205217 to catch this related bug.

Fixes the Windows self-host which was failing on VariantValue.cpp.

llvm-svn: 205378
2014-04-02 00:16:53 +00:00
Eric Christopher 9ae10e64df Harden this test against windows/changes.
llvm-svn: 205370
2014-04-01 22:54:59 +00:00
Eric Christopher 885c41b28c Partially revert r204517 and fix a different way:
We don't want to encourage the code to emit a lexical block for
a function that needs one in order for the line table to change,
we need to grab the line information from the body of the pattern
that we were instantiated from, this code should do that.

Modify the test case to ensure that we're still looking in the
right place for all of the scopes and also that we haven't
created a lexical block where we didn't need one.

llvm-svn: 205368
2014-04-01 22:25:28 +00:00
Aaron Ballman e044904301 Updating the capability attribute diagnostics to be more capability-neutral. Instead of using terminology such as "lock", "unlock" and "locked", the new terminology is "acquire", "release" and "held". Additionally, the capability attribute's name argument is now reported as part of the diagnostic, instead of hard coding as "mutex."
llvm-svn: 205359
2014-04-01 21:43:23 +00:00
Fariborz Jahanian 287e79a263 Objective-C modern translator. Fix declaration of
__NSConstantStringImpl's length field to accomodate
window's 64bit LLP64 mode. // rdar://16489050

llvm-svn: 205353
2014-04-01 19:32:35 +00:00
Richard Smith 911517848d Simplify FunctionDecl::getMinRequiredArguments().
llvm-svn: 205351
2014-04-01 19:18:16 +00:00
Richard Smith f97ad226dc Fix self-referential comment.
llvm-svn: 205340
2014-04-01 18:33:50 +00:00
Richard Smith 651512995e More tests for DR1.
llvm-svn: 205339
2014-04-01 18:32:16 +00:00
Adrian Prantl efb8805161 Debug info: fix a crash when emitting IndirectFieldDecls, which were
previously not handled at all.
rdar://problem/16348575

llvm-svn: 205331
2014-04-01 17:52:06 +00:00
Jordan Rose 17f4160859 [analyzer] Extract a helper for finding the target region for a C++ constructor.
No functionality change.

Patch by Alex McCarthy!

llvm-svn: 205328
2014-04-01 16:40:06 +00:00
Jordan Rose a78de33494 [analyzer] Remove incorrect workaround for unimplemented temporary destructors.
If we're trying to get the zero element region of something that's not a region,
we should be returning UnknownVal, which is what ProgramState::getLValue will
do for us.

Patch by Alex McCarthy!

llvm-svn: 205327
2014-04-01 16:39:59 +00:00
Jordan Rose 398fb00e1e [analyzer] Fix a CFG printing bug.
Also, add several destructor-related tests. Most of them don't work yet, but it's
good to have them recorded.

Patch by Alex McCarthy!

llvm-svn: 205326
2014-04-01 16:39:33 +00:00
Aaron Ballman 2b9036d54d Fixing the MSVC 2012 build bot, which cannot do initializer lists yet. Amends r205307.
llvm-svn: 205325
2014-04-01 16:30:35 +00:00
Alexey Samsonov bdfa6c2517 Add support for dynamic ASan runtime (on Linux) to Clang driver.
Based on http://llvm-reviews.chandlerc.com/D3043 by Yuri Gribov!

llvm-svn: 205310
2014-04-01 13:31:10 +00:00
Daniel Jasper e1e4319ab7 clang-format: Support configurable list of foreach-macros.
This fixes llvm.org/PR17242.

Patch by Brian Green, thank you!

llvm-svn: 205307
2014-04-01 12:55:11 +00:00
Tim Northover b17f9a4609 ARM64: add a few bits of polynomial intrinsic codegen.
llvm-svn: 205303
2014-04-01 12:23:08 +00:00
Tim Northover 74b2def0c5 ARM64: add missing ldN/stN intrinsics and enable tests.
llvm-svn: 205296
2014-04-01 10:37:47 +00:00
Ted Kremenek 8d265c2633 Add defensive check that argument may be null in call to compareConversionFunctions() on incorrect code.
I'm looking into getting a reduced test case, but it's not
immediately available.

Fixes <rdar://problem/16344806>

llvm-svn: 205285
2014-04-01 07:23:18 +00:00
David Majnemer 2e1e0491b7 MS ABI: Support mangling of return-types deducing to local types
The MS ABI forces us into catch-22 when it comes to functions which
return types which are local:

 - A function is mangled with it's return type.
 - A type is mangled with it's surrounding context.

Avoid this by mangling auto and decltype(autp) directly into the
function's return type.  Using this mangling has the double advantage of
being compatible with the C++ standard without crashing the compiler.

N.B. For the curious, the MSVC mangling leads to collisions amongst
template functions and either crashes when faced with local types or is
otherwise incapable of returning them.

llvm-svn: 205282
2014-04-01 05:29:46 +00:00
Adrian Prantl 6cdce9ed10 Adapt CGDebugInfo to interface changes in DIBuilder/DIImportedEntity.
The Decl field in a DIImportedEntity is now a DIRef.
Paired commit with LLVM.

llvm-svn: 205278
2014-04-01 03:41:01 +00:00
Jordan Rose 3a176ed16d [analyzer] Lock checker: Allow pthread_mutex_init to reinitialize a destroyed lock.
Patch by Daniel Fahlgren!

llvm-svn: 205276
2014-04-01 03:40:53 +00:00
Jordan Rose 7fcaa14a82 [analyzer] Lock checker: make sure locks aren't used after being destroyed.
Patch by Daniel Fahlgren!

llvm-svn: 205275
2014-04-01 03:40:47 +00:00
Jordan Rose 0696bb4cef [analyzer] Add double-unlock detection to PthreadLockChecker.
We've decided to punt on supporting recursive locks for now; the common case
is non-recursive.

Patch by Daniel Fahlgren!

llvm-svn: 205274
2014-04-01 03:40:38 +00:00
Richard Smith 5557f6d678 Add failing testcase for DR305. Looks like we didn't implement the resolution
here in the simple-template-id case.

llvm-svn: 205273
2014-04-01 01:58:11 +00:00
Bob Wilson fc6297f314 Disable this-return optimizations when targeting iOS 5 and earlier.
Clang implements the part of the ARM ABI saying that certain functions
(e.g., constructors and destructors) return "this", but Apple's version of
gcc and llvm-gcc did not. The libstdc++ dylib on iOS 5 was built with
llvm-gcc, which means that clang cannot safely assume that code from the C++
runtime will correctly follow the ABI. It is also possible to run into this
problem when linking with other libraries built with gcc or llvm-gcc. Even
though there is no way to reliably detect that situation, it is most likely
to come up when targeting older versions of iOS. Disabling the optimization
for any code targeting iOS 5 solves the libstdc++ problem and has a reasonably
good chance of fixing the issue for other older libraries as well.
<rdar://problem/16377159>

llvm-svn: 205272
2014-04-01 01:38:16 +00:00
David Blaikie 65cbbd4ac5 Fix up compression related test cases
Fallout from r205261, ensure it doesn't matter how we disable compressed
debug info, even if zlib is missing and that we warn when we don't have
zlib and don't warn when we do, all while silently suppressing these
tests on the systems they weren't intended for...

llvm-svn: 205271
2014-04-01 00:27:28 +00:00
David Majnemer 10befcf993 MS ABI: Simplify MangleByte further
It turns out that the ranges where the '?' <letter> manglings occur are
identical to the ranges of ASCII characters OR'd with 0x80.

Thanks to Richard Smith for the insight!

No functional change.

llvm-svn: 205270
2014-04-01 00:05:57 +00:00
David Blaikie b31e1d16df Comment necessity of early initialization
Code review feedback from Eric Christopher on r204261.

I didn't want to go into too much detail (the revision history should
provide the full stuff) - but I can add more if that's preferred.

Also moved this up to right by the construction of the MCAsmInfo so
there's less chance that other things might sneak in in between.

llvm-svn: 205267
2014-03-31 23:47:13 +00:00
David Blaikie 24bbfed221 Warn when requesting compress-debug-sections and zlib is not available
Another shot in the dark, since I do have zlib installed. Will be
watching the bots for fallout.

llvm-svn: 205265
2014-03-31 23:29:38 +00:00
David Blaikie 07b8d4e6ed DebugInfo compression: Enable compression before any sections are created.
For those playing at home this produced some fairly subtle behavior. The
sections created in InitMCObjectFileInfo were created without compressed
debug info (a mistake, but not necessarily /broken). Since these
sections were almost always referenced by the existing MCSection object,
this almost worked.

This got weird when we got to handling the relocations for a section.
See ELFObjectWriter::WriteSection where we compute the true section for
a relocation section by simply stripping the ".rela" prefix and then
looking up that section - doing so hit the compression codepath, looked
up .zdebug_blah and found a newly constructed empty section... thus,
things got weird.

This is untestable without a cross-project test (let me know if people
would prefer that to no testing).

llvm-svn: 205261
2014-03-31 23:13:30 +00:00
Paul Robinson f067435026 Implement the 'optnone' attribute, which suppresses most optimizations
on a function.

llvm-svn: 205255
2014-03-31 22:29:15 +00:00
David Majnemer 2daf9b165e MS ABI: Add a test for Unicode literals
This adds coverage for Unicode code points which are encoded with
non-zero values in the upper half of the wchar_t.

No functionality change.

llvm-svn: 205251
2014-03-31 21:46:09 +00:00
David Majnemer e49c4b6ff2 MS ABI: Simplify endian swapping code
No functionality change.

llvm-svn: 205250
2014-03-31 21:46:05 +00:00
Richard Smith 39006cd3b8 Remove redundant template specialization that just duplicates the partial
specialization that would otherwise be selected.

llvm-svn: 205249
2014-03-31 21:31:04 +00:00
Aaron Ballman fdd783a501 Unify __declspec attribute argument parsing with the common attribute argument parsing code.
This removes a diagnostic that is no longer required (the semantic engine now properly handles attribute syntax so __declspec and __attribute__ spellings no longer get mismatched). This caused several testcases to need updating for a slightly different wording.

llvm-svn: 205234
2014-03-31 18:18:43 +00:00
Aaron Ballman b8e203939e Introduced an attribute syntax-neutral method for parsing attribute arguments that is currently being used by GNU and C++-style attributes. This allows C++11 attributes with argument lists to be handled properly, fixing the "deprecated", "type_visibility", and capability-related attributes with arguments.
llvm-svn: 205226
2014-03-31 17:32:39 +00:00
David Majnemer 4b293ebbaa MS ABI: mangleStringLiteral shouldn't rely on the host's endianness
No test case is needed, the one in-tree is sufficient.  The build-bot
never emailed me because something else had upset it.

llvm-svn: 205225
2014-03-31 17:18:53 +00:00
David Majnemer 49e5b123d7 MS ABI: Document the '\xc1' to '\xda' manglings
No functionality change.

llvm-svn: 205223
2014-03-31 17:09:09 +00:00
Benjamin Kramer 9e135ddd1d Remove unused diagnostic + dead test for it.
llvm-svn: 205220
2014-03-31 16:55:01 +00:00
David Majnemer 7b4f7d2206 MS ABI: Make test introduced in r205217 more robust
Don't assume any particular IR Value name, pattern match the names from
the GEP instructions instead.

llvm-svn: 205218
2014-03-31 16:30:00 +00:00
David Majnemer 32b57b0a4c MS ABI: Use the proper type for inalloca args
Summary:
The definition of a type later in a translation unit may change it's
type from {}* to (%struct.foo*)*.  Earlier function definitions may use
the former while more recent definitions might use the later.  This is
fine until they interact with one another (like one calling the other).
In these cases, a bitcast is needed because the inalloca must match the
function call but the store to the lvalue which initializes the argument
slot has to match the rvalue's type.

This technique is along the same lines with what the other,
non-inalloca, codepaths perform.

This fixes PR19287.

Reviewers: rnk

CC: cfe-commits

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

llvm-svn: 205217
2014-03-31 16:12:47 +00:00
Tim Northover 0c68faa455 ARM64: enable aarch64-neon-intrinsics.c test
This adds support for the various NEON intrinsics used by
aarch64-neon-intrinsics.c (originally written for AArch64) and enables the
test.

My implementations are designed to be semantically correct, the actual code
quality looks like its a wash between the two backends, and is frequently
different (hence the large number of CHECK changes).

llvm-svn: 205210
2014-03-31 15:47:09 +00:00
Aaron Ballman 759c71d621 Post-commit review coding style change: renaming HasAttribute to hasAttribute. No functional changes.
llvm-svn: 205201
2014-03-31 15:26:40 +00:00
Alexander Musman c0d38211f7 [OPENMP] clang-formatted include/clang/AST/StmtOpenMP.h
llvm-svn: 205199
2014-03-31 15:08:32 +00:00
Nico Rieck 8ca0bfc57f Sema: Require external linkage for dll attributes
llvm-svn: 205198
2014-03-31 14:56:58 +00:00
Nico Rieck 82f0b06749 Sema: Check dll attributes on redeclarations
A redeclaration may not add dllimport or dllexport attributes. dllexport is
sticky and can be omitted on redeclarations while dllimport cannot.

llvm-svn: 205197
2014-03-31 14:56:15 +00:00
Daniel Jasper 240dfda352 clang-format: Solve issues found and fixed by clang-tidy.
llvm-svn: 205193
2014-03-31 14:23:49 +00:00
NAKAMURA Takumi 8e5f80d2cf clang/tools/driver/Makefile: Quick fix corresponding to r205181.
llvm-svn: 205189
2014-03-31 14:11:11 +00:00
Aaron Ballman 2fbf99429a Reapplying r204952 a second time.
Clean up the __has_attribute implementation without modifying its behavior. 

Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes).

Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options.

llvm-svn: 205181
2014-03-31 13:14:44 +00:00
Timur Iskhodzhanov 9ae7d3bd5f Slightly improve the readability of MicrosoftVTableContext::computeVTablePaths(). No functionality changes.
llvm-svn: 205178
2014-03-31 11:01:51 +00:00
Alexey Volkov ae43aae96a Added _rdtsc intrinsics by Robert Khasanov
Differential Revision: http://llvm-reviews.chandlerc.com/D3212

llvm-svn: 205172
2014-03-31 08:08:46 +00:00
Dmitri Gribenko f461da5306 Remove unused variable
llvm-svn: 205169
2014-03-31 07:52:35 +00:00
Tim Northover 6166ec21be ARM64: remove currently trivial switch statement
llvm-svn: 205167
2014-03-31 07:20:13 +00:00
Alexey Bataev d48bcd8a46 [OPENMP] Implemented 'copyin' clause
llvm-svn: 205164
2014-03-31 03:36:38 +00:00
Nico Weber 9ee5f9190b Add documentation for the pcs attribute, based on r129534's commit message.
llvm-svn: 205160
2014-03-30 19:45:58 +00:00
Tim Northover 65f582f432 RTTI: refactor the uniqueness question into CGCXXABI.
This also brings the code into closer conformance with usual LLVM
coding style and other surrounding conventions.

llvm-svn: 205158
2014-03-30 17:32:48 +00:00
David Majnemer 981c306e4a MS ABI: Correct typo in mangleStringLiteral
No functionality change.

llvm-svn: 205156
2014-03-30 16:38:02 +00:00
David Majnemer 8265decf46 MS ABI: Simplify mangleTemplateArgs
No functionality change.

llvm-svn: 205154
2014-03-30 16:30:54 +00:00
NAKAMURA Takumi c1e8aa06aa clang/test/Preprocessor/headermap-rel2.c: Recognize dos path.
llvm-svn: 205152
2014-03-30 15:09:08 +00:00
Chandler Carruth 705cd965e3 Force a header file input to the headermap test to have different
contents than the header file by the same name under the system header
search root. Surprisingly, this is required to get the test to pass on
some systems.

So, it turns out that there exist filesystems in the world which unique
the inode of all files based on their contents. This results in two
files with the same contents at different paths suddenly having the same
inode. This doesn't actually cause any problems in practice as the
contents are the same, and the path used to access the files are the
same. However, it can cause tests like this one to be more brittle
because the file manager ends up de-duplicating the file entries by
inode. We don't have any other really easy ways to observe the behavior
shift because the whole point is that the #include written in the source
code doesn't contain the information -- instead it is contained in the
header map.

If folks have other solutions they would prefer, I'm more than happy to
work on them, but this seems a reasonable way to ensure that the test in
question exercises the code it wants to exercise.

llvm-svn: 205149
2014-03-30 14:04:32 +00:00
Chandler Carruth 1ae5a684a7 [ARM64] Use %clang_cc1 consistently in the new arm64 codegen tests.
Really, all tests outside of the Driver tree should use %clang_cc1, but
these are new and easy to fix, and many of them use buitlin headers
which don't work as well without using %clang_cc1.

llvm-svn: 205147
2014-03-30 13:40:57 +00:00
Hal Finkel ecdb454aa7 [PowerPC] Make -pg generate calls to _mcount not mcount
At least on REL6 (Linux/glibc 2.12), the proper symbol for generating gprof
data is _mcount, not mcount. Prior to this change, compiling with -pg would
generate linking errors (because of unresolved references to mcount), after
this change -pg seems at least minimally functional.

llvm-svn: 205144
2014-03-30 13:00:06 +00:00
Chandler Carruth 379accd871 [Allocator] Remove forward declarations of BumpPtrAllocator. These
aren't necessary and will break when it changes to be a typedef of
a class template.

llvm-svn: 205142
2014-03-30 12:05:24 +00:00
David Majnemer ee4f4025c3 Sema: Implement DR317
Summary:
Declaring a function as inline after it has been defined is in violation
of [dcl.fct.spec]p4.  The program would get a strong definition instead
of getting a function with linkonce_odr linkage.

Reviewers: rsmith

CC: cfe-commits

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

llvm-svn: 205129
2014-03-30 06:44:54 +00:00
David Majnemer 0dc714a00f MS ABI: Simplify MangleByte
The delta between '\xe1' and '\xc1' is equivalent to the one between 'a'
and 'A'.  This allows us to reuse the computation between '\xe1' and
'\xfa' for the '\xc1' to '\xda' case.

No functionality change.

llvm-svn: 205128
2014-03-30 06:34:26 +00:00
Richard Smith 6190ee65e1 Tests for dr475-dr500.
llvm-svn: 205127
2014-03-30 06:05:29 +00:00
Tim Northover fe7a445bf7 Install: add arm_neon.h header back
I'd gone too far pruning aarch64_simd.h this time and took out one
instance of arm_neon.h. This should restore us to the status quo.

llvm-svn: 205111
2014-03-29 17:35:34 +00:00
Benjamin Kramer 543c74303b Avoid a local Twine variable.
Harmless in this case but potentially dangerous if it gets extended some day.

llvm-svn: 205107
2014-03-29 16:54:24 +00:00
Tim Northover 97606edd75 ARM64: Fix GCC warning in CGBuiltin.cpp
llvm-svn: 205104
2014-03-29 15:26:07 +00:00
Tim Northover dca92dbc82 Remove stray references to aarch64_simd.h
They were causing the autotools builds to fail.

llvm-svn: 205103
2014-03-29 15:21:06 +00:00
Tim Northover 618ca29317 CodeGen: Allow different RTTI emission strategies
Some ABIs and C++ libraries may make different trade-offs in how RTTI
is emitted (currently with respect to visibility and so on). This
implements one scheme, as used by ARM64.

llvm-svn: 205101
2014-03-29 15:09:55 +00:00
Tim Northover a2ee433c8d ARM64: initial clang support commit.
This adds Clang support for the ARM64 backend. There are definitely
still some rough edges, so please bring up any issues you see with
this patch.

As with the LLVM commit though, we think it'll be more useful for
merging with AArch64 from within the tree.

llvm-svn: 205100
2014-03-29 15:09:45 +00:00
David Majnemer af3698066a CodeGen: Don't crash when replacing functions
The peculiarities of C99 create scenario where an LLVM IR function
declaration may need to be replaced with a definition baring a different
type because the prototype and definition are not required to agree.

However, we were not properly deferring this when it occurred.

This fixes PR19280.

llvm-svn: 205099
2014-03-29 14:19:55 +00:00
Tim Northover 238b508aaf ARM64: parametrise IVar offset type (long on ARM64, int elsewhere).
This is part of the ARM64 patch, but can only be tested properly when
the full codegen gets committed.

llvm-svn: 205098
2014-03-29 13:42:40 +00:00
Tim Northover e77cc39aff ObjC: allow targets to decide when to use stret for blocks.
This was originally part of the ARM64 patch, but seems semantically
separate.

llvm-svn: 205097
2014-03-29 13:28:05 +00:00
Tim Northover 336f189b61 Driver: implement addClangWarningOptions
This function allows certain platforms to enable or disable diagnostics
by default.

llvm-svn: 205095
2014-03-29 13:16:12 +00:00
Ted Kremenek ab57a1555a [-Wunreachable-code] Expand paren-suppression heuristic to C++/ObjC bools.
llvm-svn: 205074
2014-03-29 04:49:20 +00:00
Argyrios Kyrtzidis 48fb488706 [test] Add a triple to the test.
llvm-svn: 205073
2014-03-29 04:05:21 +00:00
Argyrios Kyrtzidis ca1aa4626d [test] Add a RUN line to get a hint on why the test is failing at the buildbots.
llvm-svn: 205072
2014-03-29 03:37:04 +00:00
Argyrios Kyrtzidis 7bd78a910a [HeaderSearch] Make sure we clear the mapped name from the LookupFileCacheInfo when we reset the start point.
rdar://16462455

llvm-svn: 205071
2014-03-29 03:22:54 +00:00
Ted Kremenek ec3bbf4933 Improve -Wunreachable-code to provide a means to indicate code is intentionally marked dead via if((0)).
Taking a hint from -Wparentheses, use an extra '()' as a sigil that
a dead condition is intentionally dead.  For example:

  if ((0)) { dead }

When this sigil is found, do not emit a dead code warning.  When the
analysis sees:

  if (0)

it suggests inserting '()' as a Fix-It.

llvm-svn: 205069
2014-03-29 00:35:20 +00:00
Richard Smith fdf496cb48 PR19278: Align ASTTemplateArgumentListInfo to match its following dynamic array
of TemplateArgumentLocs. 'uint64_t' has higher alignment requirements than a
pointer on some platforms.

llvm-svn: 205068
2014-03-28 23:32:39 +00:00
Fariborz Jahanian 6e94302ee3 Objective-C. Make -Wselector-type-mismatch off by
default until we provide a work-around for warning
suppression.

llvm-svn: 205066
2014-03-28 23:23:12 +00:00
Argyrios Kyrtzidis 6af9bc565e [SemaObjC] For the semantics of the designated-initializer attribute, consider that the ObjC interface of the class
includes its class extensions.

This is follow-up for rdar://16305347

llvm-svn: 205065
2014-03-28 22:45:38 +00:00
Dmitri Gribenko 237769ede5 libclang/libIndex: USR generation: mangle source location into USRs for macros,
unless the macro comes from a system header

llvm-svn: 205064
2014-03-28 22:21:26 +00:00
Justin Bogner 57ba0b228d Reapply "OnDiskHashTable: Use Endian.h to read little endian ostreams"
Committed this by accident before it was done last time.

Original message:

    Rather than rolling our own functions to read little endian data
    from a buffer, we can use the support in llvm's Endian.h.

    No functional change.

llvm-svn: 205062
2014-03-28 22:03:24 +00:00
Justin Bogner e1c147c3cf Reapply "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"
Committed this by accident before it was done last time.

Original message:

    Rather than rolling our own functions to write little endian data
    to an ostream, we can use the support in llvm's EndianStream.h.

    No functional change.

llvm-svn: 205061
2014-03-28 22:03:19 +00:00
Hans Wennborg 9d9ce7a5af Simplify clang-cl's target triple setting
llvm-svn: 205051
2014-03-28 20:49:28 +00:00
Hans Wennborg 5e91ef6326 Try to fix the cl-options.c test on ARM bots
The test was failing because clang-cl changes the default triple
to target MSVC-style Win32. This is kind of wonky, but hasn't been
a problem until we started warning:

  warning: unknown platform, assuming -mfloat-abi=soft

Some of the tests in cl-options.c were running with -Werror, causing them
to fail.

Fixing this by FileCheck-ifying those tests instead of using -Werror.

llvm-svn: 205049
2014-03-28 20:45:05 +00:00
Justin Bogner a0dafb77eb Revert "OnDiskHashTable: Use Endian.h to read little endian ostreams"
This reverts commit r205045.

llvm-svn: 205048
2014-03-28 20:32:17 +00:00
Justin Bogner d42773bcc8 Revert "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"
This reverts commit r205044.

llvm-svn: 205047
2014-03-28 20:32:11 +00:00
Justin Bogner 498d82ee3e OnDiskHashTable: Use Endian.h to read little endian ostreams
Rather than rolling our own functions to read little endian data from
a buffer, we can use the support in llvm's Endian.h.

No functional change.

llvm-svn: 205045
2014-03-28 20:04:01 +00:00
Justin Bogner a06321efdd OnDiskHashTable: Use EndianStream.h to write little endian ostreams
Rather than rolling our own functions to write little endian data to
an ostream, we can use the support in llvm's EndianStream.h.

No functional change.

llvm-svn: 205044
2014-03-28 20:03:54 +00:00
Duncan P. N. Exon Smith 966e320664 Use constexpr again, this time portably
Responding to Justin's review of r205025.

llvm-svn: 205037
2014-03-28 19:27:37 +00:00
Dmitri Gribenko 3be06ffcd8 Documentation: remove a spurious '1' and wrap to 80 columns
llvm-svn: 205035
2014-03-28 19:25:09 +00:00
Douglas Gregor b5ecb908af Document module.private.modulemap and module_private.map.
Requested in <rdar://problem/16188740>.

llvm-svn: 205030
2014-03-28 19:05:18 +00:00
Duncan P. N. Exon Smith 3b3edfb16d InstrProf: Fix MSVC after r205023
llvm-svn: 205025
2014-03-28 18:22:26 +00:00
Fariborz Jahanian 87f88c1850 Objective-C. revert r204965. This will make
-Wselector-type-mismatch default again. After
internal discussions, we think that in most cases
it has helped our developers find hard to detect
undefined behaviors. We are going to provide a syntax
(and fix-it) to suppress the warning in remaining of
false positive cases.

llvm-svn: 205024
2014-03-28 18:22:16 +00:00
Duncan P. N. Exon Smith d971cd1b18 InstrProf: Emit runtime hook directly in IRGen
-u behaviour is apparently not portable between linkers (see cfe-commits
discussions for r204379 and r205012).  I've moved the logic to IRGen,
where it should have been in the first place.

I don't have a Linux system to test this on, so it's possible this logic
*still* doesn't pull in the instrumented profiling runtime on Linux.

I'm in the process of getting tests going on the compiler-rt side
(llvm-commits "[PATCH] InstrProf: Add initial compiler-rt test").  Once
we have tests for the full flow there, the runtime logic should get a
whole lot less brittle.

<rdar://problem/16458307>

llvm-svn: 205023
2014-03-28 17:53:22 +00:00
Duncan P. N. Exon Smith 2d8f93e869 Revert "Link in profile library on Linux using --whole-archive"
This reverts commit r205012.

llvm-svn: 205022
2014-03-28 17:53:17 +00:00
Richard Smith f0ae3c2de2 Fix a FIXME, use std::move.
llvm-svn: 205021
2014-03-28 17:31:23 +00:00
Alexey Samsonov 4a37d60aca Link in profile library on Linux using --whole-archive
llvm-svn: 205012
2014-03-28 15:39:08 +00:00
Daniel Jasper 03b1bc7a2a clang-format: Fix aligning of comments and escaped newlines in macros.
Before:
  #define A      \
    int i;   /*a*/ \
    int jjj; /*b*/

After:
  #define A        \
    int i;   /*a*/ \
    int jjj; /*b*/

llvm-svn: 205011
2014-03-28 15:06:01 +00:00
Christian Pirker f01cd6f57b Add ARM big endian Target (armeb, thumbeb)
Reviewed at http://llvm-reviews.chandlerc.com/D3096

llvm-svn: 205008
2014-03-28 14:40:46 +00:00
Dmitri Gribenko 103dc2ef2f Use the correct trailing comment syntax
llvm-svn: 204998
2014-03-28 10:09:39 +00:00
Manuel Klimek 9481556eb6 Get rid of the adapted isLiteral method.
We don't want to deviate from clang's standard terminology.

llvm-svn: 204997
2014-03-28 09:27:09 +00:00
Daniel Jasper 395193c7a0 clang-format: Recognize more ObjC blocks with parameters/return type.
llvm-svn: 204990
2014-03-28 07:48:59 +00:00
Hans Wennborg 73609a0fb3 clang-cl wants MSVC-style win32
This should fix the clang-cl tests after the Windows target triple
canonicalization (r204978)

llvm-svn: 204985
2014-03-28 01:19:04 +00:00
Saleem Abdulrasool 377066a5f5 Use the new Windows environment for target detection
This follows the LLVM change to canonicalise the Windows target triple
spellings.  Rather than treating each Windows environment as a single entity,
the environments are now modelled properly as an environment.  This is a
mechanical change to convert the triple use to reflect that change.

llvm-svn: 204978
2014-03-27 22:50:18 +00:00
Aaron Ballman 0efd167f81 Reverting r204968 and r204969; while more build bots are happy with the results, some still have link errors.
llvm-svn: 204974
2014-03-27 22:37:56 +00:00
Aaron Ballman 27909573b1 Urgh. Amending r204968 which somehow missed this file!
llvm-svn: 204969
2014-03-27 22:15:55 +00:00
Aaron Ballman c9ad1ca715 Reapplying r204952 with fixes which should hopefully resolve linking issues with non-MSVC compilers.
llvm-svn: 204968
2014-03-27 22:12:09 +00:00
Fariborz Jahanian 1c43329e29 Objective-C. Make multiple selector warning
an opt-in option under -Wselector-type-mismatch.
// rdar://16445728

llvm-svn: 204965
2014-03-27 21:59:01 +00:00
David Blaikie 7e2fd943ae Support for -Wa,-compress-debug-sections.
Also, while I'm here, support -nocompress-debug-sections too.

llvm-svn: 204959
2014-03-27 20:47:30 +00:00
Aaron Ballman 0702d02b31 Reverting r204952, while I figure out what's going on with the makefile build.
llvm-svn: 204955
2014-03-27 20:36:32 +00:00
Stephan Tolksdorf 5604a27788 Don't emit exit-time destructor warnings for trivial explicitly defaulted dtors
This commit also adds an additional test case for the global destructor warning.

Reviewed in http://llvm-reviews.chandlerc.com/D3205

llvm-svn: 204954
2014-03-27 20:23:36 +00:00
Stephan Tolksdorf d85fa23ad1 Recognize simple cases of trivial explicitly defaulted public dtors as irrelevant
Reviewed in http://llvm-reviews.chandlerc.com/D3190

llvm-svn: 204953
2014-03-27 20:23:12 +00:00
Aaron Ballman 9cac6f5f04 Clean up the __has_attribute implementation without modifying its behavior.
Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes).

Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options.

llvm-svn: 204952
2014-03-27 20:19:24 +00:00
Stephan Tolksdorf a6a0863470 Fix PR18307: Properly (de)serialize inherited constructors and their using declarations
Reviewed in http://llvm-reviews.chandlerc.com/D3102

llvm-svn: 204951
2014-03-27 19:22:19 +00:00
Manuel Klimek 1f9d80ac66 Improve handling of bool expressions in template arguments.
Now correctly formats:
  foo<true && false>();

llvm-svn: 204950
2014-03-27 19:00:52 +00:00
Eric Christopher 8018e414bb Add an explanatory comment and FIXME about the function declaration
for a subprogram DIE.

llvm-svn: 204949
2014-03-27 18:50:35 +00:00
Dmitri Gribenko 7233cc5f9b Comment parsing: use different comment styles in different test cases
llvm-svn: 204944
2014-03-27 16:42:56 +00:00
Dmitri Gribenko ef099dc670 Comment parsing: attach comments to enums declared using the NS_ENUM macro
Previously we would only attach comments to the typedef.

llvm-svn: 204942
2014-03-27 16:40:51 +00:00
David Tweed ababa8f954 Enforce the restriction that a parameter to a kernel function
cannot be a pointer to the private address space (as clarified
in the OpenCL 1.2 specification).

Patch by Fraser Cormack!

llvm-svn: 204941
2014-03-27 16:34:11 +00:00
Duncan P. N. Exon Smith a19ffae1b0 InstrProf: Pull in runtime on non-Darwin
r204379 changed the way the profile runtime gets pulled in, but missed
updating non-Darwin targets.

llvm-svn: 204939
2014-03-27 16:20:02 +00:00
Dmitri Gribenko abfa261a63 Add a module cache path to the test that uses -fmodules
llvm-svn: 204938
2014-03-27 16:15:30 +00:00
Daniel Jasper 5d2587daa2 clang-format: Avoid line-breaks that increase the current column.
While these might make sense for some rule (e.g. break after multi-line
operand), they generally appear ugly and confusing.

Before:
  fffffffffff(R\"x(
  multiline raw string literal xxxxxxxxxxxxxx
  )x\" + bbbbbb)

After:
  fffffffffff(R\"x(
  multiline raw string literal xxxxxxxxxxxxxx
  )x\" +
              bbbbbb)

llvm-svn: 204937
2014-03-27 16:14:13 +00:00
Dmitri Gribenko 9ee0e303d6 Comment parsing: when comment ranges are deserialized from multiple modules,
correctly order comments in SourceManager::isBeforeInTranslationUnit() order

Unfortunately, this is not as simple as it was implemented previously, and
actually requires doing a merge sort.

llvm-svn: 204936
2014-03-27 15:40:39 +00:00
Rafael Espindola a39fc6dd2a Handle and warn on aliases to weak aliases.
This produces valid IR now that llvm rejects aliases to weak aliases and warns
the user that the resolution is not changed if the weak alias is overridden.

llvm-svn: 204935
2014-03-27 15:27:20 +00:00
Alexander Musman fd2b75948d [OPENMP] OMPExecutableDirective re-factoring
Store the number of clauses and children of OMPExecutableDirective and dynamically compute the locations of corresponding arrays.

http://llvm-reviews.chandlerc.com/D2977

llvm-svn: 204933
2014-03-27 15:14:18 +00:00
Daniel Jasper 9f388d0404 clang-format: Extract getNewLineColumn out of addTokenOnNewLine.
No functional changes intended.

llvm-svn: 204930
2014-03-27 14:33:30 +00:00
Manuel Klimek f81e5c0e50 Fix bool expression special case.
Clang-format now correctly formats:
  some_type<a * b> v;
  template <bool a, bool b> typename enabled_if<a && b>::type f() {}

llvm-svn: 204913
2014-03-27 11:17:36 +00:00
Chandler Carruth e24605bbcd [cleanup] Stop specifying size overrides for BumpPtrAllocators.
These don't seem to have any real point. Let's start with
IndexingContext. I can't come up with any conceivable reason to have
many hundereds of thousands of these alive in an address space which
would make the 4x difference in allocated (but unused) memory for the
string scratch buffer a significant memory usage problem.

The EditedSource one is somewhat more surprising. This is an 8x increase
in the memory allocated (but not used) per editted source file. However,
for this to realistically be a problem, you would need to have over half
a million editted source files in a single address space, and even that
would only really have problems on 32-bit Windows where you really only
have 2gb of virtual address space. And what's more important, the fix to
this if it is actually an issue shouldn't be to shrink the allocator's
size, it is to pass a single allocator into *many* edited source file
objects and let them share the memory.

These were the only two uses of custom sized BumpPtrAllocators
(excluding ones in the JIT using a custom allocation strategy) in all of
LLVM, Clang, LLD, LLDB, or Polly. I don't think we actually need this
complexity in the primary BumpPtrAllocator at all and am planning to
remove it.

llvm-svn: 204910
2014-03-27 10:45:22 +00:00
Daniel Jasper c13ee34378 clang-format: Correctly identify ObjC Block with return type.
llvm-svn: 204905
2014-03-27 09:43:54 +00:00
Eric Christopher 4cbd0d9dc2 Revert "Just call getContextDescriptor to get the context for subprograms"
while I investigate as it seems to be causing issues with the gdb bot.

This reverts commit r204874.

llvm-svn: 204896
2014-03-27 05:29:34 +00:00
Richard Smith dc4ccaaf66 PR19252: Fix crash if alignas is used with an auto-typed variable. Don't check
the type of the variable until it's known.

llvm-svn: 204887
2014-03-27 01:22:48 +00:00
Rafael Espindola ef3e831965 Don't produce a L symbol in __DATA,__data.
The section __DATA,__data is atomized by the linker and cannot have L symbols.

llvm-svn: 204879
2014-03-27 00:02:45 +00:00
Reid Kleckner 185940a765 MS asm: Filter out fpsw clobbers
When parsing MS inline assembly, we note that fpsw is an implicit def of
most x87 FP operations, and add it to the clobber list.  However, we
don't recognize fpsw as a gcc register name, and we assert.  Clang
always adds an fpsr clobber, which means the same thing to LLVM, so we
can just use that.

This test case was broken by my LLVM change r196939.

Reviewers: echristo

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

llvm-svn: 204878
2014-03-27 00:00:03 +00:00
Eric Christopher 43daad555d Just call getContextDescriptor to get the context for subprograms
instead of rolling an inefficient version of the function. This
changes some order of emission of metadata nodes, fix up those
testcases and make them more flexible to some changes.

llvm-svn: 204874
2014-03-26 23:09:30 +00:00
Reid Kleckner 55e3cec6ca Try to fix arm bots by removing a superfluous __cdecl
llvm-svn: 204872
2014-03-26 22:52:23 +00:00
Richard Smith 0f38374f71 PR19254: If a thread_local data member of a class is accessed via member access
syntax, don't forget to run its initializer.

llvm-svn: 204869
2014-03-26 22:48:22 +00:00
Fariborz Jahanian a773d08618 Objective-C. Improve diagnostic error for '@import'
when modules are disabled. // rdar://15505492

llvm-svn: 204862
2014-03-26 22:02:43 +00:00
Fariborz Jahanian ec762bda73 Objective-C. Fixes a bogus warning on unimplemented
selectors because we were not going through entire
elements in list of all implemented selectors. 
// rdar://16428638

llvm-svn: 204852
2014-03-26 20:59:26 +00:00
Duncan P. N. Exon Smith 1b67cfd40f InstrProf: Use unique_ptr
llvm-svn: 204846
2014-03-26 19:26:05 +00:00
Duncan P. N. Exon Smith 3586be7216 InstrProf: Use references
llvm-svn: 204845
2014-03-26 19:26:02 +00:00
Jordan Rose 6fc2ec96b8 [analyzer] Remove the implemented Identical* checkers from the "potential" list.
Edit by Daniel Fahlgren.

llvm-svn: 204842
2014-03-26 18:59:22 +00:00
Logan Chien 74798a34e6 Fix atomic libcall.
This commit fixes a cast instruction assertion failure
due to the incompatible type cast.  This will only happen when
the target requires atomic libcalls.

llvm-svn: 204834
2014-03-26 17:35:01 +00:00
Jordan Rose 6b33c6f234 [analyzer] Handle the M_ZERO and __GFP_ZERO flags in kernel mallocs.
Add M_ZERO awareness to malloc() static analysis in Clang for FreeBSD,
NetBSD, and OpenBSD in a similar fashion to O_CREAT for open(2).
These systems have a three-argument malloc() in the kernel where the
third argument contains flags; the M_ZERO flag will zero-initialize the
allocated buffer.

This should reduce the number of false positives when running static
analysis on BSD kernels.

Additionally, add kmalloc() (Linux kernel malloc()) and treat __GFP_ZERO
like M_ZERO on Linux.

Future work involves a better method of checking for named flags without
hardcoding values.

Patch by Conrad Meyer, with minor modifications by me.

llvm-svn: 204832
2014-03-26 17:05:46 +00:00
Paul Robinson 5df175cec8 Recommit r204493 with a fix to look in both clang and llvm directories.
Hopefully addresses r204539.

Make clang/test/lit.cfg pre-scan the RUN line looking for tool names,
and substitute fully qualified path names pointing to the build
directory.  This ensures we're testing the just-built tools.

llvm-svn: 204831
2014-03-26 16:40:43 +00:00
Reid Kleckner 7dd8bc0a84 Intrin.h: Implement _InterlockedExchangePointer
llvm-svn: 204827
2014-03-26 16:09:48 +00:00
Reid Kleckner c511f43b67 -Wglobal-constructors: Don't warn on trivial defaulted dtors
Fixes PR19253.

llvm-svn: 204825
2014-03-26 15:58:20 +00:00
Reid Kleckner 597e81dea1 -fms-extensions: Add __va_start builtin, which is used for x64
The main difference between __va_start and __builtin_va_start is that
the address of the va_list has already been taken, and the va_list is
always a char*.

__va_end and __va_arg are not needed.

llvm-svn: 204821
2014-03-26 15:38:33 +00:00
Renato Golin c491a8d457 Add support for __builtin___clear_cache in Clang
Adding the mapping between __builtin___clear_cache into @llvm.clear_cache

llvm-svn: 204820
2014-03-26 15:36:05 +00:00