Commit Graph

111254 Commits

Author SHA1 Message Date
Chandler Carruth 29027b9352 Fix this test which had encoded the typo fixed in r137814.
llvm-svn: 137821
2011-08-17 08:56:14 +00:00
Chandler Carruth e89ca5f7d2 Don't suggest assignment in implausible situation. We still warn, as the
code is very likely to be buggy, but its going to require more
significant changes on the part of the user to correct it in this case.

llvm-svn: 137820
2011-08-17 08:38:11 +00:00
Chandler Carruth ae51ecc57b Introduce a new warning, -Wtop-level-comparison. This warning is
a complement to the warnings we provide in condition expressions. Much
like we warn on conditions such as:

  int x, y;
  ...
  if (x = y) ... // Almost always a typo of '=='

This warning applies the complementary logic to "top-level" statements,
or statements whose value is not consumed or used in some way:

  int x, y;
  ...
  x == y; // Almost always a type for '='

We also mirror the '!=' vs. '|=' logic.

The warning is designed to fire even for overloaded operators for two reasons:

1) Especially in the presence of widespread templates that assume
   operator== and operator!= perform the expected comparison operations,
   it seems unreasonable to suppress warnings on the offchance that
   a user has written a class that abuses these operators, embedding
   side-effects or other magic within them.
2) There is a trivial source modification to silence the warning for
   truly exceptional cases:

     (void)(x == y); // No warning

A (greatly reduced) form of this warning has already caught a number of
bugs in our codebase, so there is precedent for it actually firing. That
said, its currently off by default, but enabled under -Wall.

There are several fixmes left here that I'm working on in follow-up
patches, including de-duplicating warnings from -Wunused, sharing code
with -Wunused's implementation (and creating a nice place to hook
diagnostics on "top-level" statements), and handling cases where a proxy
object with a bool conversion is returned, hiding the operation in the
cleanup AST nodes.

Suggestions for any of this code more than welcome. Also, I'd really
love suggestions for better naming than "top-level".

llvm-svn: 137819
2011-08-17 08:38:04 +00:00
Jordy Rose c1470290c3 Hook up -W[no-]analyzer-incompatible-plugin to new warning, and unbreak buildbot.
llvm-svn: 137816
2011-08-17 06:25:12 +00:00
Jordy Rose 9c09ce48b4 Fix typo.
llvm-svn: 137814
2011-08-17 05:00:56 +00:00
Jordy Rose 075d73bcce [analyzer] Add a warning for an incompatible plugin version.
llvm-svn: 137813
2011-08-17 04:56:03 +00:00
Benjamin Kramer 8b3929d956 Silence compiler warnings by casting object pointers to function pointers via intptr_t.
This is ugly but ISO C++ doesn't allow direct casts.

llvm-svn: 137812
2011-08-17 04:22:25 +00:00
Jordy Rose ae55cf2f90 Don't use BuiltinBug in analyzer plugin example.
llvm-svn: 137811
2011-08-17 03:23:51 +00:00
Bruno Cardoso Lopes be5e987379 Introduce matching patterns for vbroadcast AVX instruction. The idea is to
match splats in the form (splat (scalar_to_vector (load ...))) whenever
the load can be folded. All the logic and instruction emission is
working but because of PR8156, there are no ways to match loads, cause
they can never be folded for splats. Thus, the tests are XFAILed, but
I've tested and exercised all the logic using a relaxed version for
checking the foldable loads, as if the bug was already fixed. This
should work out of the box once PR8156 gets fixed since MayFoldLoad will
work as expected.

llvm-svn: 137810
2011-08-17 02:29:19 +00:00
Bruno Cardoso Lopes 3400825b41 Update test to not use the scalar type to splat from a load
llvm-svn: 137809
2011-08-17 02:29:15 +00:00
Bruno Cardoso Lopes 6d33c7f303 Update comments about vector splat handling in x86
llvm-svn: 137808
2011-08-17 02:29:13 +00:00
Bruno Cardoso Lopes ed786a346e Now that we have a canonical way to handle 256-bit splats:
vinsertf128 $1 + vpermilps $0, remove the old code that used to first
do the splat in a 128-bit vector and then insert it into a larger one.
This is better because the handling code gets simpler and also makes a
better room for the upcoming vbroadcast!

llvm-svn: 137807
2011-08-17 02:29:10 +00:00
Bruno Cardoso Lopes 54cd240d0f Update uwtable vim color!
llvm-svn: 137806
2011-08-17 02:29:07 +00:00
Jordy Rose 9db0719242 [analyzer] Add some documentation for the new analyzer plugin infrastructure.
llvm-svn: 137805
2011-08-17 02:15:41 +00:00
Akira Hatanaka 5360f88355 Add support for ext and ins.
llvm-svn: 137804
2011-08-17 02:05:42 +00:00
NAKAMURA Takumi 203f87ccb1 [MSVC] Fix a warning C4334 "'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)".
llvm-svn: 137803
2011-08-17 01:46:16 +00:00
Jordy Rose 93b86e494d [analyzer] Add basic support for pluggable checkers.
llvm-svn: 137802
2011-08-17 01:30:59 +00:00
Enrico Granata 99f0b8f935 When defining a scripted command, it is possible to provide a docstring and that will be used as the help text for the command
If no docstring is provided, a default help text is created
LLDB will refuse to create scripted commands if the scripting language is anything but Python
Some additional comments in AppleObjCRuntimeV2.cpp to describe the memory layout expected by the dynamic type lookup code

llvm-svn: 137801
2011-08-17 01:30:04 +00:00
NAKAMURA Takumi b3457c9eef CMake: [MSVC] Suppress C4551 'function call missing argument list'.
(void)static_func; it is used as idiom in llvm source tree to suppress "Unused static function" warnings.

llvm-svn: 137800
2011-08-17 01:28:30 +00:00
Francois Pichet 09af8c36d1 Add serialization support for ClassScopeFunctionSpecializationDecl.
llvm-svn: 137799
2011-08-17 01:06:54 +00:00
Jordy Rose 1a3ca9201a Unbork Windows build. Thanks, Francois.
llvm-svn: 137798
2011-08-17 00:59:50 +00:00
Argyrios Kyrtzidis f872dc4c3b [python] Add support for CXType to python bindings.
Patch by Anders Waldenborg!

llvm-svn: 137797
2011-08-17 00:43:03 +00:00
Argyrios Kyrtzidis 6f5bd2f630 [libclang] Make clang_getCursor able to handle locations that point inside macro arguments.
e.g. for:

\define INVOKE(METHOD, CLASS) [CLASS METHOD]

void test2() {
  INVOKE(meth, MyClass);
}

Pointing at 'meth' will give a CXCursor_ObjCMessageExpr and pointing at 'MyClass'
will give a CXCursor_ObjCClassRef.

llvm-svn: 137796
2011-08-17 00:31:25 +00:00
Argyrios Kyrtzidis 161868db4c Make Lexer::GetBeginningOfToken able to handle macro arg expansion locations.
llvm-svn: 137795
2011-08-17 00:31:23 +00:00
Argyrios Kyrtzidis 92a47bd997 Introduce SourceManager::getMacroArgExpandedLocation function.
If we pass it a source location that points inside a function macro argument,
the returned location will be the macro location in which the argument was expanded.
If a macro argument is used multiple times, the expanded location will
be at the first expansion of the argument.
 e.g.
   MY_MACRO(foo);
             ^
Passing a file location pointing at 'foo', will yield a macro location
where 'foo' was expanded into.

Make SourceManager::getLocation call getMacroArgExpandedLocation as well.

llvm-svn: 137794
2011-08-17 00:31:20 +00:00
Argyrios Kyrtzidis ac199bffab Make SourceManager::isBeforeInTranslationUnit handle macro locations correctly.
llvm-svn: 137793
2011-08-17 00:31:18 +00:00
Argyrios Kyrtzidis a1d943a121 [PCH] When writing out ExpansionInfo, make sure we don't lose track if it's a macro arg expansion or not.
llvm-svn: 137792
2011-08-17 00:31:14 +00:00
Jordy Rose a19917da7c Use DynamicLibrary instances as a way to get symbols from a specific library. Preparation for upcoming (preliminary) support for plugins for the static analyzer.
llvm-svn: 137791
2011-08-17 00:29:32 +00:00
Jim Ingham 096675d781 Add "--" before providing the file & command args when launching lldb from the command line.
llvm-svn: 137790
2011-08-17 00:23:09 +00:00
Jim Ingham a9deaf971d Better help string for "lldb -- file arg1 arg2..."
llvm-svn: 137789
2011-08-16 23:57:58 +00:00
Jim Grosbach e9ab47a72a Thumb ADD(immediate) parsing support.
llvm-svn: 137788
2011-08-16 23:57:34 +00:00
Owen Anderson 91a8f9be20 Separate out Thumb1 instructions that need an S bit operand from those that do not, for the purposes of decoding them.
llvm-svn: 137787
2011-08-16 23:45:44 +00:00
Eli Friedman e1df253200 An additional atomic test; related to r137662.
llvm-svn: 137786
2011-08-16 23:29:17 +00:00
Enrico Granata 223383ed6c Changes to Python commands:
- They now have an SBCommandReturnObject instead of an SBStream as third argument
 - The class CommandObjectPythonFunction has been merged into CommandObjectCommands.cpp
 - The command to manage them is now:
  command script with subcommands add, list, delete, clear
   command alias is returned to its previous functionality
 - Python commands are now part of an user dictionary, instead of being seen as aliases
 

llvm-svn: 137785
2011-08-16 23:24:13 +00:00
Jim Ingham 556e653b6a Document how to pass program args to lldb command-line.
llvm-svn: 137784
2011-08-16 23:15:02 +00:00
Greg Clayton 3c503e1347 Bumped Xcode project versions for lldb-73 and debugserver-144.
llvm-svn: 137782
2011-08-16 23:11:03 +00:00
Eli Friedman 55919a9ed7 Extend the undef ^ undef idiom once more. No testcase: I can't figure out how to actually trigger the codepath in question at the moment, but it might get exposed in the future.
llvm-svn: 137781
2011-08-16 22:38:34 +00:00
Chandler Carruth f87d6c00e7 Switch this code to use the more idiomatic 'dyn_cast' pattern.
llvm-svn: 137780
2011-08-16 22:30:10 +00:00
Jim Grosbach b7fa2c0a53 Thumb parsing diagnostics for low-reg requirements on ADD and MOV.
llvm-svn: 137779
2011-08-16 22:20:01 +00:00
Devang Patel eb1bb4e419 Until now all debug info MDNodes referred to a root MDNode, a compile unit. This simplified handling of these needs in dwarf writer. However, one side effect of this is that during link time optimization all these MDNodes are _not_ uniqued. In other words there will be N number of MDNodes describing "int", "char" and all other types, which would suddenly grow when each object file starts using libraries like STL.
MDNodes graph structure such that compiler unit keeps track of important MDNodes and update dwarf writer to process mdnodes top-down instead of bottom up.

llvm-svn: 137778
2011-08-16 22:09:43 +00:00
Eli Friedman 0793eb4c46 A bunch of misc fixes to SCCPSolver::ResolvedUndefsIn, including a fix to stop
making random bad assumptions about instructions which are not explicitly listed.  

Includes fix for rdar://9956541, a version of "undef ^ undef should return
0 because it's easier than arguing with users".

llvm-svn: 137777
2011-08-16 22:06:31 +00:00
Johnny Chen 0241f1441f Add comment about recent change.
llvm-svn: 137776
2011-08-16 22:06:17 +00:00
Eric Christopher d56ba41bc3 Remove tests that have been obsoleted or migrated to clang/optimizer tests.
llvm-svn: 137775
2011-08-16 21:46:25 +00:00
Jim Grosbach 64610e52e7 Add missing exit for 'case'.
llvm-svn: 137774
2011-08-16 21:42:31 +00:00
Eric Christopher 43b1188a71 Migrate test from llvm/test/FrontendC++.
llvm-svn: 137773
2011-08-16 21:41:54 +00:00
Eric Christopher ed78181605 Migrate from llvm/test/FrontendC++ and FileCheckize.
llvm-svn: 137772
2011-08-16 21:41:52 +00:00
Eric Christopher 77214ad172 Migrate from llvm/test/FrontendC++.
llvm-svn: 137771
2011-08-16 21:41:50 +00:00
Eric Christopher 38a7c55cae Migrate test from llvm/test/FrontendC++ and FileCheckize.
llvm-svn: 137770
2011-08-16 21:41:48 +00:00
Eric Christopher 88fa0f0eb7 Migrate test from llvm/test/FrontendC++.
llvm-svn: 137769
2011-08-16 21:41:46 +00:00
Eric Christopher 3f98c99b07 Migrate from llvm/test/FrontendC++.
llvm-svn: 137768
2011-08-16 21:41:44 +00:00