]> granicus.if.org Git - clang/log
clang
11 years agoRemove unnecessary ASTContext& parameter from SymExpr::getType().
Ted Kremenek [Wed, 26 Sep 2012 06:00:14 +0000 (06:00 +0000)]
Remove unnecessary ASTContext& parameter from SymExpr::getType().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164661 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd codegen support for the __debugbreak intrinsic.
Nico Weber [Wed, 26 Sep 2012 05:40:16 +0000 (05:40 +0000)]
Add codegen support for the __debugbreak intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164660 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix an edge case of mangling involving the combination of a lambda and typeid.
Eli Friedman [Wed, 26 Sep 2012 04:34:21 +0000 (04:34 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164658 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix the AST representation for non-type template arguments to encode
Eli Friedman [Wed, 26 Sep 2012 02:36:12 +0000 (02:36 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164656 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTeach Type::getAs<TemplateSpecializationType> that a TemplateSpecializationType
Richard Smith [Wed, 26 Sep 2012 02:18:13 +0000 (02:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164655 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdate checker build.
Ted Kremenek [Tue, 25 Sep 2012 23:58:39 +0000 (23:58 +0000)]
Update checker build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164649 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[Options] Store the option ID in OptTable::Info.
Michael J. Spencer [Tue, 25 Sep 2012 23:12:48 +0000 (23:12 +0000)]
[Options] Store the option ID in OptTable::Info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164644 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove 'const' version of getBasicVals(), which is useless.
Ted Kremenek [Tue, 25 Sep 2012 23:12:12 +0000 (23:12 +0000)]
Remove 'const' version of getBasicVals(), which is useless.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164643 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRename CanFitInto64Bits to alwaysFitsInto64Bits per discussion on IRC.
Jordan Rose [Tue, 25 Sep 2012 22:32:51 +0000 (22:32 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164639 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[driver] Add support for the -fno-fast-math option.
Chad Rosier [Tue, 25 Sep 2012 22:03:25 +0000 (22:03 +0000)]
[driver] Add support for the -fno-fast-math option.
rdar://12299433

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164638 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] Do a AST concurrency check in clang_indexTranslationUnit_Impl.
Argyrios Kyrtzidis [Tue, 25 Sep 2012 19:29:50 +0000 (19:29 +0000)]
[libclang] Do a AST concurrency check in clang_indexTranslationUnit_Impl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164626 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprove upon r164450 and localize the logic of updating the type of
Argyrios Kyrtzidis [Tue, 25 Sep 2012 19:26:39 +0000 (19:26 +0000)]
Improve upon r164450 and localize the logic of updating the type of
a function decl inside the ASTNodeImporter::VisitFunctionDecl function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164625 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoOptimize NumericLiteralParser::GetIntegerValue().
Dmitri Gribenko [Tue, 25 Sep 2012 19:09:15 +0000 (19:09 +0000)]
Optimize NumericLiteralParser::GetIntegerValue().

It does a conservative estimate on the size of numbers that can fit into
uint64_t.  This bound is improved.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164624 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Add tests for symbolic expression liveness.
Jordan Rose [Tue, 25 Sep 2012 19:03:09 +0000 (19:03 +0000)]
[analyzer] Add tests for symbolic expression liveness.

There are very few tests here because SValBuilder is fairly aggressive
about not building SymExprs that we can't evaluate, which saves memory
and CPU but also makes it very much tied to the current constraint
manager. We should probably scale back here and let things decay to
UnknownVal later on.

bitwise-ops.c tests that for the SymExprs we do create, we persist our
assumptions about them. traversal-path-unification.c tests that we do
clean out constraints on arbitrary SymExprs once they have actually died.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164623 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReapply "[analyzer] Remove constraints on dead symbols as part of removeDeadBindings."
Jordan Rose [Tue, 25 Sep 2012 19:03:06 +0000 (19:03 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164622 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Calculate liveness for symbolic exprs as well as atomic symbols.
Jordan Rose [Tue, 25 Sep 2012 19:03:01 +0000 (19:03 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164621 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUnder certain terrible circumstances (<rdar://problem/10805775>),
Douglas Gregor [Tue, 25 Sep 2012 18:29:14 +0000 (18:29 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164620 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMacro history (de-)serialization. Deserialization currently reads only the latest...
Alexander Kornienko [Tue, 25 Sep 2012 17:18:14 +0000 (17:18 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164610 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoExamine the last, not the first, instruction from the MC matcher.
Bob Wilson [Tue, 25 Sep 2012 16:30:16 +0000 (16:30 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164608 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago-iframework should allow separate arguments.
Douglas Gregor [Tue, 25 Sep 2012 16:13:41 +0000 (16:13 +0000)]
-iframework should allow separate arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164607 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoIntroduce builtin macros to determine whether we're building a
Douglas Gregor [Tue, 25 Sep 2012 15:44:52 +0000 (15:44 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164605 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoA minor doc fix.
Alexander Kornienko [Tue, 25 Sep 2012 12:42:05 +0000 (12:42 +0000)]
A minor doc fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164601 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix failing test/Sema/wchar.c on ARM.
Hans Wennborg [Tue, 25 Sep 2012 10:11:17 +0000 (10:11 +0000)]
Fix failing test/Sema/wchar.c on ARM.

Currently Sema/wchar.c fails because WCHAR_T_TYPE is defined as int,
however on ARM wchar_t is unsigned int.

This patch changes that, so this test passes for ARM.

Patch by Joey Gouly!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164598 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhen performing a ::delete of an object with a virtual destructor,
John McCall [Tue, 25 Sep 2012 10:10:39 +0000 (10:10 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164597 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoclang/test/CodeGenCXX/microsoft-*: Fix for -Asserts.
NAKAMURA Takumi [Tue, 25 Sep 2012 09:53:18 +0000 (09:53 +0000)]
clang/test/CodeGenCXX/microsoft-*: Fix for -Asserts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164594 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImplement Mike Herrick's proposed noexcept mangling.
John McCall [Tue, 25 Sep 2012 09:10:17 +0000 (09:10 +0000)]
Implement Mike Herrick's proposed noexcept mangling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164593 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoIn the MS ABI, ctors return 'this'. Patch by Dmitry Sokolov.
John McCall [Tue, 25 Sep 2012 08:00:39 +0000 (08:00 +0000)]
In the MS ABI, ctors return 'this'.  Patch by Dmitry Sokolov.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164592 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd the Microsoft __is_interface_class type trait.
John McCall [Tue, 25 Sep 2012 07:32:49 +0000 (07:32 +0000)]
Add the Microsoft __is_interface_class type trait.
Patch by Andy Gibbs!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164591 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix for r163013 regression and further __interface enhancement.
John McCall [Tue, 25 Sep 2012 07:32:39 +0000 (07:32 +0000)]
Fix for r163013 regression and further __interface enhancement.
Patch by Andy Gibbs!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164590 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDuring jump-scope checking, build an ExprWithCleanups immediately
John McCall [Tue, 25 Sep 2012 06:56:03 +0000 (06:56 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164589 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix crash when a decltype expression in a trailing return type refers to the
Richard Smith [Tue, 25 Sep 2012 04:46:05 +0000 (04:46 +0000)]
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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164586 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDelete some code which is, as far as I can tell, dead.
Eli Friedman [Tue, 25 Sep 2012 01:02:42 +0000 (01:02 +0000)]
Delete some code which is, as far as I can tell, dead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164580 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Fix a buildbot crash triggered by turning on dynamic
Anna Zaks [Tue, 25 Sep 2012 00:31:43 +0000 (00:31 +0000)]
[analyzer] Fix a buildbot crash triggered by turning on dynamic
dispatch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164579 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't produce diagnostics for missing ctor-initializers during template
Richard Smith [Tue, 25 Sep 2012 00:23:05 +0000 (00:23 +0000)]
Don't produce diagnostics for missing ctor-initializers during template
instantiations if we encountered errors parsing some of the initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164578 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoHandle C++ functional casts in a similar way to C-style casts in
Eli Friedman [Mon, 24 Sep 2012 23:02:26 +0000 (23:02 +0000)]
Handle C++ functional casts in a similar way to C-style casts in
unused expression warnings.  <rdar://problem/12359208>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164569 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdate for r164567.
Chad Rosier [Mon, 24 Sep 2012 22:58:50 +0000 (22:58 +0000)]
Update for r164567.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164568 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoobjective-C: use 'instance variables' as plural when referring
Fariborz Jahanian [Mon, 24 Sep 2012 22:51:51 +0000 (22:51 +0000)]
objective-C: use 'instance variables' as plural when referring
to the feature.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164566 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoobjective-C: remove use of 'ivar' in favor of
Fariborz Jahanian [Mon, 24 Sep 2012 22:00:36 +0000 (22:00 +0000)]
objective-C: remove use of 'ivar' in favor of
'instance variable' in text of all diagnostics
for objective-C: // rdar://12352442

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164559 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd clarifying comment.
Ted Kremenek [Mon, 24 Sep 2012 21:17:14 +0000 (21:17 +0000)]
Add clarifying comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164557 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMore tests for r164545 (change extension warning about 'long long').
Dmitri Gribenko [Mon, 24 Sep 2012 21:09:05 +0000 (21:09 +0000)]
More tests for r164545 (change extension warning about 'long long').

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164556 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoStringRef'ize Preprocessor::CreateString().
Dmitri Gribenko [Mon, 24 Sep 2012 21:07:17 +0000 (21:07 +0000)]
StringRef'ize Preprocessor::CreateString().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164555 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReplace raw call to snprintf() by llvm streams.
Dmitri Gribenko [Mon, 24 Sep 2012 20:56:28 +0000 (20:56 +0000)]
Replace raw call to snprintf() by llvm streams.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164554 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReplace an assertion with an error for empty __asm statements.
Bob Wilson [Mon, 24 Sep 2012 19:57:59 +0000 (19:57 +0000)]
Replace an assertion with an error for empty __asm statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164551 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a comment typo and clean up formatting.
Bob Wilson [Mon, 24 Sep 2012 19:57:55 +0000 (19:57 +0000)]
Fix a comment typo and clean up formatting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164550 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMake sure that we don't end up making an #undef'd macro visible after
Douglas Gregor [Mon, 24 Sep 2012 19:56:18 +0000 (19:56 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164549 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] Bring CXCursor_AsmStmt back as an alias for CXCursor_GCCAsmStmt.
Argyrios Kyrtzidis [Mon, 24 Sep 2012 19:27:20 +0000 (19:27 +0000)]
[libclang] Bring CXCursor_AsmStmt back as an alias for CXCursor_GCCAsmStmt.

This was renamed in r162632 which was badness because the C API needs to be stable.
rdar://12360096

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164547 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoInclude 'long long' extension warning in the LongLong group so that it can be
Dmitri Gribenko [Mon, 24 Sep 2012 19:05:10 +0000 (19:05 +0000)]
Include 'long long' extension warning in the LongLong group so that it can be
silenced by -Wno-long-long.  Thanks Richard Smith for the fix idea!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164546 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoChange the wording of the extension warning from
Dmitri Gribenko [Mon, 24 Sep 2012 18:19:21 +0000 (18:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164545 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Really turn on dynamic-bifurcation on by default.
Anna Zaks [Mon, 24 Sep 2012 17:43:47 +0000 (17:43 +0000)]
[analyzer] Really turn on dynamic-bifurcation on by default.

Thanks to Byoungyoung for realizing taht we are not passing the default
option correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164543 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Remove unused.
Anna Zaks [Mon, 24 Sep 2012 17:43:44 +0000 (17:43 +0000)]
[analyzer] Remove unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164542 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer]Prevent infinite recursion(assume->checker:evalAssume->assume)
Anna Zaks [Mon, 24 Sep 2012 17:43:41 +0000 (17:43 +0000)]
[analyzer]Prevent infinite recursion(assume->checker:evalAssume->assume)

(Unfortunately, I do not have a good reduced test case for this.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164541 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse an explicit target to test that source fortification is off when building for...
Alexander Potapenko [Mon, 24 Sep 2012 10:25:24 +0000 (10:25 +0000)]
Use an explicit target to test that source fortification is off when building for Darwin with -faddress-sanitizer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164485 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSmall cleanup of literal semantic analysis: hiding 'char *' pointers behind
Dmitri Gribenko [Mon, 24 Sep 2012 09:53:54 +0000 (09:53 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164484 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdate the Clang tests which run with a full optimization pipeline for
Chandler Carruth [Mon, 24 Sep 2012 01:10:25 +0000 (01:10 +0000)]
Update the Clang tests which run with a full optimization pipeline for
the new SROA pass. This is a benign change: the order of PHI nodes
changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164481 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agounittests/AST/StmtPrinterTest.cpp: Suppress a LP64-assumed test, "0x100000000i128...
NAKAMURA Takumi [Mon, 24 Sep 2012 00:34:18 +0000 (00:34 +0000)]
unittests/AST/StmtPrinterTest.cpp: Suppress a LP64-assumed test, "0x100000000i128 => 4294967296L", for now.

LONG_MAX is 2147483647L on common 32 bit and LLP64 (Windows x64).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164478 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAs a followup for r164303, add some tests for printing literals that test
Dmitri Gribenko [Sun, 23 Sep 2012 20:29:07 +0000 (20:29 +0000)]
As a followup for r164303, add some tests for printing literals that test
printing directly rather than through a complicated machinery of ObjC rewriter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164477 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImplement ToolChain::IsUnwindTablesDefault to reduce code duplication a bit.
Rafael Espindola [Sun, 23 Sep 2012 03:05:41 +0000 (03:05 +0000)]
Implement ToolChain::IsUnwindTablesDefault to reduce code duplication a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164473 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoOn Hexagon getArchName() never returns x86_64, simplify the function.
Rafael Espindola [Sat, 22 Sep 2012 22:58:57 +0000 (22:58 +0000)]
On Hexagon getArchName() never returns x86_64, simplify the function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164470 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse pipes.
Rafael Espindola [Sat, 22 Sep 2012 22:51:00 +0000 (22:51 +0000)]
Use pipes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164469 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse FileCheck.
Rafael Espindola [Sat, 22 Sep 2012 22:30:04 +0000 (22:30 +0000)]
Use FileCheck.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164468 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoComment sema: warn when comment has \deprecated but declaration does not have a
Dmitri Gribenko [Sat, 22 Sep 2012 21:47:50 +0000 (21:47 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164467 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove superfluous \namespace command.
Dmitri Gribenko [Sat, 22 Sep 2012 21:44:37 +0000 (21:44 +0000)]
Remove superfluous \namespace command.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164466 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix cindex.py compatibility with older libclang.so
Dmitri Gribenko [Sat, 22 Sep 2012 17:52:29 +0000 (17:52 +0000)]
Fix cindex.py compatibility with older libclang.so

The issue is that we were calling clang_getCompletionBriefComment
unconditionally.  New we check if this function is available before calling it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164464 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse FileCheck.
Rafael Espindola [Sat, 22 Sep 2012 15:26:38 +0000 (15:26 +0000)]
Use FileCheck.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164462 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix pr13749. There is still a lot of code using getArchName that should be
Rafael Espindola [Sat, 22 Sep 2012 15:04:11 +0000 (15:04 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164460 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAvoid multiple atomic builtin declaration.
Abramo Bagnara [Sat, 22 Sep 2012 09:05:22 +0000 (09:05 +0000)]
Avoid multiple atomic builtin declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164454 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhen importing a FunctionProtoType::ExtProtoInfo, its ExceptionSpecDecl can point...
Argyrios Kyrtzidis [Sat, 22 Sep 2012 01:58:06 +0000 (01:58 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164450 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Suppress bugs whose paths go through the return of a null pointer.
Jordan Rose [Sat, 22 Sep 2012 01:25:06 +0000 (01:25 +0000)]
[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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164449 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Track a null value back through FindLastStoreBRVisitor.
Jordan Rose [Sat, 22 Sep 2012 01:25:00 +0000 (01:25 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164448 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Always allow BugReporterVisitors to see the bug path.
Jordan Rose [Sat, 22 Sep 2012 01:24:56 +0000 (01:24 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164447 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Allow a BugReport to be marked "invalid" during path generation.
Jordan Rose [Sat, 22 Sep 2012 01:24:53 +0000 (01:24 +0000)]
[analyzer] Allow a BugReport to be marked "invalid" during path generation.

This is intended to allow visitors to make decisions about whether a
BugReport is likely a false positive. Currently there are no visitors
making use of this feature, so there are no tests.

When a BugReport is marked invalid, the invalidator must provide a key
that identifies the invaliation (intended to be the visitor type and a
context pointer of some kind). This allows us to reverse the decision
later on. Being able to reverse a decision about invalidation gives us more
flexibility, and allows us to formulate conditions like "this report is
invalid UNLESS the original argument is 'foo'". We can use this to
fine-tune our false-positive suppression (coming soon).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164446 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Look through OpaqueValueExprs when tracking a nil value.
Jordan Rose [Sat, 22 Sep 2012 01:24:49 +0000 (01:24 +0000)]
[analyzer] Look through OpaqueValueExprs when tracking a nil value.

This allows us to show /why/ a particular object is nil, even when it is
wrapped in an OpaqueValueExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164445 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Better path notes for null pointers passed as arguments.
Jordan Rose [Sat, 22 Sep 2012 01:24:46 +0000 (01:24 +0000)]
[analyzer] Better path notes for null pointers passed as arguments.

Rather than saying "Null pointer value stored to 'foo'", we now say
"Passing null pointer value via Nth parameter 'foo'", which is much better.
The note is also now on the argument expression as well, rather than the
entire call.

This paves the way for continuing to track arguments back to their sources.

<rdar://problem/12211490>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164444 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse llvm::getOrdinalSuffix to print ordinal numbers in diagnostics.
Jordan Rose [Sat, 22 Sep 2012 01:24:42 +0000 (01:24 +0000)]
Use llvm::getOrdinalSuffix to print ordinal numbers in diagnostics.

Just a refactoring of common infrastructure. No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164443 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Check that an ObjCIvarRefExpr's base is non-null even as an lvalue.
Jordan Rose [Sat, 22 Sep 2012 01:24:38 +0000 (01:24 +0000)]
[analyzer] Check that an ObjCIvarRefExpr's base is non-null even as an lvalue.

Like with struct fields, we want to catch cases like this early,
so that we can produce better diagnostics and path notes:

  PointObj *p = nil;
  int *px = &p->_x; // should warn here
  *px = 1;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164442 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Check that a member expr is valid even when the result is an lvalue.
Jordan Rose [Sat, 22 Sep 2012 01:24:33 +0000 (01:24 +0000)]
[analyzer] Check that a member expr is valid even when the result is an lvalue.

We want to catch cases like this early, so that we can produce better
diagnostics and path notes:

  Point *p = 0;
  int *px = &p->x; // should warn here
  *px = 1;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164441 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix bug which sometimes resulted in further diagnostics being produced after a
Richard Smith [Sat, 22 Sep 2012 00:53:56 +0000 (00:53 +0000)]
Fix bug which sometimes resulted in further diagnostics being produced after a
fatal error. Previously, if a fatal error was followed by a diagnostic which
was suppressed due to a SFINAETrap, we'd forget that we'd seen a fatal error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164437 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-inline asm] Use mnemonicIsValid() in a helpful assert.
Chad Rosier [Fri, 21 Sep 2012 22:22:39 +0000 (22:22 +0000)]
[ms-inline asm] Use mnemonicIsValid() in a helpful assert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164421 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMark the passed in "self" for a block as an object pointer so
Eric Christopher [Fri, 21 Sep 2012 22:18:42 +0000 (22:18 +0000)]
Mark the passed in "self" for a block as an object pointer so
that the backend can mark it as the representative pointer for
the block.

rdar://12001329

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164418 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix build errors.
Argyrios Kyrtzidis [Fri, 21 Sep 2012 22:17:13 +0000 (22:17 +0000)]
Fix build errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164417 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[AST importer] Do a correct import of a FunctionProtoType::ExtProtoInfo, don't pass
Argyrios Kyrtzidis [Fri, 21 Sep 2012 22:04:02 +0000 (22:04 +0000)]
[AST importer] Do a correct import of a FunctionProtoType::ExtProtoInfo, don't pass
nodes from the imported ASTContext.

rdar://12348924

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164416 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoobjective-C: when diagnosing deprecated/unavailable usage of
Fariborz Jahanian [Fri, 21 Sep 2012 20:46:37 +0000 (20:46 +0000)]
objective-C: when diagnosing deprecated/unavailable usage of
setter or getter backing a deprecated/unavailable property,
also not location of the property. // rdar://12324295

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164412 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCall CGM.SetLLVMFunctionAttributesForDefinition on thunks so that they get
Rafael Espindola [Fri, 21 Sep 2012 20:39:32 +0000 (20:39 +0000)]
Call CGM.SetLLVMFunctionAttributesForDefinition on thunks so that they get
attributes like uwtable. Without uwtable a stack unwinder would be unable
to go past the thunks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164411 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd four new command line options for MIPS CPU selection:
Simon Atanasyan [Fri, 21 Sep 2012 20:19:32 +0000 (20:19 +0000)]
Add four new command line options for MIPS CPU selection:
-mips32, -mips32r2, -mips64, -mips64r2.

The patch reviewed by Eric Christopher.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164410 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a typo in the PCH internals documentation
Douglas Gregor [Fri, 21 Sep 2012 20:16:09 +0000 (20:16 +0000)]
Fix a typo in the PCH internals documentation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164409 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoExperiment in BodyFarm of structuring AST creation calls in a hierarchy,
Ted Kremenek [Fri, 21 Sep 2012 18:33:56 +0000 (18:33 +0000)]
Experiment in BodyFarm of structuring AST creation calls in a hierarchy,
so that they visually look like an AST dump.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164401 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCreate helper method in BodyFarm for creating simple assignments.
Ted Kremenek [Fri, 21 Sep 2012 18:33:54 +0000 (18:33 +0000)]
Create helper method in BodyFarm for creating simple assignments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164400 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd helper method in BodyFarm to create unary dereferences.
Ted Kremenek [Fri, 21 Sep 2012 18:33:52 +0000 (18:33 +0000)]
Add helper method in BodyFarm to create unary dereferences.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164399 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd helper method to BodyFarm for creating lvalue-to-rvalue conversions.
Ted Kremenek [Fri, 21 Sep 2012 18:13:27 +0000 (18:13 +0000)]
Add helper method to BodyFarm for creating lvalue-to-rvalue conversions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164397 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd helper method to BodyFarm for creatinging integral casts.
Ted Kremenek [Fri, 21 Sep 2012 18:13:23 +0000 (18:13 +0000)]
Add helper method to BodyFarm for creatinging integral casts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164396 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoThread-safety analysis: better handling of unreachable blocks. Fixes a bug
DeLesley Hutchins [Fri, 21 Sep 2012 17:57:00 +0000 (17:57 +0000)]
Thread-safety analysis: better handling of unreachable blocks.  Fixes a bug
where a call to function marked 'noreturn' is followed by unreachable
implicit destructor calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164394 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRe-enable faux-bodies by default.
Ted Kremenek [Fri, 21 Sep 2012 17:55:34 +0000 (17:55 +0000)]
Re-enable faux-bodies by default.

Try this again, now that r164392 is in place.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164393 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse helper method to create DeclRefExprs in BodyFarm, hopefully allevating
Ted Kremenek [Fri, 21 Sep 2012 17:54:35 +0000 (17:54 +0000)]
Use helper method to create DeclRefExprs in BodyFarm, hopefully allevating
them being correctly constructed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164392 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd some structuring comments. No functionality change.
Ted Kremenek [Fri, 21 Sep 2012 17:54:32 +0000 (17:54 +0000)]
Add some structuring comments.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164391 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdate comment.
Chad Rosier [Fri, 21 Sep 2012 17:50:09 +0000 (17:50 +0000)]
Update comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164390 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse MapVectors to make the order we mark virtual functions used by a vtable
Rafael Espindola [Fri, 21 Sep 2012 17:15:24 +0000 (17:15 +0000)]
Use MapVectors to make the order we mark virtual functions used by a vtable
deterministic. Fixes pr13868.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164382 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdate for encapsulating the "construct*AlignmentFromInt" methods.
Bill Wendling [Fri, 21 Sep 2012 16:07:49 +0000 (16:07 +0000)]
Update for encapsulating the "construct*AlignmentFromInt" methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164374 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert r164364, "Flip "faux-bodies" in the analyzer on by default to flush out bugs."
NAKAMURA Takumi [Fri, 21 Sep 2012 12:00:42 +0000 (12:00 +0000)]
Revert r164364, "Flip "faux-bodies" in the analyzer on by default to flush out bugs."

It crashed test/Analysis/Output/blocks.m on some hosts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164368 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMake warnings about uninitialized fields include the field name.
Hans Wennborg [Fri, 21 Sep 2012 08:58:33 +0000 (08:58 +0000)]
Make warnings about uninitialized fields include the field name.

This makes the wording more informative, and consistent with the other
warnings about uninitialized variables.

Also, me and David who reviewed this couldn't figure out why we would
need to do a lookup to get the name of the variable; so just print the
name directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164366 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFlip "faux-bodies" in the analyzer on by default to flush out bugs.
Ted Kremenek [Fri, 21 Sep 2012 06:14:37 +0000 (06:14 +0000)]
Flip "faux-bodies" in the analyzer on by default to flush out bugs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164364 91177308-0d34-0410-b5e6-96231b3b80d8