Граф коммитов

44476 Коммитов

Автор SHA1 Сообщение Дата
Nico Weber b07d448a62 Warn on va_start() when called with a reference parameter.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf 18.7p3
explicitly calls this (and some other things) out as undefined.

Also move 2 other existing warnings behind the new -Wvarargs flag.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182694 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 23:31:57 +00:00
Argyrios Kyrtzidis 4c9f58f617 [libclang] Add logging for clang_createTranslationUnit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182682 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 22:24:07 +00:00
Argyrios Kyrtzidis 5b8e132a9a Add some safety checks in a couple of SourceManager functions.
This is to address crash in rdar://13932308

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182681 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 22:24:04 +00:00
Jordan Rose b9814c867e [analyzer] Fix test for r182677.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182678 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 21:49:58 +00:00
Jordan Rose d474da0625 [analyzer] Treat analyzer-synthesized function bodies like implicit bodies.
When generating path notes, implicit function bodies are shown at the call
site, so that, say, copying a POD type in C++ doesn't jump you to a header
file. This is especially important when the synthesized function itself
calls another function (or block), in which case we should try to jump the
user around as little as possible.

By checking whether a called function has a body in the AST, we can tell
if the analyzer synthesized the body, and if we should therefore collapse
the call down to the call site like a true implicitly-defined function.

<rdar://problem/13978414>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182677 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 21:43:11 +00:00
Jordan Rose 5a6fb20841 [analyzer; new edges] Properly set location after exiting an inlined call.
The new edge algorithm would keep track of the previous location in each
location context, so that it could draw arrows coming in and out of each
inlined call. However, it tried to access the location of the call before
it was actually set (at the CallEnter node). This only affected
unterminated calls at the end of a path; calls with visible exit nodes
already had a valid location.

This patch ditches the location context map, since we're processing the
nodes in order anyway, and just unconditionally updates the PrevLoc
variable after popping out of an inlined call.

<rdar://problem/13983470>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182676 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 21:43:05 +00:00
Michael J. Spencer 9779fdd271 Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182675 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 21:42:04 +00:00
David Blaikie b0f77b0657 DebugInfo: Rename CreatePointerType to getOrCreateTypeDeclaration
To make this more consistent with 'getOrCreateType' & clarify the
distinction between the two. The only thing I couldn't quite communicate
in the name is that getOrCreateTypeDeclaration may actually produce a
full definition (in -fno-limit-debug-info) but the point is to call it
whenever only a declaration is needed & the implementation can choose
whether to provide a declaration or definition.

(also, unfortunately, getOrCreateType can produce declarations too - we
should sure this up by making it not do that - any caller that can
tolerate a declaration should be calling getOrCreateTypeDeclaration
instead)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182674 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 21:33:22 +00:00
David Blaikie 912964863c PR16091: Error when attempting to emit debug info for undeduced auto return types
Perhaps we should just suppress this, rather than erroring, but since we
have the infrastructure for it I figured I'd use it - if this is
determined to be not the right thing we should probably remove that
infrastructure entirely. I guess it's lying around from the early days
of implementing debug info support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182673 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 21:24:35 +00:00
Diego Novillo d27e5cbff3 [PATCH] Generate cold attribute for functions marked __atribute__((cold))
This removes a FIXME in CodeGenModule::SetLLVMFunctionAttributesForDefinition.
When a function is declared cold we can now generate the IR attribute in
addition to marking the function to be optimized for size.

I tried adding a separate CHECK in the existing test, but it was
failing.  I suppose CHECK matches one line exactly once?  This would be
a problem if the attributes are listed in a different order, though they
seem to be sorted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182666 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 20:18:15 +00:00
Adrian Prantl 1e4112d1ba typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182660 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 18:38:08 +00:00
Chad Rosier 942dfe2e4d [ms-inline asm] Don't diagnose an empty lookup for inline assmebly. This happen
for labels in inline assembly that aren't in the lookup tables.  E.g.,

  __asm {
   a:
   jmp a
  }

rdar://13983623


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182659 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 18:32:55 +00:00
Alexander Kornienko 6fb46b0259 Ignore contents of #if 0 blocks.
Summary:
Added stack of preprocessor branching directives, and ignore all tokens
inside #if 0 except for preprocessor directives.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182658 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 18:24:24 +00:00
Rafael Espindola d3bb9ffb9a Fix printing CXXTemporaryObjectExpr with default args.
Patch by Will Wilson.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182651 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 16:11:44 +00:00
Aaron Ballman 89735b9516 Suffixing #pragma comment(lib) library names with .lib if necessary. This matches MSVC behavior, as well as allows us to properly link libraries such as the ones provided by the MSDN examples.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182647 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 15:06:56 +00:00
Evgeniy Stepanov 3a8aff9493 Add -lrt to sanitizer link arguments.
Sanitizer runtime intercepts functions from librt. Not doing this will fail
if the librt dependency is not present at program startup (ex. comes from a
dlopen()ed library).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182645 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 14:28:03 +00:00
Duncan Sands 809b981cef Fix comment typo pointed out by maslen on IRC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182642 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 13:41:43 +00:00
Argyrios Kyrtzidis 1783b07ea8 User correct case for 'FileCheck'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182632 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 05:54:31 +00:00
Argyrios Kyrtzidis 3b7deda713 [modules] If we hit a failure while loading a PCH/module, abort parsing instead of trying to continue in an invalid state.
Also don't let libclang create a PCH with such an error.

Fixes rdar://13953768

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182629 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 05:44:08 +00:00
Ted Kremenek 989741b0b9 Update static analyzer build to checker-275.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182626 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 00:50:01 +00:00
Richard Smith 2c2f09ec48 Fix crash-on-invalid if list-initialization works, but we bail out when
building the resulting expression because it invokes a deleted constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182624 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 23:20:04 +00:00
Bill Wendling d5dcdb2658 Constify the 'dump' method so that it can be called by a const object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182620 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 23:10:23 +00:00
Richard Smith e69fb20435 Fix assert on temporary std::initializer_list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182615 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 21:54:14 +00:00
Daniel Jasper ce93356e27 More tests and a fix for braced init lists.
Before: f(new vector<int> { 1, 2, 3 });
After:  f(new vector<int>{ 1, 2, 3 });

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182614 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 21:35:49 +00:00
Ted Kremenek 0d2223f52d [analyzer; alternate edges] Add a new test case file to regression test the new arrows algorithm.
This essentially combines the tests in plist-output.m and plist-alternate-output.m.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182612 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 21:33:12 +00:00
Manuel Klimek 854ca794c1 Fix aligning of comments.
Previously we started sequences to align for single line comments when
the previous line had a trailing comment, but the sequence was broken
for other reasons.

Now we re-format:
// a
 // b
f(); // c
to:
// a
// b
f(); // c

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182608 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 20:46:07 +00:00
Manuel Klimek 23ad339cdb Fix aligning of comments that are at the start of the line.
Now correctly leaves:
f(); // comment
// comment
g(); // comment
... alone if the middle comment was aligned with g() before formatting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182605 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 19:54:43 +00:00
Tim Northover ef7c6e7703 Add caveat to __builtin_readcyclecounter documentation.
The ARM cycle-counter can be restricted by the operating system; it's
worth warning potential users of this issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182604 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 19:14:12 +00:00
Daniel Jasper de0d61fbe8 Increase test coverage for braced init lists.
Also fix a minor bug for constructor initializers with braced init lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182601 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 18:29:16 +00:00
Daniel Jasper 1bee0738b6 Improve formatting of braced lists.
Before: vector<int> v{ -1};
After:  vector<int> v{-1};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182597 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 18:05:18 +00:00
Daniel Jasper 4507a2cc6f clang-format integration for git.
Put this somewhere on your path and use:

git clang-format

Awesome work by Mark Lodato. Many thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182596 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 17:53:42 +00:00
Benjamin Kramer b1a4d37c05 Make helper functions static.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182589 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 15:53:44 +00:00
Manuel Klimek ebfb88c32a Stop aligning trailing comments which are aligned with the next line.
Previously we would align:
f(); // comment
     // other comment
g();

Even if // other comment was at the start of the line. Now we do not
align trailing comments if they have been already aligned correctly
with the next line.

Thus,
f(); // comment
// other comment
g();
will not be changed, while:
f(); // comment
  // other commment
g();
will lead to the two trailing comments being aligned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182577 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 11:42:52 +00:00
Manuel Klimek ad3094b7d8 Use a SourceRange for the whitespace location in FormatToken.
Replaces the use of WhitespaceStart + WhitspaceLength.
This made a bug in the formatter obvous where we would incorrectly
calculate the next column.

FIXME: There's a similar bug left regarding TokenLength. We should
probably also move to have a TokenRange instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182572 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 10:56:37 +00:00
Daniel Jasper 2424eefa69 Improve formatting of braced lists.
Before:
vector<int> x { 1, 2, 3 };
After:
vector<int> x{ 1, 2, 3 };

Also add a style option to remove the spaces inside braced lists,
so that the above becomes:
std::vector<int> v{1, 2, 3};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182570 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 10:15:45 +00:00
Manuel Klimek a3e21792f8 Fix no-assert compiles.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182569 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 10:02:51 +00:00
Manuel Klimek 80829bd8c3 Expand parsing of braced init lists.
Allows formatting of C++11 braced init list constructs, like:
vector<int> v { 1, 2, 3 };
f({ 1, 2 });

This involves some changes of how tokens are handled in the
UnwrappedLineFormatter. Note that we have a plan to evolve the
design of the token flow into one where we create all tokens
up-front and then annotate them in the various layers (as we
currently already have to create all tokens at once anyway, the
current abstraction does not help). Thus, this introduces
FIXMEs towards that goal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182568 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 09:41:43 +00:00
Ted Kremenek 0fa3504acf [analyzer;alternate edges] fix type that was causing the wrong path piece to get removed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182562 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 06:41:58 +00:00
Richard Smith e565bfa2d6 Fix bitcode desynchronization when loading a PCH containing a class template
specialization with modules enabled. Just don't merge them at all for now;
we'll revisit this when support for template merging is added.

In passing, make Decl::dump() a little safer to use with PCH/modules, by making
it not deserialize any additional declarations. From a debugger you can call
decls_begin() or similar first if you want to dump all child decls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182544 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 01:49:11 +00:00
Richard Smith 5705f21147 PR14772: Support constant expression evaluation for _Atomic types.
* Treat _Atomic(T) as a literal type if T is a literal type.
 * Evaluate expressions of this type properly.
 * Fix a lurking bug where we built completely bogus ASTs for converting to
   _Atomic types in C++ in some cases, caught by the tests for this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182541 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-23 00:30:41 +00:00
Aaron Ballman aa9df09729 Adding in parsing and the start of semantic support for __sptr and __uptr pointer type qualifiers. This patch also fixes the correlated __ptr32 and __ptr64 pointer qualifiers so that they are truly type attributes instead of declaration attributes.
For more information about __sptr and __uptr, see MSDN: http://msdn.microsoft.com/en-us/library/aa983399.aspx

Patch reviewed by Richard Smith.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182535 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 23:25:32 +00:00
David Blaikie 9a84529ed0 Debug Info: Handle function/method types using the most specific type
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182533 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 23:22:42 +00:00
Adrian Prantl 0cb0002332 Comment and cleanup.
rdar://problem/13359718

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182524 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 21:37:49 +00:00
Pete Cooper 34bd3331b5 Insert explicit casts to try appease overload resolution in the buildbots
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182514 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 21:02:38 +00:00
Ted Kremenek 13feb9201e Use scope-resolution operator to hopefully unbreak Windows builds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182509 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 20:01:35 +00:00
Ted Kremenek a705980a7c Simplifiy code using return value of erase().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182506 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 19:25:03 +00:00
Ted Kremenek 1d85a9e8fb [analyzer; alternate edges] remove redundant adjacent "events" with the same text.
Fixes <rdar://problem/13949982>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182505 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 19:10:41 +00:00
Adrian Prantl c32a217472 Bugfix for r181629:
- The return type should be a pointer to the class type.
- Make the condition more specific.

rdar://problem/13359718

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182504 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 19:10:15 +00:00
Ted Kremenek de7bc0d997 [analyzer;alternate edges] remove puny edges on the same line that span less than 3 columns.
These are legitimate control-flow edges, but visually they add
no value.

Implements <rdar://problem/13941325>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182502 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 18:52:35 +00:00
Ted Kremenek ddf6e840ca Remove unnecessary assignment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182501 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 18:52:32 +00:00