Commit Graph

161170 Commits

Author SHA1 Message Date
David Majnemer d3d140da36 IR: Properly canonicalize PointerType in ConstantExpr GEPs
No additional test was needed, Other/constant-fold-gep.ll detects this
just fine.

llvm-svn: 194221
2013-11-07 22:29:42 +00:00
David Majnemer bd4fef4a89 IR: Do not canonicalize constant GEPs into an out-of-bounds array access
Summary:
Consider a GEP of:
i8* getelementptr ({ [2 x i8], i32, i8, [3 x i8] }* @main.c, i32 0, i32 0, i64 0)

If we proceeded to GEP the aforementioned object by 8, would form a GEP of:
i8* getelementptr ({ [2 x i8], i32, i8, [3 x i8] }* @main.c, i32 0, i32 0, i64 8)

Note that we would go through the first array member, causing an
out-of-bounds accesses.  This is problematic because we might get fooled
if we are trying to evaluate loads using this GEP, for example, based
off of an object with a constant initializer where the array is zero.

This fixes PR17732.

Reviewers: nicholas, chandlerc, void

Reviewed By: void

CC: llvm-commits, echristo, void, aemerson

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

llvm-svn: 194220
2013-11-07 22:15:53 +00:00
Bill Wendling b805c68f4d Run clang-format on file.
llvm-svn: 194219
2013-11-07 20:18:21 +00:00
Bill Wendling 8890460431 Move copying of global initializers below the cloning of functions.
The BlockAddress doesn't have access to the correct basic blocks until the
functions have been cloned. This causes the BlockAddress to point to the old
values. Just wait until the functions have been cloned before copying the
initializers.
PR13163

llvm-svn: 194218
2013-11-07 20:14:51 +00:00
Richard Smith 2aa81a718e PR17800: When performing pack expansion, we must always rebuild the AST nodes
to avoid breaking AST invariants by reusing Stmt nodes within the same
function.

llvm-svn: 194217
2013-11-07 20:07:17 +00:00
Daniel Jasper a98da3d236 clang-format: Improve binary operator detection in macros.
Before:
  #define M(NAME) assert(!Context.Verifying &&#NAME);

After:
  #define M(NAME) assert(!Context.Verifying && #NAME);

This fixes llvm.org/PR16156.

llvm-svn: 194216
2013-11-07 19:56:07 +00:00
Richard Smith 786d8a26f2 Tests for CWG issue 165-170.
llvm-svn: 194215
2013-11-07 19:26:14 +00:00
Daniel Jasper f48b5abc49 clang-format: Improve ObjC variadic and binary expression parameters.
Before:
  [self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
                           aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
                           aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa];
  [self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa];

After:
  [self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
                        aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
                        aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa];
  [self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
                        aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
                        aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa];

This addresses llvm.org/PR15349 and llvm.org/PR16185.

llvm-svn: 194214
2013-11-07 19:23:49 +00:00
Richard Smith 9ff62af3aa PR17615: A delegating constructor initializer is a full-expression. Don't
forget to clean up temporaries at the end of it.

llvm-svn: 194213
2013-11-07 18:45:03 +00:00
Chris Wailes faed9c671e Added a test case for the fix to bug 17632 in r193751
llvm-svn: 194212
2013-11-07 18:35:18 +00:00
Richard Barton 72c5d91171 XFAIL the test for non-x86 targets for which this message cannot be generated.
llvm-svn: 194211
2013-11-07 18:05:57 +00:00
Daniel Jasper 4fcc8b91eb clang-format: Improve formatting of constructor initializers.
Before:
  Constructor()
      : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa(aaaa,
                                                                      aaaa)) {}
After:
  Constructor()
      : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
            aaaaaaaaaaaaaaaaaaaaaaaaa(aaaa, aaaa)) {}

llvm-svn: 194210
2013-11-07 17:52:51 +00:00
Daniel Jasper bc5cb4e369 clang-format: Remove old hack that mainly made incorrect tests pass.
As a side-effect, constructors definitions will correctly be recognized
and formatted as function declarations. Tests will be added in a
follow-up patch actually using the correct recognition.

llvm-svn: 194209
2013-11-07 17:43:07 +00:00
Howard Hinnant 66da53e0da If libc++ has not declared bad_array_length, then declare it here just so that it gets into the binary.
llvm-svn: 194208
2013-11-07 17:16:37 +00:00
Howard Hinnant 88960d151e Tell libc++abi whether or not libc++ has declared bad_array_length.
llvm-svn: 194207
2013-11-07 17:15:51 +00:00
Faisal Vali 9366a48583 Remove an unnecessary condition that I added hastily: Unsigned numbers are obviously >= 0 ;)
Also - others have complained about some white space issues - sorry about that - continues to be a pain point for me - will try and see what I can do with clang-format this evening after work - as a short term fix, if anyone can email me the files that they have already identified with issues, it would help me speed up a focused fix. sorry.

llvm-svn: 194206
2013-11-07 16:57:56 +00:00
Zoran Jovanovic c18b6d1083 Support for microMIPS trap instructions 1.
llvm-svn: 194205
2013-11-07 14:35:24 +00:00
Daniel Jasper 6b6e7c37ea clang-format: Fix corner case for brace alignment.
Before:
  Constructor::Constructor()
      : some_value{ //
            aaaaaaa //
  } {}

After:
  Constructor::Constructor()
      : some_value{ //
            aaaaaaa //
        } {}

llvm-svn: 194204
2013-11-07 14:02:28 +00:00
NAKAMURA Takumi 29c3b55897 llvm-c/Support.h: Add a newline at eof.
llvm-svn: 194203
2013-11-07 13:54:24 +00:00
Timur Iskhodzhanov 9e7f505515 Minor refinement of VTableBuilder.h: fix wrong indentation, rename a struct field with a more appropriate name
llvm-svn: 194202
2013-11-07 13:34:02 +00:00
Reed Kotler e7af1ec97e Disable some code that is causing some warnings. It's in the process
of being converted and this path is not relevant to anything at this time
so I have just disabled it for a few days while I'm at the LLVM conference
and don't have time to complete it or properly fix it.

llvm-svn: 194201
2013-11-07 11:56:33 +00:00
Benjamin Kramer cd502b59e7 Add parens for || in && in assert. No functionality change.
llvm-svn: 194200
2013-11-07 11:03:53 +00:00
Alexander Potapenko 49034e3c33 [ASan] Add CMake configs for libclang_rt.asan_iossim_dynamic.dylib
CMake changes to build the ASan runtime for the iOS simulator. This is a universal library targeting the same architectures as the OSX ASan runtime does, thus the iossim version can't live in the same universal libclang_rt.asan_osx_dynamic.dylib

The difference between the OSX and iossim builds is in the -mios-simulator-version-min and -ios_simulator_version_min flags that tell Clang to compile and link iossim code.

The iossim runtime can only be built on a machine with both Xcode and the iOS Simulator SDK installed. If xcodebuild -version -sdk iphonesimulator Path returns a nonempty path, it is used when compiling and linking the iossim runtime.

llvm-svn: 194199
2013-11-07 10:08:19 +00:00
Sylvestre Ledru aaf01a7f2b Ubuntu has published its Saucy release. 'Trusty Tahr' dev has just started. Add its support in Clang
llvm-svn: 194198
2013-11-07 09:31:30 +00:00
Enea Zaffanella b1b1b8ab71 Fixed bug in return type of __builtin_va_start().
llvm-svn: 194197
2013-11-07 08:14:26 +00:00
Alexey Samsonov b3d939902a [Sanitizer] Make StackTrace::Unwind the only public way to unwind a stack trace.
llvm-svn: 194196
2013-11-07 07:28:33 +00:00
Alexey Samsonov 5d350b2ab6 [Sanitizer] Presumable fix stack trace unwinding on Windows
llvm-svn: 194195
2013-11-07 06:53:41 +00:00
Richard Smith 76b9f23f2d Mark generic lambdas, and thus C++14, as complete. Add commented-out stub for C++17.
llvm-svn: 194194
2013-11-07 06:41:26 +00:00
Alexey Samsonov e13f775a63 [Sanitizer] Call Windows unwinder 'slow' and share StackTrace::Unwind across all platforms. No functionality change.
llvm-svn: 194193
2013-11-07 06:33:06 +00:00
Richard Smith 14bdd7a925 Tests for DR150 - DR165.
llvm-svn: 194192
2013-11-07 06:24:09 +00:00
Alp Toker 3f0a99b448 RewriteBuffer: Remove an unused typedef
This hasn't been used for some time.

llvm-svn: 194191
2013-11-07 06:11:33 +00:00
David Blaikie f84a105c48 Unbreak the Clang -Werror build by removing some unused variables
llvm-svn: 194190
2013-11-07 05:52:35 +00:00
Richard Smith 677fb06cec Update cxx_dr_status.html to match current cwg issue list.
llvm-svn: 194189
2013-11-07 05:34:58 +00:00
Faisal Vali a17d19fb41 This patch implements capturing of variables within generic lambdas.
Both Richard and I felt that the current wording in the working paper needed some tweaking - Please see http://llvm-reviews.chandlerc.com/D2035 for additional context and references to core-reflector messages that discuss wording tweaks.

What is implemented is what we had intended to specify in Bristol; but, recently felt that the specification might benefit from some tweaking and fleshing.  

As a rough attempt to explain the semantics: If a nested lambda with a default-capture names a variable within its body, and if the enclosing full expression that contains the name of that variable is instantiation-dependent - then an enclosing lambda that is capture-ready (i.e. within a non-dependent context) must capture that variable, if all intervening nested lambdas can potentially capture that variable if they need to, and all intervening parent lambdas of the capture-ready lambda can and do capture the variable.      

Of note, 'this' capturing is also currently underspecified in the working paper for generic lambdas.  What is implemented here is if the set of candidate functions in a nested generic lambda includes both static and non-static member functions (regardless of viability checking - i.e. num and type of parameters/arguments) - and if all intervening nested-inner lambdas between the capture-ready lambda and the function-call containing nested lambda can capture 'this' and if all enclosing lambdas of the capture-ready lambda can capture 'this', then 'this' is speculatively captured by that capture-ready lambda.

Hopefully a paper for the C++ committee (that Richard and I had started some preliminary work on) is forthcoming. 

This essentially makes generic lambdas feature complete, except for known bugs. The more prominent ones (and the ones I am currently aware of) being:
  - generic lambdas and init-captures are broken - but a patch that fixes this is already in the works ...
  - nested variadic expansions such as:
    auto K = [](auto ... OuterArgs) {
      vp([=](auto ... Is) {
          decltype(OuterArgs) OA = OuterArgs;
          return 0;
        }(5)...);
      return 0;
    };
    auto M = K('a', ' ', 1, " -- ", 3.14); 
   currently cause crashes.  I think I know how to fix this (since I had done so in my initial implementation) - but it will probably take some work and back & forth with Doug and Richard.

A warm thanks to all who provided feedback - and especially to Doug Gregor and Richard Smith for their pivotal guidance: their insight and prestidigitation in such matters is boundless!

Now let's hope this commit doesn't upset the buildbot gods ;)

Thanks!

llvm-svn: 194188
2013-11-07 05:17:06 +00:00
Nick Kledzik d0784941fe [mach-o] fix memory ownership in test case
llvm-svn: 194187
2013-11-07 02:56:53 +00:00
Nick Kledzik 3c686e3561 add debug logging to help figure out why some tests fail on some build bots
llvm-svn: 194186
2013-11-07 01:27:47 +00:00
Marshall Clow 57b8f44c87 More duplicate code removal in <locale>. Hoist common parsing code into two templates: num_get::__do_get_signed and num_get::__do_get_unsigned, and make the do_get routines call them. No functionality change.
llvm-svn: 194185
2013-11-07 01:00:50 +00:00
Chandler Carruth 601f382405 Add the fact that Clang too is planning to start using C++11 (in some
limited ways) after the next release. See the lengthy discussions (which
are on-going) and the corresponding commit to LLVM's release notes.
Nothing is actually changing at this point, this is just further
spreading the plan.

llvm-svn: 194184
2013-11-07 00:26:32 +00:00
Chandler Carruth c089d826d9 Add the fact that we anticipate switching to use (some subset of) C++11
after the 3.4 release to the release notes. See the *lengthy* llvmdev
and cfe-dev threads on this subject. There will be more emails,
discussion and announcements, but I want to make noise in as many places
as I can to get everyone's concerns voiced and understood.

llvm-svn: 194183
2013-11-07 00:23:08 +00:00
Jim Ingham 6fbc48bc42 This patch does a couple of things.
It completes the job of using EvaluateExpressionOptions consistently throughout
the inferior function calling mechanism in lldb begun in Greg's patch r194009. 

It removes a handful of alternate calls into the ClangUserExpression/ClangFunction/ThreadPlanCallFunction which
were there for convenience.  Using the EvaluateExpressionOptions removes the need for them.

Using that it gets the --debug option from Greg's patch to work cleanly.

It also adds another EvaluateExpressionOption to not trap exceptions when running expressions.  You shouldn't
use this option unless you KNOW your expression can't throw beyond itself.  This is:

<rdar://problem/15374885>

At present this is only available through the SB API's or python.

It fixes a bug where function calls would unset the ObjC & C++ exception breakpoints without checking whether
they were set by somebody else already.

llvm-svn: 194182
2013-11-07 00:11:47 +00:00
David Majnemer bed356a9ea [-fms-extensions] Add support for __FUNCDNAME__
Summary:
Similar to __FUNCTION__, MSVC exposes the name of the enclosing mangled
function name via __FUNCDNAME__.  This implementation is very naive and
unoptimized, it is expected that __FUNCDNAME__ would be used rarely in
practice.

Reviewers: rnk, rsmith, thakis

CC: cfe-commits, silvas

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

llvm-svn: 194181
2013-11-06 23:31:56 +00:00
Alp Toker 695c3325af clang-cl: Hide ignored joined flags as well
This is an addendum to r194174.

llvm-svn: 194180
2013-11-06 23:17:02 +00:00
Daniel Jasper 56f8b43941 clang-format: Separate line-merging logic into its own class.
No functional changes (intended).

llvm-svn: 194179
2013-11-06 23:12:09 +00:00
Peter Collingbourne 671a1e4b37 Disable a tooling test on Windows.
llvm-svn: 194178
2013-11-06 23:02:51 +00:00
Nick Kledzik 471c00cfcb Hopefully fix latent bug where lldCore dependency on lldYAML was not in CMake files
llvm-svn: 194177
2013-11-06 22:56:42 +00:00
Aaron Ballman 5116a8e739 Work around an MSVC 2013 miscompile with the Redeclarable class. Fixes PR16606
llvm-svn: 194176
2013-11-06 22:39:46 +00:00
NAKAMURA Takumi 74d31faa4e Update \param in ToolInvocation() corresponding to r194164. [-Wdocumentation]
llvm-svn: 194175
2013-11-06 22:37:12 +00:00
Alp Toker b623aaeffe clang-cl: Hide ignored flags
We don't want to them to appear in the help text for now.

llvm-svn: 194174
2013-11-06 22:36:09 +00:00
Nick Kledzik f3e89cb802 [mach-o] fix EXPECT_EQ types
llvm-svn: 194173
2013-11-06 22:20:56 +00:00
Nick Kledzik 020fa7f080 [mach-o] add llvm_unreachable
llvm-svn: 194172
2013-11-06 22:18:09 +00:00