Commit Graph

27150 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 39a76387e0 Have ASTUnit::Save() return a bool to indicate save error.
Removes a dependency of ASTUnit to clang-c/Index.h.

llvm-svn: 164704
2012-09-26 16:39:46 +00:00
Nico Weber dd9602fe93 Revert r163022, it caused PR13924.
Add a test for PR13924. Do not revert the test added in r163022,
it surprisingly still passes even after reverting the code changes.

llvm-svn: 164672
2012-09-26 08:19:01 +00:00
Logan Chien 774442162d Add struct keyword before _Unwind_Context.
In the C programming language, we have to add the
"struct" keyword.  Otherwise, the compiler will
emit error message.

llvm-svn: 164665
2012-09-26 06:35:17 +00:00
Ted Kremenek a808e165b2 Remove unnecessary ASTContext& parameter from SymExpr::getType().
llvm-svn: 164661
2012-09-26 06:00:14 +00:00
Nico Weber ca496f34a2 Add codegen support for the __debugbreak intrinsic.
llvm-svn: 164660
2012-09-26 05:40:16 +00:00
Eli Friedman 15681d6852 Fix an edge case of mangling involving the combination of a lambda and typeid.
typeid (and a couple other non-standard places where we can transform an
unevaluated expression into an evaluated expression) is special
because it introduces an an expression evaluation context,
which conflicts with the mechanism to compute the current
lambda mangling context.  PR12123.

I would appreciate if someone would double-check that we get the mangling
correct with this patch.

llvm-svn: 164658
2012-09-26 04:34:21 +00:00
Eli Friedman b826a00857 Fix the AST representation for non-type template arguments to encode
enough information so we can mangle them correctly in cases involving
dependent parameter types. (This specifically impacts cases involving
null pointers and cases involving parameters of reference type.)
Fix the mangler to use this information instead of trying to scavenge
it out of the parameter declaration.

<rdar://problem/12296776>.

llvm-svn: 164656
2012-09-26 02:36:12 +00:00
Richard Smith 6e0605d654 Teach Type::getAs<TemplateSpecializationType> that a TemplateSpecializationType
for a type alias template can appear as sugar at any level of desugaring, just
like a TypedefType.

llvm-svn: 164655
2012-09-26 02:18:13 +00:00
Michael J. Spencer 9d1221a281 [Options] Store the option ID in OptTable::Info.
llvm-svn: 164644
2012-09-25 23:12:48 +00:00
Jordan Rose de584de370 Rename CanFitInto64Bits to alwaysFitsInto64Bits per discussion on IRC.
This makes the behavior clearer concerning literals with the maximum
number of digits. For a 32-bit example, 4,000,000,000 is a valid uint32_t,
but 5,000,000,000 is not, so we'd have to count 10-digit decimal numbers
as "unsafe" (meaning we have to check for overflow when parsing them,
just as we would for numbers with 11 digits or higher). This is the same,
only with 64 bits to play with.

No functionality change.

llvm-svn: 164639
2012-09-25 22:32:51 +00:00
Chad Rosier c30eb1c282 [driver] Add support for the -fno-fast-math option.
rdar://12299433

llvm-svn: 164638
2012-09-25 22:03:25 +00:00
Argyrios Kyrtzidis 2f45853f2f Improve upon r164450 and localize the logic of updating the type of
a function decl inside the ASTNodeImporter::VisitFunctionDecl function.

llvm-svn: 164625
2012-09-25 19:26:39 +00:00
Dmitri Gribenko 511288b2b5 Optimize NumericLiteralParser::GetIntegerValue().
It does a conservative estimate on the size of numbers that can fit into
uint64_t.  This bound is improved.

llvm-svn: 164624
2012-09-25 19:09:15 +00:00
Jordan Rose db72e2fc37 Reapply "[analyzer] Remove constraints on dead symbols as part of removeDeadBindings."
Previously, we'd just keep constraints around forever, which means we'd
never be able to merge paths that differed only in constraints on dead
symbols.

Because we now allow constraints on symbolic expressions, not just single
symbols, this requires changing SymExpr::symbol_iterator to include
intermediate symbol nodes in its traversal, not just the SymbolData leaf
nodes.

This depends on the previous commit to be correct. Originally applied in
r163444, reverted in r164275, now being re-applied.

llvm-svn: 164622
2012-09-25 19:03:06 +00:00
Jordan Rose 60d704ab4a [analyzer] Calculate liveness for symbolic exprs as well as atomic symbols.
No tests, but this allows the optimization of removing dead constraints.
We can then add tests that we don't do this prematurely.

<rdar://problem/12333297>

Note: the added FIXME to investigate SymbolRegionValue liveness is
tracked by <rdar://problem/12368183>. This patch does not change the
existing behavior.

llvm-svn: 164621
2012-09-25 19:03:01 +00:00
Douglas Gregor 24ff3bc392 Under certain terrible circumstances (<rdar://problem/10805775>),
top-level frameworks can actually be symlinked over to embedded
frameworks, and accessed via the top-level framework's headers. In
this case, we need to determine that the framework was *actually* an
embedded framework, so we can load the appropriate top-level module.

llvm-svn: 164620
2012-09-25 18:29:14 +00:00
Alexander Kornienko 1d26c02722 Macro history (de-)serialization. Deserialization currently reads only the latest macro definition. Needs more work.
Summary: Passes all tests (+ the new one with code completion), but needs a thorough review in part related to modules.

Reviewers: doug.gregor

Reviewed By: alexfh

CC: cfe-commits, rsmith

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

llvm-svn: 164610
2012-09-25 17:18:14 +00:00
Bob Wilson 24719e3236 Examine the last, not the first, instruction from the MC matcher.
If an MS-style inline asm is matched to multiple instructions, e.g., with a
a WAIT-prefix, then we need to examine the operands of the last instruction
instruction, not the prefix instruction.

llvm-svn: 164608
2012-09-25 16:30:16 +00:00
Douglas Gregor c83de30add Introduce builtin macros to determine whether we're building a
specific module (__building_module(modulename)) and to get the name of
the current module as an identifier (__MODULE__). 

Used to help headers behave differently when they're being included as
part of building a module. Oh, the irony.

llvm-svn: 164605
2012-09-25 15:44:52 +00:00
John McCall 82fb892019 When performing a ::delete of an object with a virtual destructor,
be sure to delete the complete object pointer, not the original
pointer.  This is necessary if the base being deleted is at a
non-zero offset in the complete object.  This is only required
for objects with virtual destructors because deleting an object
via a base-class subobject when the base does not have a virtual
destructor is undefined behavior.

Noticed while reviewing the last four years of cxx-abi-dev
activity.

llvm-svn: 164597
2012-09-25 10:10:39 +00:00
John McCall f652e9a6b0 Implement Mike Herrick's proposed noexcept mangling.
llvm-svn: 164593
2012-09-25 09:10:17 +00:00
John McCall 0f999f329c In the MS ABI, ctors return 'this'. Patch by Dmitry Sokolov.
llvm-svn: 164592
2012-09-25 08:00:39 +00:00
John McCall bf4a7d7193 Add the Microsoft __is_interface_class type trait.
Patch by Andy Gibbs!

llvm-svn: 164591
2012-09-25 07:32:49 +00:00
John McCall db632ac004 Fix for r163013 regression and further __interface enhancement.
Patch by Andy Gibbs!

llvm-svn: 164590
2012-09-25 07:32:39 +00:00
John McCall b0433eeb2e During jump-scope checking, build an ExprWithCleanups immediately
into the enclosing scope;  this is a more accurate model but is
(I believe) unnecessary in my test case due to other flaws.
However, one of those flaws is now intentional:  blocks which
appear in return statements can be trivially observed to not
extend in lifetime past the return, and so we can allow a jump
past them.  Do the necessary magic in IR-generation to make
this work.

llvm-svn: 164589
2012-09-25 06:56:03 +00:00
Richard Smith 88d67f3412 Fix crash when a decltype expression in a trailing return type refers to the
function being instantiated. An error recovery codepath was recursively
performing name lookup (and triggering an unbounded stack of template
instantiations which blew out the stack before hitting the depth limit).

Patch by Wei Pan!

llvm-svn: 164586
2012-09-25 04:46:05 +00:00
Eli Friedman cda3db801f Delete some code which is, as far as I can tell, dead.
llvm-svn: 164580
2012-09-25 01:02:42 +00:00
Anna Zaks 4396c54c14 [analyzer] Fix a buildbot crash triggered by turning on dynamic
dispatch.

llvm-svn: 164579
2012-09-25 00:31:43 +00:00
Richard Smith 60f2e1efb8 Don't produce diagnostics for missing ctor-initializers during template
instantiations if we encountered errors parsing some of the initializers.

llvm-svn: 164578
2012-09-25 00:23:05 +00:00
Eli Friedman bdd5753bda Handle C++ functional casts in a similar way to C-style casts in
unused expression warnings.  <rdar://problem/12359208>.

llvm-svn: 164569
2012-09-24 23:02:26 +00:00
Chad Rosier 93b3eb7793 Update for r164567.
llvm-svn: 164568
2012-09-24 22:58:50 +00:00
Ted Kremenek 3d0ec38cb4 Add clarifying comment.
llvm-svn: 164557
2012-09-24 21:17:14 +00:00
Dmitri Gribenko b8e9e7507e StringRef'ize Preprocessor::CreateString().
llvm-svn: 164555
2012-09-24 21:07:17 +00:00
Dmitri Gribenko ae07f72017 Replace raw call to snprintf() by llvm streams.
llvm-svn: 164554
2012-09-24 20:56:28 +00:00
Bob Wilson 317be45091 Replace an assertion with an error for empty __asm statements.
llvm-svn: 164551
2012-09-24 19:57:59 +00:00
Bob Wilson 0fc64f0b11 Fix a comment typo and clean up formatting.
llvm-svn: 164550
2012-09-24 19:57:55 +00:00
Douglas Gregor e769d862ee Make sure that we don't end up making an #undef'd macro visible after
the fact. Test cases will come when we're actually (de-)serializing
macro history.

llvm-svn: 164549
2012-09-24 19:56:18 +00:00
Dmitri Gribenko 1cd2305703 Change the wording of the extension warning from
> 'long long' is an extension when C99 mode is not enabled
to
> 'long long' is a C++11 extension
while compiling in C++98 mode.

llvm-svn: 164545
2012-09-24 18:19:21 +00:00
Anna Zaks b9828203df [analyzer] Really turn on dynamic-bifurcation on by default.
Thanks to Byoungyoung for realizing taht we are not passing the default
option correctly.

llvm-svn: 164543
2012-09-24 17:43:47 +00:00
Anna Zaks 3533a54a97 [analyzer]Prevent infinite recursion(assume->checker:evalAssume->assume)
(Unfortunately, I do not have a good reduced test case for this.)

llvm-svn: 164541
2012-09-24 17:43:41 +00:00
Dmitri Gribenko 7ba91723e7 Small cleanup of literal semantic analysis: hiding 'char *' pointers behind
StringRef makes code cleaner.  Also, make the temporary buffer smaller:
512 characters is unreasonably large for integer literals.

llvm-svn: 164484
2012-09-24 09:53:54 +00:00
Rafael Espindola 151a957fb0 Implement ToolChain::IsUnwindTablesDefault to reduce code duplication a bit.
llvm-svn: 164473
2012-09-23 03:05:41 +00:00
Rafael Espindola 66431cd10f On Hexagon getArchName() never returns x86_64, simplify the function.
llvm-svn: 164470
2012-09-22 22:58:57 +00:00
Dmitri Gribenko 1da8886915 Comment sema: warn when comment has \deprecated but declaration does not have a
deprecation attribute ('deprecated', 'availability' or 'unavailable').

This warning is under a separate flag, -Wdocumentation-deprecated-sync, so it
can be turned off easily while leaving other -Wdocumentation warnings on.

llvm-svn: 164467
2012-09-22 21:47:50 +00:00
Rafael Espindola 08f1ebb2b7 Fix pr13749. There is still a lot of code using getArchName that should be
using getArch, but I will try to fix them one at time to add tests.

llvm-svn: 164460
2012-09-22 15:04:11 +00:00
Abramo Bagnara 6cba23a649 Avoid multiple atomic builtin declaration.
llvm-svn: 164454
2012-09-22 09:05:22 +00:00
Argyrios Kyrtzidis b41791d848 When importing a FunctionProtoType::ExtProtoInfo, its ExceptionSpecDecl can point to the
FunctionDecl that we are importing the FunctionProtoType for, in which case we'll have
infinite recursion when importing.

Initially create a FunctionProtoType with null ExceptionSpecDecl/ExceptionSpecTemplate and
update the type in ASTNodeImporter::VisitFunctionDecl after the FunctionDecl has been created.

llvm-svn: 164450
2012-09-22 01:58:06 +00:00
Jordan Rose 52de8eec01 [analyzer] Suppress bugs whose paths go through the return of a null pointer.
This is a heuristic intended to greatly reduce the number of false
positives resulting from inlining, particularly inlining of generic,
defensive C++ methods that live in header files. The suppression is
triggered in the cases where we ask to track where a null pointer came
from, and it turns out that the source of the null pointer was an inlined
function call.

This change brings the number of bug reports in LLVM from ~1500 down to
around ~300, a much more manageable number. Yes, some true positives may
be hidden as well, but from what I looked at the vast majority of silenced
reports are false positives, and many of the true issues found by the
analyzer are still reported.

I'm hoping to improve this heuristic further by adding some exceptions
next week (cases in which a bug should still be reported).

llvm-svn: 164449
2012-09-22 01:25:06 +00:00
Jordan Rose 4ac7cba404 [analyzer] Track a null value back through FindLastStoreBRVisitor.
Also, tidy up the other tracking visitors so that they mark the right
things as interesting and don't do extra work.

llvm-svn: 164448
2012-09-22 01:25:00 +00:00
Jordan Rose fa92f0f298 [analyzer] Always allow BugReporterVisitors to see the bug path.
Before, PathDiagnosticConsumers that did not support actual path output
would (sensibly) cause the generation of the full path to be skipped.
However, BugReporterVisitors may want to see the path in order to mark a
BugReport as invalid.

Now, even for a path generation scheme of 'None' we will still create a
trimmed graph and walk backwards through the bug path, doing no work other
than passing the nodes to the BugReporterVisitors. This isn't cheap, but
it's necessary to properly do suppression when the first path consumer does
not support path notes.

In the future, we should try only generating the path and visitor-provided
path notes once, or at least only creating the trimmed graph once.

llvm-svn: 164447
2012-09-22 01:24:56 +00:00