Commit Graph

52012 Commits

Author SHA1 Message Date
Justin Bogner 3f0c79ce8d CodeGen: Remove a comment that isn't in the right place
This comment also appears elsewhere where it actually makes sense, and
it's just confusing here.

llvm-svn: 206321
2014-04-15 20:37:41 +00:00
Richard Smith 93da092f10 Move comment back to being next to the thing it's describing.
llvm-svn: 206320
2014-04-15 20:27:15 +00:00
Justin Bogner 399093276c AST: Respect alignment attributes on typedef'd arrays
When instantiating an array that has an alignment attribute on it, we
were looking through the array type and only considering the element
type for the resulting alignment. We need to make sure we take the
array's requirements into account too.

llvm-svn: 206317
2014-04-15 20:12:41 +00:00
Quentin Colombet 9d8105130a [ARM64] Update tests to reflect the change of the default CPU in llvm.
llvm-svn: 206314
2014-04-15 19:09:58 +00:00
Ben Langmuir 8832c066a2 Honour -ivfsoverlay in ASTUnit to match clang
This allows code indexing, etc. to use the VFS in the same way as the
compiler.

llvm-svn: 206309
2014-04-15 18:16:25 +00:00
Eli Bendersky e1627b43f9 Replace push_back()s by initializer list for shorter and cleaner code.
llvm-svn: 206304
2014-04-15 17:19:26 +00:00
Eli Bendersky 8578c8f1e3 Add test case for r206302
llvm-svn: 206303
2014-04-15 16:57:53 +00:00
Eli Bendersky e06a2c4f90 Add support for CUDA __launch_bounds__ attribute to CodeGen.
Sema does have a CUDALaunchBoundsAttr, but CodeGen was doing nothing with it.
This change translates CUDALaunchBoundsAttr to maxntidx and minctasm
metadata, which NVPTX then translates to the correct PTX directives.

Patch by Manjunath Kudlur.

llvm-svn: 206302
2014-04-15 16:57:05 +00:00
Duncan P. N. Exon Smith 52eaffee03 verify-di: Call debug info verifier from clang
This is paired with a patch to LLVM that creates a separate pass for
verifying debug info.

<rdar://problem/15500563>

llvm-svn: 206301
2014-04-15 16:27:43 +00:00
Alp Toker 48c7e17a24 Fix a comment to match the implementation
llvm-svn: 206298
2014-04-15 16:24:50 +00:00
Tim Northover c801b4a2aa ARM64: track alignment padding registers on AAPCS targets
This implements clause C.8 of the AAPCS in the front-end, so that Clang
accurately knows when the registers run out and it has to insert padding before
the stack objects begin.

PR19432.

llvm-svn: 206296
2014-04-15 14:55:11 +00:00
Alexander Kornienko 64a42b8dd2 Fix assertion when breaking string literals with tab characters.
Summary: Fixes http://llvm.org/PR19368

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, klimek

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

llvm-svn: 206295
2014-04-15 14:52:43 +00:00
NAKAMURA Takumi eec6fa541c Mark clang/test/Index/pch-with-errors.c as XFAIL:mingw for now. Investigating.
This has been failing since r206202.

llvm-svn: 206294
2014-04-15 14:44:55 +00:00
Fraser Cormack 01648e0463 Allow address space qualifiers on OpenCL array parameters
llvm-svn: 206275
2014-04-15 11:38:29 +00:00
Nikola Smiljanic 1b4b6bac3b PR19178 __is_constructible returns true for abstract types.
llvm-svn: 206273
2014-04-15 11:30:15 +00:00
Daniel Jasper 783bac6bba clang-format: Understand proto text format without commas.
Also removed spaces before colons as they don't seem to be used
frequently.

Before:
optional int32 b = 2
    [(foo_options) = {aaaaaaaaaaaaaaaaaaa : 123 bbbbbbbbbbbbbbbbbbbbbbbb :
                          "baz"}];

After:
optional int32 b = 2 [(foo_options) = {aaaaaaaaaaaaaaaaaaa: 123,
                                       bbbbbbbbbbbbbbbbbbbbbbbb:"baz"}];

llvm-svn: 206269
2014-04-15 09:54:30 +00:00
Daniel Jasper 9d3adc06c6 x
llvm-svn: 206268
2014-04-15 09:54:24 +00:00
Fraser Cormack 111023cdc6 Test commit: minor formatting
llvm-svn: 206264
2014-04-15 08:59:09 +00:00
Daniel Jasper 20fd3c6ff7 clang-format: Basic support for C++1y.
Before:
  int bi{1 '000' 000};
After:
  int bi{1'000'000};

This fixes llvm.org/PR19342.

llvm-svn: 206263
2014-04-15 08:49:21 +00:00
Daniel Jasper 98583d522f clang-format: Early cut-off for inlining nested blocks.
Specifically, for a nested block or lambda, don't try to put the single
statement body inline, if it exceeds the column limit.

This should not change any observable behavior (as those would never
have led to the 'best' solution), but significantly speeds up formatting
time.

This fixes llvm.org/PR18761. Formatting time goes down from ~100s to a
few ms.

llvm-svn: 206260
2014-04-15 08:28:06 +00:00
Daniel Jasper c359ad00a6 clang-format: Cache results of formatting nested blocks.
This somewhat improves the performance problem reported in
llvm.org/PR18761. No other behavior changes intended.

llvm-svn: 206258
2014-04-15 08:13:47 +00:00
David Majnemer 2e159fb6db AST: Elaborated type specifier mangling occurs before nested-name
The Ts/Tu/Te manglings should occur before the nested-name's N.

llvm-svn: 206247
2014-04-15 05:51:25 +00:00
Aaron Ballman 9e3d7bd20b Partial revert of r206229, to get the build bots green again.
llvm-svn: 206237
2014-04-15 01:19:35 +00:00
Richard Trieu e729d9b598 Fix typo from r206232
llvm-svn: 206234
2014-04-15 01:06:38 +00:00
Richard Trieu e9fa266cba Fix a bad interaction between -Wtautological-overlap-compare and delayed
diagnostics which caused delayed diagnostics on dead paths to be emitted.

llvm-svn: 206232
2014-04-15 00:57:50 +00:00
Justin Bogner 81ab90f7ed CodeGen: Handle CapturedStmt in instrumentation based profiling
CapturedStmt was being ignored by instrumentation based profiling, and
its counters attributed to the containing function. Instead, we need
to treat this as a top level entity, like we do with blocks.

llvm-svn: 206231
2014-04-15 00:50:54 +00:00
Aaron Ballman ef5d94caf0 Fixing a typo, updating the diagnostic wording and logic based on post-commit review feedback. Amends r206186.
llvm-svn: 206229
2014-04-15 00:36:39 +00:00
Quentin Colombet d9f262098f [Driver][ARM64] Make sure the default CPU is passed to the assembler.
<rdar://problem/16573920>

llvm-svn: 206227
2014-04-15 00:27:35 +00:00
Reid Kleckner f80abc060c Fix warning in ms-x86-vtordisp test case
llvm-svn: 206224
2014-04-14 23:49:17 +00:00
Richard Smith a1a808c541 Ensure we evaluate VLA bounds if a variably-modified type is used as the
argument to __builtin_va_arg. Patch by Rahul Jain, some test massaging and
IR emission order changes by me.

llvm-svn: 206223
2014-04-14 23:47:48 +00:00
Nick Lewycky 646621e6a8 Make sure these two files are distinct, or else the modules system may, on certain file systems, treat them as if they were the same file.
llvm-svn: 206221
2014-04-14 22:30:21 +00:00
Ben Langmuir 4f5212a60e Add module name and module map file to -module-file-info
llvm-svn: 206217
2014-04-14 22:12:44 +00:00
Richard Smith 82dce550c8 PR19415: Converting 'constexpr' to 'const' in a non-static data member can fail
if the member is already 'const'. Don't assert in that case.

llvm-svn: 206205
2014-04-14 21:00:40 +00:00
Richard Smith ac9c9a006f PR19411: Walk lexical parents, not semantic parents, when determining whether a
DeclContext is (lexically) within a C language linkage specification.

llvm-svn: 206204
2014-04-14 20:23:58 +00:00
Ben Langmuir 6e63f50b2a Fix find command in test/Modules/prune.m broken by r206201
llvm-svn: 206203
2014-04-14 18:50:28 +00:00
Ben Langmuir ebcc8c43bd Add clang:: qualifier back to Module
Apparently this was required by some compilers.

llvm-svn: 206202
2014-04-14 18:21:04 +00:00
Ben Langmuir beee15e721 Allow multiple modules with the same name to coexist in the module cache
To differentiate between two modules with the same name, we will
consider the path the module map file that they are defined by* part of
the ‘key’ for looking up the precompiled module (pcm file).
Specifically, this patch renames the precompiled module (pcm) files from
  cache-path/<module hash>/Foo.pcm
to
  cache-path/<module hash>/Foo-<hash of module map path>.pcm

In addition, I’ve taught the ASTReader to re-resolve the names of
imported modules during module loading so that if the header search
context changes between when a module was originally built and when it
is loaded we can rebuild it if necessary.  For example, if module A
imports module B

first time:
clang -I /path/to/A -I /path/to/B ...

second time:
clang -I /path/to/A -I /different/path/to/B ...

will now rebuild A as expected.

* in the case of inferred modules, we use the module map file that
allowed the inference, not the __inferred_module.map file, since the
inferred file path is the same for every inferred module.

llvm-svn: 206201
2014-04-14 18:00:01 +00:00
Aaron Ballman 95d570335c Properly diagnose Microsoft __declspec attributes which have optional argument lists when the arguments are elided. eg)
__declspec(deprecated()) // error
__declspec(deprecated) // OK
__declspec(deprecated("")) // OK

llvm-svn: 206191
2014-04-14 16:44:26 +00:00
Justin Bogner da4e650e5c OnDiskHashTable: Make the iterable version separate.
Currently the on disk hash table's key_iterator and data_iterator make
the assumption that the table data starts exactly four bytes after the
base of the table. This happens to be true for all of the tables we
currently iterate over, but not for all of the OnDiskHashTables we
currently use. For example, key_ and data_iterator would iterate over
meaningless data if they were used on the hash tables in PTHLexer.

We make the API safer by breaking this into two types. One doesn't
have the iterators, and the other must be told where the payload
starts.

llvm-svn: 206189
2014-04-14 16:34:29 +00:00
Justin Bogner 8c1f0818c0 OnDiskHashTable: clang-format and consistent naming
No functional change. Style cleanups in OnDiskChainedHashTable in
preparation for some other changes here.

llvm-svn: 206188
2014-04-14 16:34:19 +00:00
Aaron Ballman 35f9421c55 Properly diagnose standard C++ attributes which have optional argument lists when the arguments are elided. eg)
[[deprecated()]] // error
[[deprecated]] // OK
[[deprecated("")]] // OK
[[gnu::deprecated()]] // OK

llvm-svn: 206186
2014-04-14 16:03:22 +00:00
Samuel Benzaquen f434c4fa3f Add support for named values in the parser.
Summary: Add support for named values in the parser.

Reviewers: pcc

CC: cfe-commits, klimek

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

llvm-svn: 206176
2014-04-14 13:51:21 +00:00
Daniel Jasper 866468ae4d clang-format: Fix regression caused by r206165.
llvm-svn: 206173
2014-04-14 13:15:29 +00:00
Daniel Jasper 72ab43b28b clang-format: Fix incorrect &&-detection in macros.
Before:
  #define A(a, b) (a &&b)

After:
  #define A(a, b) (a && b)

This fixes llvm.org/PR19343.

llvm-svn: 206165
2014-04-14 12:50:02 +00:00
Daniel Jasper db8804b32b clang-format: Improve array literal formatting fix in r206161.
Instead of choosing based on the number of elements, simply respect the
user's choice of where to wrap array literals.

llvm-svn: 206162
2014-04-14 12:11:07 +00:00
Daniel Jasper af4fee2636 clang-format: With ColumnLimit=0, keep short array literals on a line.
Before:
    NSArray* a = [[NSArray alloc] initWithArray:@[
                                                   @"a"
                                                ]
                                      copyItems:YES];

After:
    NSArray* a = [[NSArray alloc] initWithArray:@[ @"a" ]
                                      copyItems:YES];

This fixed llvm.org/PR19080.

llvm-svn: 206161
2014-04-14 12:05:05 +00:00
Daniel Jasper c0d606a584 clang-format: Don't allow hanging indentation for operators on new lines
Before:
  if (aaaaaaaa && bbbbbbbbbbbbbbb // need to wrap
                  == cccccccccccccc) ...

After:
  if (aaaaaaaa
      && bbbbbbbbbbbbbbb // need to wrap
         == cccccccccccccc) ...

The same rule has already be implemented for BreakBeforeBinaryOperators
set to false in r205527.

llvm-svn: 206159
2014-04-14 11:08:45 +00:00
Manuel Klimek 68b03049e0 Format code around VCS conflict markers.
Now correctly formats:
  {
    int a;
    void f() {
      callme(some(parameter1,
  <<<<<<< text by the vcs
                  parameter2),
  ||||||| text by the vcs
                  parameter2),
             parameter3,
  ======= text by the vcs
                  parameter2, parameter3),
  >>>>>>> text by the vcs
             otherparameter);
    }
  }

llvm-svn: 206157
2014-04-14 09:14:11 +00:00
Daniel Jasper 35ec2b244a clang-format: Improve formatting of annotated variables.
Before:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(
      aaaaaaaaaaaa) = aaaaaaaa::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(aaaaaaaaaaaa) =
      aaaaaaaa::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 206155
2014-04-14 08:15:20 +00:00
Serge Pavlov 6a7ffbed8a Improve error recovery around colon.
Parse of nested name spacifier is modified so that it properly recovers
if colon is mistyped as double colon in case statement.
This patch fixes PR15133.

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

llvm-svn: 206135
2014-04-13 16:52:03 +00:00
Logan Chien af24ad940d Fix diagnostics for C-style cast to function type.
If the C-style type cast is applied to the overloaded
function and the destination type is function type,
then Clang will crash with assertion failure.  For example,

    void foo(int);
    void foo(int, int);
    void bar() {
        typedef void (ft)(int);
        ft p = (ft)foo;
    }

In this case, the overloaded function foo will be cast to
a function type, which should be considered as an error.
But, unfortunately, since the function resolution is using
canonical type, the matched function will be returned, and
result in SEGV.

This patch fixes this issue by removing the assertion and
add some error diagnostics as the one in static_cast.

llvm-svn: 206133
2014-04-13 16:08:24 +00:00
David Majnemer adc45bb77b MS ABI: Bitfields FielDecls only align if they allocate
Don't consider a __declspec(align) on a bitfield's declaration if it didn't
allocate any underlying storage.

This fixes PR19414.

llvm-svn: 206132
2014-04-13 08:15:50 +00:00
Richard Smith 9e2f0a4f62 PR19339: Disambiguate lambdas with init-captures from designated initializers
properly.

llvm-svn: 206128
2014-04-13 04:31:48 +00:00
David Majnemer 81c55b6255 [-fms-extensions] Add tests for __FUNCDNAME__
__FUNCDNAME__ was introduced way back in r194181 but I forgot to add
these tests.

llvm-svn: 206125
2014-04-13 02:29:55 +00:00
David Majnemer d43388cc04 MS ABI: #pragma vtordisp(0) only disables new vtordisps
Previously, it was believed that #pragma vtordisp(0) would prohibit the
generation of any and all vtordisps.

In actuality, it only disables the generation of additional vtordisps.

This fixes PR19413.

llvm-svn: 206124
2014-04-13 02:27:32 +00:00
Richard Smith c7f9bb1757 Tests for DR501-525.
llvm-svn: 206123
2014-04-13 00:40:32 +00:00
Benjamin Kramer 5c323b833b Replace llvm::array_endof with C++11's std::end.
No functionality change.

llvm-svn: 206111
2014-04-12 15:42:48 +00:00
Hal Finkel 834da75d44 Fix test/Modules/cxx-irgen.cpp for PPC64
Target ABI code might add signext to the return types.

llvm-svn: 206107
2014-04-12 11:50:34 +00:00
Yunzhong Gao a8c45c9f88 Add description about the __is_identifier() macro
llvm-svn: 206099
2014-04-12 02:25:32 +00:00
Justin Bogner b1966291de CodeGen: Test instrumentation based profiling of templates
Make sure that templates are handled correctly by profile
instrumentation.

llvm-svn: 206091
2014-04-12 00:54:06 +00:00
Warren Hunt 4f7efb7a8f [MS-ABI] Fix warning introduced in r206087
No functional change.

llvm-svn: 206090
2014-04-12 00:20:50 +00:00
Adrian Prantl 0ce2b87507 Follow-up to r205999: Emit an artificial location (valid scope, line 0)
for CXXGlobalInit/Dtor helper functions.
This makes _GLOBAL__I_a regain its DW_AT_high/low_pc in the debug info.

Thanks to echristo for catching this!

llvm-svn: 206088
2014-04-11 23:45:01 +00:00
Warren Hunt 0e70d916f2 [MS-ABI] Fixed alias-avoidance padding in the presence of vtordisps
If a vtordisp exists between two bases, then there is no need for 
additional alias avoidance padding.  Test case included.

llvm-svn: 206087
2014-04-11 23:33:35 +00:00
Justin Bogner 191ec63b71 CodeGen: Fix handling of C++11 lambdas in profiling
Until now we were generating duplicate counters for lambdas: one set
in the function where the lambda was declared and another for the
lambda itself. Instead, we should skip over the bodies of lambdas in
their containing contexts.

llvm-svn: 206081
2014-04-11 23:06:35 +00:00
Warren Hunt 73f4398782 [MS-ABI] Update to vtordisp computation
A portion of the vtordisp computation that was previously unguarded by a 
test for the declaration of user defined constructors/destructors was 
erroniously adding vtordisps to things that shouldn't have them.  This 
patch correctly guards that codepath.  In addition, it updates the 
comments to make them more clear.  Test case is included.

llvm-svn: 206077
2014-04-11 22:05:28 +00:00
Yunzhong Gao ef309f4326 Add a test to distinguish between reserved tokens and normal identifiers.
The -fms-extensions option affects a number of subtle front-end C/C++
behaviors, and it would be useful to be able to distinguish MS keywords
from regular identifiers in the ms-extensions mode even if the triple
does not define a Windows target. It should make life easier if anyone
needs to port their Windows codes to elsewhere.

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

llvm-svn: 206069
2014-04-11 20:55:19 +00:00
Bob Wilson d893142595 [PGO] Change MapRegionCounters to be a RecursiveASTVisitor.
This avoids the overhead of specifying all the traversal code when using
ConstStmtVisitor and makes it a lot easier to maintain this.

llvm-svn: 206039
2014-04-11 17:16:13 +00:00
Reid Kleckner cd612aba55 Simplify RecordLayoutBuilder with getAsCXXRecordDecl()
No functionality change.

llvm-svn: 206038
2014-04-11 16:57:42 +00:00
Manuel Klimek 1fcbe675fa Correctly handle escaped newlines when the next token starts without a space.
We will need this to correctly handle conflict markers inside macro
definitions.

llvm-svn: 206029
2014-04-11 12:27:47 +00:00
Daniel Jasper 962b38e4f3 Add -fmodules-strict-decluse to check that all headers are in modules
Review: http://reviews.llvm.org/D3335
llvm-svn: 206027
2014-04-11 11:47:45 +00:00
Justin Bogner 53c55d993f CodeGen: Handle binary conditional operators in PGO instrumentation
This treats binary conditional operators in the same way as ternary
conditional operators for instrumentation based profiling.

llvm-svn: 206021
2014-04-11 06:10:10 +00:00
Adrian Prantl 22e66b434a Cleanup: Add default arguments to CodeGenFunction::StartFunction.
Thanks dblaikie for the suggestion!

llvm-svn: 206012
2014-04-11 01:13:04 +00:00
Richard Smith 83e78f5c3c Fix handling of redeclaration lookup for using declarations, where the prior
declaration is not visible. Previously we didn't find hidden friend names in
this redeclaration lookup, because we forgot to treat it as a redeclaration
lookup. Conversely, we did find some local extern names, but those don't
actually conflict with a namespace-scope using declaration, because the only
conflicts we can get are scope conflicts, not conflicts due to the entities
being members of the same namespace.

llvm-svn: 206011
2014-04-11 01:03:38 +00:00
Warren Hunt 917f97f1a3 [MS-ABI] Update Comments in RecordLayoutBuilder - no functional change
This patch updates the comments in RecordLayoutBuilder about record 
layout in the MS-ABI.  Also, I added a section about known 
incompatibilities.

llvm-svn: 206010
2014-04-11 00:54:15 +00:00
Duncan P. N. Exon Smith 3fefedb24c Switch from constexpr to const char *const
Responding to Richard Smith's review of r205037.

llvm-svn: 206008
2014-04-11 00:43:16 +00:00
Warren Hunt 29a2b955fb [MS-ABI] Update virtual base padding rules to match MSVC 10+
In version 9 (VS2010) (and prior)? versions of msvc, if the last field 
in a record was a bitfield padding equal to the size of the storage 
class of that bitfield was added before each vbase and vtordisp.  This 
patch removes that feature from clang and updates the lit tests to 
reflect it. 

llvm-svn: 206004
2014-04-11 00:14:09 +00:00
Duncan P. N. Exon Smith 4a2f5ae8d5 InstrProf: Rename Decl parameters from S to D
No functionality change.

<rdar://problem/16435801>

llvm-svn: 206002
2014-04-10 23:37:36 +00:00
Duncan P. N. Exon Smith e9624291b1 InstrProf: Read unsigned numbers with strtoul and strtoull
Fixes a bug where unsigned numbers are read using strtol and strtoll.

I don't have a testcase because this bug is effectively unobservable
right now.  To expose the problem in the hash, we would need a function
with greater than INT64_MAX counters, which we don't handle anyway.  To
expose the problem in the function count, we'd need a function with
greater than INT32_MAX counters; this is theoretically observable, but
it isn't a practical testcase to check in.

An upcoming commit changes the hash to be non-trivial, so we'll get some
coverage eventually.

<rdar://problem/16435801>

llvm-svn: 206001
2014-04-10 23:37:34 +00:00
Warren Hunt bb9c3c33e9 [MS-ABI] Fix to vbptr injection site calculation.
The vbptr is injected after the last non-virtual base lexographically 
rather than the last non-virtual base in layout order.  Test case 
included.  Also, some line ending fixes.

llvm-svn: 206000
2014-04-10 23:23:34 +00:00
Adrian Prantl 42d71b9906 Debug info: (Bugfix) Make sure artificial functions like _GLOBAL__I_a
are not associated with any source lines.

Previously, if the Location of a Decl was empty, EmitFunctionStart would
just keep using CurLoc, which would sometimes be correct (e.g., thunks)
but in other cases would just point to a hilariously random location.

This patch fixes this by completely eliminating all uses of CurLoc from
EmitFunctionStart and rather have clients explicitly pass in a
SourceLocation for the function header and the function body.

rdar://problem/14985269

llvm-svn: 205999
2014-04-10 23:21:53 +00:00
Reid Kleckner fb873af67e Update Clang for LLVM split stack API changes in r205997
Patch by Alex Crichton!

llvm-svn: 205998
2014-04-10 22:59:13 +00:00
Warren Hunt 5d9eebfec6 [MS-ABI] Fixed __declspec(align()) on bitfields under #pragma pack.
When __declspec(align()) is applied to a bitfield it affects the 
alignment rather than the required alignment of the struct.  The major 
feature that this patch adds is that the alignment of the structure 
obeys the alignment of __declspec(align()) from the bitfield over the 
value specified in pragma pack.

Test cases are included.
The patch also includes some small cleanups in recordlayoutbuilder and 
some cleanups to some lit tests, including line endings (but no 
functionality change to lit tests)

llvm-svn: 205994
2014-04-10 22:15:18 +00:00
Reid Kleckner d378a71b4e inalloca: Pad the struct *after* inserting each arg
This ensures that the overall struct size will be a multiple of 4, as
required by the ABI.

llvm-svn: 205981
2014-04-10 19:09:43 +00:00
Justin Bogner f2ea775ed9 CodeGen: Move PGO initialization into Release()
Emitting the PGO initialization in EmitGlobalFunctionDefinition is
inefficient, since this only has an effect once per module.  We move
this to Release() with the rest of the once-per-module logic.

llvm-svn: 205977
2014-04-10 18:13:13 +00:00
Aaron Ballman 582e4f74da Some minor improvements to the thread safety intermediate language -- mostly const correctness and reformatting. Fixes the types involved with castOpcode().
llvm-svn: 205976
2014-04-10 18:12:58 +00:00
Ben Langmuir 2c9af44c26 When module umbrellas change, rebuild them
With the VFS, it is easy to hit modified umbrellas by overriding the
umbrella header, and what we want is to rebuild, not to fail.

llvm-svn: 205975
2014-04-10 17:57:43 +00:00
David Majnemer 9832a3d1e0 CodeGen: Clean up CommonLinkage calculation
No functionality change.

llvm-svn: 205972
2014-04-10 16:53:16 +00:00
Christian Pirker ba289f0c64 ARM: Add command line option to select big or little endian
llvm-svn: 205967
2014-04-10 13:59:32 +00:00
Christian Pirker 02c2e25d74 AArch64: Add command line option to select big or little endian
llvm-svn: 205966
2014-04-10 13:55:51 +00:00
Richard Sandiford d03f7b7bd3 [SystemZ] Don't indent SystemZTargetInfo relative to its namespace
Whitespace only.  No functional change intended.

llvm-svn: 205960
2014-04-10 09:56:24 +00:00
Daniel Jasper 220c0d1f5e clang-format: Fix false positive in braced list detection in protos.
llvm-svn: 205954
2014-04-10 07:27:12 +00:00
Eric Christopher cab9fae403 Add global static variables for anonymous union fields. This makes
sure that a debugger can find them when stepping through code,
for example from the included testcase:

   12     int test_it() {
   13       c = 1;
   14       d = 2;
-> 15       a = 4;
   16       return (c == 1);
   17     }
   18
(lldb) p a
(int) $0 = 2
(lldb) p c
(int) $1 = 2
(lldb) p d
(int) $2 = 2

and a, c, d are all part of the file static anonymous union:

static union {
  int c;
  int d;
  union {
    int a;
  };
  struct {
    int b;
  };
};

Fixes PR19221.

llvm-svn: 205952
2014-04-10 05:20:00 +00:00
Reid Kleckner 9df1d975b8 Avoid crashing when failing to emit a thunk
If we crash, we raise a crash handler dialog, and that's really
annoying.  Even though we can't emit correct IR until we have musttail,
don't crash.

llvm-svn: 205948
2014-04-10 01:40:15 +00:00
Reid Kleckner eb2ecff166 Fix the build with LLVM_DELETED_FUNCTION instead of '= delete'
MSVC 2012 doesn't understand '= delete', but 2013 does.

llvm-svn: 205946
2014-04-10 01:05:01 +00:00
David Majnemer 61182a89e8 Remove Unicode introduced in r205943
llvm-svn: 205945
2014-04-10 00:59:44 +00:00
David Majnemer 64e40c56fb AST: Implement proposal for dependent elaborated type specifiers
cxx-abi-dev came up with a way to disambiguate between different
keywords used in elaborated type specifiers.

This resolves certain collisions during mangling.

llvm-svn: 205943
2014-04-10 00:49:24 +00:00
Ben Langmuir 4469138e98 Move search for header in umbrella directories into its own function
No functional change intended.

llvm-svn: 205942
2014-04-10 00:39:10 +00:00
DeLesley Hutchins 7e615c2f65 Thread Safety Analysis: reorganized SExpr header files. No change in
functionality.

llvm-svn: 205936
2014-04-09 22:39:43 +00:00
Reid Kleckner b49fee0b41 Thread safety: move the inline function back into a namespace
Moving it into a struct makes things work because it implicitly marks
the function as inline.  The struct is unnecessary if you explicitly
mark the function inline.

llvm-svn: 205935
2014-04-09 22:17:06 +00:00
Warren Hunt 39a907b1c2 [MS-ABI] Update to alias-avoidance padding
This patch changes how we determine if padding is needed between two 
bases in msvc compatibility mode.  Test cases included.

In addition, a very minor change to the printing of structures to ease 
lit testing.

llvm-svn: 205933
2014-04-09 21:57:24 +00:00
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