Commit Graph

53133 Commits

Author SHA1 Message Date
Justin Bogner e1552f6648 Frontend: Disentangle removePathTraversal from concatenating paths
This reimplements part of r211303 in a bit of a cleaner way. Doing so
allows us to use a proper absolute path when calling addFileMapping
rather than relying on a substring being one, which should fix the
tests on Windows.

llvm-svn: 211338
2014-06-20 03:28:46 +00:00
Ben Langmuir 9801b253ad Avoid invalidating successfully loaded module files
Successfully loaded module files may be referenced in other
ModuleManagers, so don't invalidate them. Two related things are fixed:

1) I thought the last module in the manager was always the one that
failed, but it isn't.  So check explicitly against the list of
vetted modules from ReadASTCore.

2) We now keep the file descriptor of pcm file open, which avoids the
possibility of having two different pcms for the same module loaded when
building in parallel with headers being modified during a build.

<rdar://problem/16835846>

llvm-svn: 211330
2014-06-20 00:24:56 +00:00
Alp Toker b2636c4ae1 diagtool: refactor TreeView to resemble C++
Replace lots of old-school parameter passing with neat class members.
No attempt made yet to modernize loops, but it's a start.

llvm-svn: 211327
2014-06-20 00:06:42 +00:00
Fariborz Jahanian d329674028 Objective-C qoi. When Objective-C pointer mismatches with
a qualified-id type because pointer is object of a forward
class declaration, include this info in a diagnostic note.
// rdar://10751015

llvm-svn: 211324
2014-06-19 23:05:46 +00:00
Alp Toker 1b3f344713 diagtool: simplify TreeView diagnostic classification
This utility doesn't need to know about the specifics of diagnostic levels.

llvm-svn: 211323
2014-06-19 23:00:52 +00:00
Justin Bogner 2960d47665 test: Just check the VFS when testing module-dependency-dump
Checking the filesystem seems to be a bit unreliable. Limit the tests
to the VFS map for now.

llvm-svn: 211310
2014-06-19 20:18:00 +00:00
Justin Bogner cbda32fbe8 Frontend: Fix a typo
llvm-svn: 211306
2014-06-19 19:49:28 +00:00
Justin Bogner 86d1259ca7 Frontend: Add a CC1 flag to dump module dependencies to a directory
This adds the -module-dependency-dir to clang -cc1, which specifies a
directory to copy all of a module's dependencies into in a form
suitable to be used as a VFS using -ivfsoverlay with the generated
vfs.yaml.

This is useful for crashdumps that involve modules, so that the module
dependencies will be intact when a crash report script is used to
reproduce a problem on another machine.

We currently encode the absolute path to the dump directory, due to
limitations in the VFS system. Until we can handle relative paths in
the VFS, users of the VFS map may need to run a simple search and
replace in the file.

llvm-svn: 211303
2014-06-19 19:36:03 +00:00
Yaron Keren fdbb4a54d5 Fixed formatting.
llvm-svn: 211295
2014-06-19 19:12:02 +00:00
Eli Bendersky f637790102 Fix PR20069: bad loop pragma arguments crash FE
This patch fixes a crash when handling malformed arguments to loop pragmas such
as: "#pragma clang loop vectorize(()".  Essentially any argument which is not an
identifier or constant resulted in a crash.  This patch also changes a couple of
the error messages which weren't quite correct.  New behavior with this patch vs
old behavior:

#pragma clang loop vectorize(1)
OLD: error: missing keyword; expected 'enable' or 'disable'
NEW: error: invalid argument; expected 'enable' or 'disable'

#pragma clang loop vectorize()
OLD: error: expected ')'
NEW: error: missing argument to loop pragma 'vectorize'

#pragma clang loop vectorize_width(bad)
OLD: error: missing value; expected a positive integer value
NEW: error: invalid argument; expected a positive integer value

#pragma clang loop vectorize(bad)
OLD: invalid keyword 'bad'; expected 'enable' or 'disable'
NEW: error: invalid argument; expected 'enable' or 'disable'

http://reviews.llvm.org/D4197

Patch by Mark Heffernan

llvm-svn: 211292
2014-06-19 18:30:15 +00:00
Eli Bendersky 778268df57 Document unroll and unroll_count directives.
Extend the documentation for "#pragma clang loop" hints to include the unroll
and unroll_count directives.

Patch by Mark Heffernan [http://reviews.llvm.org/D4198]

llvm-svn: 211286
2014-06-19 18:12:44 +00:00
Zachary Turner 10364ca123 Don't call llvm_start_multithreaded() during init. As of LLVM
revision r211277, this function is essentially a no-op.

llvm-svn: 211285
2014-06-19 18:03:56 +00:00
Oliver Stannard c8e3b5f849 Improve robustness of tests for module flags metadata
Fix clang tests to not break if the ID numbers of module flags metadata
nodes change.

llvm-svn: 211276
2014-06-19 16:10:21 +00:00
Argyrios Kyrtzidis 0f99537eca Fix assertion hit or bogus compiler error in cases when instantiating ObjC property accesses used with overloaded binary operators.
rdar://17153478

llvm-svn: 211270
2014-06-19 14:45:16 +00:00
Richard Smith 955bf016ee [c++1z] Implement N3994: a range-based for loop can declare a variable with super-terse notation
for (x : range) { ... }

which is equivalent to

  for (auto &&x : range) { ... }

llvm-svn: 211267
2014-06-19 11:42:00 +00:00
Alexey Bataev 7ff5524f7e [OPENMP] Improved diagnostic messages for vars with the predetermined data sharing attributes and reformatting
llvm-svn: 211262
2014-06-19 09:13:45 +00:00
Reid Kleckner c05ca5e40c DiagnoseUnknownTypename always emits a diagnostic and returns true
Make it return void and delete the dead code in the parser that handled
the case where it might return false.  This has been dead since 2010
when John deleted Action.h.

llvm-svn: 211248
2014-06-19 01:23:22 +00:00
Fariborz Jahanian c03ef578eb Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
in the context of pointer comparison as this is in effect 
a +0 context. // rdar://16627903

llvm-svn: 211243
2014-06-18 23:52:49 +00:00
David Majnemer 5b63fa02b2 Sema: Static redeclaration after extern declarations is a Microsoft Extension
CL permits static redeclarations to follow extern declarations.  The
storage specifier on the latter declaration has no effect.

This fixes PR20034.

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

llvm-svn: 211238
2014-06-18 23:26:25 +00:00
Fariborz Jahanian 1ad83a35b1 Objective-C. Revert my patch in r211234.
llvm-svn: 211237
2014-06-18 23:22:38 +00:00
Fariborz Jahanian 62aeb8b653 Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
by recognizing this as a +0 context. // rdar://16627903

llvm-svn: 211234
2014-06-18 22:50:40 +00:00
Saleem Abdulrasool 11415c6120 tests: relax ms-intrinsics test
Relax the tests to allow for differences between release and debug builds.  This
should fix the buildbots.

Thanks to Benjamin Kramer and Eric Christo for their invaluable tip that this
was release build specific issue.

llvm-svn: 211227
2014-06-18 21:48:44 +00:00
Reid Kleckner 7d0c066346 Relax the cl-inputs.c test a little bit in case link.exe is on PATH
llvm-svn: 211224
2014-06-18 21:34:36 +00:00
Warren Hunt 747e301ea0 [MS-ABI] Implement typeid
This patch enables clang to generate calls to __RTtypeid when lowering 
typeid on win32 targets.  Test cases are included.

llvm-svn: 211223
2014-06-18 21:15:55 +00:00
Saleem Abdulrasool 114efe0dc8 CodeGen: improve ms instrincics support
Add support for _InterlockedCompareExchangePointer, _InterlockExchangePointer,
_InterlockExchange.  These are available as a compiler intrinsic on ARM and x86.
These are used directly by the Windows SDK headers without use of the intrin
header.

llvm-svn: 211216
2014-06-18 20:51:10 +00:00
Fariborz Jahanian 5d64abba0a Objective-C. Check for integer overflow in Objective-C's
boxed expression. // rdar://16417427

llvm-svn: 211215
2014-06-18 20:49:02 +00:00
Jordan Rose 6914e2f339 [analyzer] Don't create new PostStmt nodes if we don't have to.
Doing this caused us to mistakenly think we'd seen a particular state before
when we actually hadn't, which resulted in false negatives. Credit to
Rafael Auler for discovering this issue!

llvm-svn: 211209
2014-06-18 19:23:30 +00:00
Fariborz Jahanian caaa5f55b6 Objective-C. Try to fix the test in buildbot in my last patch.
llvm-svn: 211197
2014-06-18 18:16:37 +00:00
Fariborz Jahanian 285b6b6585 Objective-C. Attributes on class declarations carry over
to forward class declarations for diagnosis. 
// rdar://16681279

llvm-svn: 211195
2014-06-18 17:58:27 +00:00
Hans Wennborg 23d26a3ef7 Make clang-cl accept .lib inputs (PR20065)
Patch by Ehsan Akhgari!

(Tiny tweak by me: renamed PathSegment to LibDir.)

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

llvm-svn: 211189
2014-06-18 17:21:50 +00:00
Saleem Abdulrasool df903939c9 Driver: correct the backend option spelling
The backend option does not have an '-enable' prefix.

llvm-svn: 211177
2014-06-18 16:52:24 +00:00
Hans Wennborg ef2272c49e Inherit dll attributes to static locals
This makes us handle static locals in exported/imported functions correctly.

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

llvm-svn: 211173
2014-06-18 15:55:13 +00:00
Tim Northover 831d728f9a AArch64: re-enable tests that were looking for a non-existent backend.
In the final phase of the merge, I managed to disable a bunch of Clang
tests accidentally. Fortunately none of them seem to have broken in
the interim.

llvm-svn: 211149
2014-06-18 08:37:28 +00:00
Alexey Bataev 23b6942634 [OPENMP] Reformatting and code improvement.
llvm-svn: 211147
2014-06-18 07:08:49 +00:00
Craig Topper d8d43191d8 Replace some assert(0)'s with llvm_unreachable.
llvm-svn: 211143
2014-06-18 05:13:13 +00:00
Craig Topper cf36016a0b Convert an llvm_unreachable in an 'else' block to a removal of the 'if' and an assertion of its condition. Suggestion from David Blaikie.
llvm-svn: 211142
2014-06-18 05:13:11 +00:00
Alexey Bataev f29276edb7 [OPENMP] Initial support for '#pragma omp for' (fixed incompatibility with MSVC).
llvm-svn: 211140
2014-06-18 04:14:57 +00:00
Craig Topper 0039f3f060 Replace some assert(0)'s with llvm_unreachable.
llvm-svn: 211139
2014-06-18 03:57:25 +00:00
Craig Topper c7193c48d9 Convert assert(0) to llvm_unreachable to silence a warning about Addend being uninitialized in default case.
llvm-svn: 211138
2014-06-18 03:13:41 +00:00
Hans Wennborg a0ca209303 Fix bug in code for avoiding dynamic initialization of dllimport globals
When instantiating dllimport variables with dynamic initializers, don't
bail out of Sema::InstantiateVariableInitializer without calling
PopExpressionEvaluationContext().

This was causing a stale object to stay on the ExprEvalContexts stack,
causing subsequent calls to getCurrentMangleNumberContext() to fail,
resulting in incorrect numbering of static locals (and probably other
broken things).

llvm-svn: 211137
2014-06-18 01:21:33 +00:00
Tyler Nowicki db2668a1da Documentation for #pragma clang loop directive and options vectorize and interleave.
Reviewed by: Aaron Ballman and Dmitri Gribenko

llvm-svn: 211135
2014-06-18 00:51:32 +00:00
Kaelyn Takata a95ebc6801 Fix the caller of checkCorrectionVisibility too.
That's what I get for hurredly splitting the small change out of a much
bigger change that had moved where checkCorrectionVisibility was being
called.

llvm-svn: 211134
2014-06-17 23:47:29 +00:00
Kaelyn Takata 61df4a787e Remove an unused argument from checkCorrectionVisibility.
llvm-svn: 211133
2014-06-17 23:41:33 +00:00
Fariborz Jahanian 9277ff426d Objective-C ARC. Do not warn about properties with both
IBOutlet and weak attributes when accessed being
unpredictably set to nil because usage of such properties
are always single threaded and its ivar cannot be set
to nil asynchronously. // rdar://15885642 

llvm-svn: 211132
2014-06-17 23:35:13 +00:00
Ben Langmuir dbdc036858 Retry building modules that were compiled by other instances and are out-of-date
When another clang instance builds a module, it may still be considered
"out of date" for the current instance in a couple of cases*.  This
patch prevents us from giving spurious errors when compilers race to
build a module by allowing the module load to fail when the pcm was
built by a different compiler instance.

* Cases where a module can be out of date despite just having been
built:

1) There are different -I paths between invocations that result in
finding a different module map file for some dependent module. This is
not an error, and should never be diagnosed.

<rdar://problem/16843887>

2) There are file system races where the headers making up a module are
touched or moved. Although this can sometimes mean trouble, diagnosing
it only during a build-race is worse than useless and we cannot detect
this in general.  It is more robust to just rebuild.  This was causing
spurious issues in some setups where only the modtime of headers was
bumped during a build.

<rdar://problem/16157638>

llvm-svn: 211129
2014-06-17 22:35:27 +00:00
Diego Novillo 18362bfd27 Remove dead code.
The parsing for -Rpass= had been factored into the function
GenerateOptimizationRemarkRegex, but at the time I forgot to remove
the original code that just handled OPT_Rpass_EQ.

llvm-svn: 211122
2014-06-17 20:01:51 +00:00
Zachary Turner f68823ba3f Change libclang initialization to use std::call_once instead of
hand rolled once-initialization, and rename the mutex to be more
descriptive of its actual purpose.

llvm-svn: 211121
2014-06-17 19:57:15 +00:00
Rafael Espindola a566efbec9 Revert "[OPENMP] Initial support for '#pragma omp for'."
This reverts commit r211096. Looks like it broke the msvc build:

SemaOpenMP.cpp(140) : error C4519: default template arguments are only allowed on a class template

llvm-svn: 211113
2014-06-17 17:20:53 +00:00
Yaron Keren c200b12563 Fix the comment which was backwards.
llvm-svn: 211112
2014-06-17 17:09:24 +00:00
James Molloy dee4ab08ba Rewrite ARM NEON intrinsic emission completely.
There comes a time in the life of any amateur code generator when dumb string
concatenation just won't cut it any more. For NeonEmitter.cpp, that time has
come.

There were a bunch of magic type codes which meant different things depending on
the context. There were a bunch of special cases that really had no reason to be
there but the whole thing was so creaky that removing them would cause something
weird to fall over. There was a 1000 line switch statement for code generation
involving string concatenation, which actually did lexical scoping to an extent
(!!) with a bunch of semi-repeated cases.

I tried to refactor this three times in three different ways without
success. The only way forward was to rewrite the entire thing. Luckily the
testing coverage on this stuff is absolutely massive, both with regression tests
and the "emperor" random test case generator.

The main change is that previously, in arm_neon.td a bunch of "Operation"s were
defined with special names. NeonEmitter.cpp knew about these Operations and
would emit code based on a huge switch. Actually this doesn't make much sense -
the type information was held as strings, so type checking was impossible. Also
TableGen's DAG type actually suits this sort of code generation very well
(surprising that...)

So now every operation is defined in terms of TableGen DAGs. There are a bunch
of operators to use, including "op" (a generic unary or binary operator), "call"
(to call other intrinsics) and "shuffle" (take a guess...). One of the main
advantages of this apart from making it more obvious what is going on, is that
we have proper type inference. This has two obvious advantages:

  1) TableGen can error on bad intrinsic definitions easier, instead of just
     generating wrong code.
  2) Calls to other intrinsics are typechecked too. So
     we no longer need to work out whether the thing we call needs to be the Q-lane
     version or the D-lane version - TableGen knows that itself!

Here's an example: before:

  case OpAbdl: {
    std::string abd = MangleName("vabd", typestr, ClassS) + "(__a, __b)";
    if (typestr[0] != 'U') {
      // vabd results are always unsigned and must be zero-extended.
      std::string utype = "U" + typestr.str();
      s += "(" + TypeString(proto[0], typestr) + ")";
      abd = "(" + TypeString('d', utype) + ")" + abd;
      s += Extend(utype, abd) + ";";
    } else {
      s += Extend(typestr, abd) + ";";
    }
    break;
  }

after:

  def OP_ABDL     : Op<(cast "R", (call "vmovl", (cast $p0, "U",
                                                       (call "vabd", $p0, $p1))))>;

As an example of what happens if you do something wrong now, here's what happens
if you make $p0 unsigned before the call to "vabd" - that is, $p0 -> (cast "U",
$p0):

arm_neon.td:574:1: error: No compatible intrinsic found - looking up intrinsic 'vabd(uint8x8_t, int8x8_t)'
Available overloads:
  - float64x2_t vabdq_v(float64x2_t, float64x2_t)
  - float64x1_t vabd_v(float64x1_t, float64x1_t)
  - float64_t vabdd_f64(float64_t, float64_t)
  - float32_t vabds_f32(float32_t, float32_t)
... snip ...

This makes it seriously easy to work out what you've done wrong in fairly nasty
intrinsics.

As part of this I've massively beefed up the documentation in arm_neon.td too.

Things still to do / on the radar:
  - Testcase generation. This was implemented in the previous version and not in
    the new one, because
    - Autogenerated tests are not being run. The testcase in test/ differs from
      the autogenerated version.
    - There were a whole slew of special cases in the testcase generation that just
      felt (and looked) like hacks.
    If someone really feels strongly about this, I can try and reimplement it too.
  - Big endian. That's coming soon and should be a very small diff on top of this one.

llvm-svn: 211101
2014-06-17 13:11:27 +00:00