]> granicus.if.org Git - clang/log
clang
13 years agoRemove main() *errors* from warning group.
Ted Kremenek [Thu, 18 Aug 2011 21:20:46 +0000 (21:20 +0000)]
Remove main() *errors* from warning group.

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

13 years agoReapply r137903, but fix the definition of size_t in the test case to use __SIZE_TYPE...
Ted Kremenek [Thu, 18 Aug 2011 20:55:45 +0000 (20:55 +0000)]
Reapply r137903, but fix the definition of size_t in the test case to use __SIZE_TYPE__ (and hence be portable).

Also, change the warning to -Wstrl-incorrect-size.

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

13 years ago[libclang] Support code-completion inside macro arguments.
Argyrios Kyrtzidis [Thu, 18 Aug 2011 19:41:28 +0000 (19:41 +0000)]
[libclang] Support code-completion inside macro arguments.

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

13 years agoTemporarily revert r137925 to appease buildbots. Original commit message:
Chad Rosier [Thu, 18 Aug 2011 19:06:24 +0000 (19:06 +0000)]
Temporarily revert r137925 to appease buildbots. Original commit message:

Teach ModuleManager::addModule() to check whether a particular module
has already been loaded before allocating a new Module structure. If
the module has already been loaded (uniquing based on file name), then
just return the existing module rather than trying to load it again.

This allows us to load a DAG of modules. Introduce a simple test case
that forms a diamond-shaped module graph, and illustrates that a
source file importing the bottom of the diamond can see declarations
in all four of the modules that make up the diamond.

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

13 years agoAdd a test for checking that custom diagnostic visitors are working.
Anna Zaks [Thu, 18 Aug 2011 19:02:46 +0000 (19:02 +0000)]
Add a test for checking that custom diagnostic visitors are working.

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

13 years agoRework DiagnoseInvalidRedeclaration to add the ability to correct typos when
Kaelyn Uhrain [Thu, 18 Aug 2011 18:19:12 +0000 (18:19 +0000)]
Rework DiagnoseInvalidRedeclaration to add the ability to correct typos when
diagnosing invalid function redeclarations.

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

13 years ago[libclang] Annotate correctly macro argument tokens.
Argyrios Kyrtzidis [Thu, 18 Aug 2011 18:03:34 +0000 (18:03 +0000)]
[libclang] Annotate correctly macro argument tokens.

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

13 years agoUse StringRef, rather than C string APIs.
Chad Rosier [Thu, 18 Aug 2011 17:56:32 +0000 (17:56 +0000)]
Use StringRef, rather than C string APIs.

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

13 years agoFixes traversal of class template nodes on template instantiations.
Manuel Klimek [Thu, 18 Aug 2011 16:50:43 +0000 (16:50 +0000)]
Fixes traversal of class template nodes on template instantiations.
Also fixes a spelling error.

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

13 years agoAdd support for MSVC __unaligned attribute. Necessary to parse MSVC headers in 64...
Francois Pichet [Thu, 18 Aug 2011 09:59:55 +0000 (09:59 +0000)]
Add support for MSVC __unaligned attribute. Necessary to parse MSVC headers in 64-bit mode (ie: when _M_IA64 or _M_AMD64 is defined)

more info: http://msdn.microsoft.com/en-us/library/ms177389.aspx

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

13 years agoAlways mark friend function declarations in class templates as
Chandler Carruth [Thu, 18 Aug 2011 09:09:59 +0000 (09:09 +0000)]
Always mark friend function declarations in class templates as
implicitly instantiable, even if we don't see a body on the friend
function declaration. The body may simply have not yet been attached.
This fixes PR10666.

There may be an alternate, preferred implementation strategy, see my
FIXME. Review would definitely be appreciated Doug. =D

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

13 years agoTeach ModuleManager::addModule() to check whether a particular module
Douglas Gregor [Thu, 18 Aug 2011 04:41:58 +0000 (04:41 +0000)]
Teach ModuleManager::addModule() to check whether a particular module
has already been loaded before allocating a new Module structure. If
the module has already been loaded (uniquing based on file name), then
just return the existing module rather than trying to load it again.

This allows us to load a DAG of modules. Introduce a simple test case
that forms a diamond-shaped module graph, and illustrates that a
source file importing the bottom of the diamond can see declarations
in all four of the modules that make up the diamond.

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

13 years agoKeep track of which modules have been loaded directly (e.g., via
Douglas Gregor [Thu, 18 Aug 2011 04:12:04 +0000 (04:12 +0000)]
Keep track of which modules have been loaded directly (e.g., via
-import-module) vs. loaded because some other module depends on
them. As part of doing this, pass down the module that caused a module
to be loaded directly, rather than assuming that we're loading a
chain. Finally, write out all of the directly-loaded modules when
serializing an AST file (using the new IMPORTS record), so that an AST
file can depend on more than one other AST file, all of which will be
loaded when that AST file is loaded. This allows us to form and load a
tree of modules, but we can't yet load a DAG of modules.

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

13 years agoRevert r137903, "Add experimental -Wstrlcpy-size warning that looks to see if the...
Ted Kremenek [Thu, 18 Aug 2011 02:18:02 +0000 (02:18 +0000)]
Revert r137903, "Add experimental -Wstrlcpy-size warning that looks to see if the size argument for strlcpy/strlcat is the size of the *source*, and not the size of the *destination*.  This warning is off by default (for now)."

This currently doesn't work on Windows.

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

13 years agoNo seriously, remove the unsupported warning options.
Chad Rosier [Thu, 18 Aug 2011 02:08:52 +0000 (02:08 +0000)]
No seriously, remove the unsupported warning options.

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

13 years agoFix a regression form r137894. Make sure the custom BugReporterVisitors get registred...
Anna Zaks [Thu, 18 Aug 2011 02:05:18 +0000 (02:05 +0000)]
Fix a regression form r137894. Make sure the custom BugReporterVisitors get registred as they were in EnhancedBugReport. Would be good to add a test for this.

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

13 years agoRemove the last FIXMEs on -Wunused-comparison since it got moved to
Chandler Carruth [Thu, 18 Aug 2011 02:04:29 +0000 (02:04 +0000)]
Remove the last FIXMEs on -Wunused-comparison since it got moved to
entirely use the existing -Wunused-value infrastructure. This also fixes
a few missed cases for -Wunused in general.

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

13 years agoFix off by one.
Chad Rosier [Thu, 18 Aug 2011 01:23:31 +0000 (01:23 +0000)]
Fix off by one.

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

13 years ago[driver] Implement in a more table-like manner and add many more warning options
Chad Rosier [Thu, 18 Aug 2011 01:18:28 +0000 (01:18 +0000)]
[driver] Implement in a more table-like manner and add many more warning options
that aren't handled by llvm-gcc on fallback.
Enhancement to rdar://9964354

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

13 years agoAdd documentation on -Weverything.
Ted Kremenek [Thu, 18 Aug 2011 01:17:05 +0000 (01:17 +0000)]
Add documentation on -Weverything.

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

13 years agoImplement '-Weverything', which enables all warnings except those explicitly mapped...
Ted Kremenek [Thu, 18 Aug 2011 01:12:56 +0000 (01:12 +0000)]
Implement '-Weverything', which enables all warnings except those explicitly mapped to be ignored.

Currently this includes -pedantic warnings as well; we'll need to consider whether these should
be included.

This works as expected with -Werror.

Test cases were added to Sema/warn-unused-parameters.c, but they should probably be broken off into
their own test file.

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

13 years agoFor the MacroExpands preprocessor callback, also pass the SourceRange
Argyrios Kyrtzidis [Thu, 18 Aug 2011 01:05:45 +0000 (01:05 +0000)]
For the MacroExpands preprocessor callback, also pass the SourceRange
of expansion (for function macros it includes the right paren).

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

13 years agoAdd some more options that aren't handled by llvm-gcc on fallback.
Eric Christopher [Thu, 18 Aug 2011 00:26:15 +0000 (00:26 +0000)]
Add some more options that aren't handled by llvm-gcc on fallback.

This is going to be made a table.

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

13 years ago[driver] Don't generate diagnostics (i.e., preprocessed source) if reading
Chad Rosier [Thu, 18 Aug 2011 00:22:25 +0000 (00:22 +0000)]
[driver] Don't generate diagnostics (i.e., preprocessed source) if reading
from stdin.  This allows Eli and the like to continue with their debugging
trickery without loss of limb (or car) on my part. :)

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

13 years ago"-mavx" should also enable all other SSE levels.
Bruno Cardoso Lopes [Thu, 18 Aug 2011 00:07:03 +0000 (00:07 +0000)]
"-mavx" should also enable all other SSE levels.

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

13 years agoDowngrade "err_init_list_variable_narrowing" into a warning in Microsoft mode even...
Francois Pichet [Thu, 18 Aug 2011 00:04:08 +0000 (00:04 +0000)]
Downgrade "err_init_list_variable_narrowing" into a warning in Microsoft mode even if c++0x is enabled. This necessary to parse MSVC code in C++0x mode.

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

13 years agoAdd experimental -Wstrlcpy-size warning that looks to see if the size argument for...
Ted Kremenek [Wed, 17 Aug 2011 23:40:36 +0000 (23:40 +0000)]
Add experimental -Wstrlcpy-size warning that looks to see if the size argument for strlcpy/strlcat is the size of the *source*, and not the size of the *destination*.  This warning is off by default (for now).

Warning logic provided by Geoff Keating.

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

13 years agoAdd more comments for BugReport.
Anna Zaks [Wed, 17 Aug 2011 23:36:16 +0000 (23:36 +0000)]
Add more comments for BugReport.

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

13 years agoRemove DiagBugReport by pulling it into its parent BugReport.
Anna Zaks [Wed, 17 Aug 2011 23:21:23 +0000 (23:21 +0000)]
Remove DiagBugReport by pulling it into its parent BugReport.

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

13 years agoFix else style. No functionality change intended.
Chad Rosier [Wed, 17 Aug 2011 23:08:45 +0000 (23:08 +0000)]
Fix else style.  No functionality change intended.

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

13 years agoRemove EnhancedBugReport and RangedBugReport - pull all the extra functionality they...
Anna Zaks [Wed, 17 Aug 2011 23:00:25 +0000 (23:00 +0000)]
Remove EnhancedBugReport and RangedBugReport - pull all the extra functionality they provided into their parent BugReport. The only functional changes are: made getRanges() non const - it adds default range to Ranges if none are supplied, made getStmt() private, which was another FIXME.

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

13 years agoFix typo.
Eric Christopher [Wed, 17 Aug 2011 22:59:59 +0000 (22:59 +0000)]
Fix typo.

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

13 years ago[libclang] Workaround potential race condition with code completion AllocatedResults...
Ted Kremenek [Wed, 17 Aug 2011 22:19:53 +0000 (22:19 +0000)]
[libclang] Workaround potential race condition with code completion AllocatedResults being freed after a CXTranslationUnit.

The Container USR's CXString had its underlying data owned by the CXTranslationUnit's string pool.  This
would result in trying to access freed memory.

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

13 years agoReorganize the return-type vs. expression checking code in
John McCall [Wed, 17 Aug 2011 22:09:46 +0000 (22:09 +0000)]
Reorganize the return-type vs. expression checking code in
block returns; no functionality change.

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

13 years agoSomehow I fouled up this test.
John McCall [Wed, 17 Aug 2011 22:04:02 +0000 (22:04 +0000)]
Somehow I fouled up this test.

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

13 years agoRemove an unnecessary assignment (to InstFromD).
Argyrios Kyrtzidis [Wed, 17 Aug 2011 21:35:28 +0000 (21:35 +0000)]
Remove an unnecessary assignment (to InstFromD).
Caught by the static analyzer!

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

13 years agoGather cleanups correctly in block return statements.
John McCall [Wed, 17 Aug 2011 21:34:14 +0000 (21:34 +0000)]
Gather cleanups correctly in block return statements.
Thanks to Ted for finding this with magic tools.

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

13 years ago[analyzer] Migrate assumption and binding handling from CFRefCount to RetainReleaseCh...
Jordy Rose [Wed, 17 Aug 2011 21:27:39 +0000 (21:27 +0000)]
[analyzer] Migrate assumption and binding handling from CFRefCount to RetainReleaseChecker. This is mostly a textual move and required no supporting changes. No functionality change intended.

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

13 years agoFix incorrect code indentation and silence dead store warning due to idiomatic code.
Ted Kremenek [Wed, 17 Aug 2011 21:09:35 +0000 (21:09 +0000)]
Fix incorrect code indentation and silence dead store warning due to idiomatic code.

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

13 years agoIn the AST file format, eliminate the CHAINED_METADATA record. Instead,
Douglas Gregor [Wed, 17 Aug 2011 21:07:30 +0000 (21:07 +0000)]
In the AST file format, eliminate the CHAINED_METADATA record. Instead,
all AST files have a normal METADATA record that has the same form
regardless of whether we refer to a chained PCH or any other kind of
AST file.

Introduce the IMPORTS record, which describes all of the AST files
that are imported by this AST file, and how (as a module, a PCH file,
etc.). Currently, we emit at most one entry to this record, to support
chained PCH.

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

13 years agoFix a handful of dead stores found by Clang's static analyzer. There's a bunch of...
Ted Kremenek [Wed, 17 Aug 2011 21:04:19 +0000 (21:04 +0000)]
Fix a handful of dead stores found by Clang's static analyzer.  There's a bunch of others I haven't touched.

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

13 years agoAdd a bit more comments to the BugReporter and friends.
Anna Zaks [Wed, 17 Aug 2011 20:25:08 +0000 (20:25 +0000)]
Add a bit more comments to the BugReporter and friends.

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

13 years ago[libclang] Implicit objc methods are skipped, no need to check isSynthesized.
Argyrios Kyrtzidis [Wed, 17 Aug 2011 20:15:55 +0000 (20:15 +0000)]
[libclang] Implicit objc methods are skipped, no need to check isSynthesized.

Plus, isSynthesized returning true does not mean that there is not a user-declared method declaration.

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

13 years agoMark objc methods that are implicitly declared for properties (not user-declared...
Argyrios Kyrtzidis [Wed, 17 Aug 2011 19:25:08 +0000 (19:25 +0000)]
Mark objc methods that are implicitly declared for properties (not user-declared) as implicit.
This results in libclang ignoring such methods.

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

13 years agoFix -ferror-limit= to properly emit notes following the last error
Douglas Gregor [Wed, 17 Aug 2011 19:13:00 +0000 (19:13 +0000)]
Fix -ferror-limit= to properly emit notes following the last error
messages. Fi from David Blaikie, tests from Nikola Smiljanic!

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

13 years agoFix iterator end for r137842.
Chad Rosier [Wed, 17 Aug 2011 18:51:56 +0000 (18:51 +0000)]
Fix iterator end for r137842.

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

13 years ago[driver] Clang doesn't support -mkernel/-fapple-kext for i386, so it's
Chad Rosier [Wed, 17 Aug 2011 18:24:55 +0000 (18:24 +0000)]
[driver] Clang doesn't support -mkernel/-fapple-kext for i386, so it's
automatically invoking llvm-gcc's cc1plus, which doesn't support all options
supported by Clang.  Therefore, filter out unsupported options.
rdar://9964354

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

13 years agoAdd additional path to Linux toolchain. Patch by Will Dietz. PR10690.
Eli Friedman [Wed, 17 Aug 2011 18:17:26 +0000 (18:17 +0000)]
Add additional path to Linux toolchain.  Patch by Will Dietz.  PR10690.

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

13 years agoAdd Gentoo gcc 4.3.4 include paths
Nico Weber [Wed, 17 Aug 2011 17:55:30 +0000 (17:55 +0000)]
Add Gentoo gcc 4.3.4 include paths

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

13 years ago[python] Fix bug of the SourceLocation binding.
Argyrios Kyrtzidis [Wed, 17 Aug 2011 17:20:24 +0000 (17:20 +0000)]
[python] Fix bug of the SourceLocation binding.
Patch by Anders Waldenborg!

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

13 years ago[python] Add test_type.py by Anders Waldenborg, which I forgot to commit in r137797.
Argyrios Kyrtzidis [Wed, 17 Aug 2011 17:01:10 +0000 (17:01 +0000)]
[python] Add test_type.py by Anders Waldenborg, which I forgot to commit in r137797.

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

13 years agoWhitelist operator== and operator!= as valid for unused value warnings,
Chandler Carruth [Wed, 17 Aug 2011 09:49:44 +0000 (09:49 +0000)]
Whitelist operator== and operator!= as valid for unused value warnings,
even when overloaded and user-defined. These operators are both more
valuable to warn on (due to likely typos) and extremely unlikely to be
reasonable for use to trigger side-effects.

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

13 years agoTreating the unused equality comparisons as something other than part of
Chandler Carruth [Wed, 17 Aug 2011 09:34:37 +0000 (09:34 +0000)]
Treating the unused equality comparisons as something other than part of
-Wunused was a mistake. It resulted in duplicate warnings and lots of
other hacks. Instead, this should be a special sub-category to
-Wunused-value, much like -Wunused-result is.

Moved to -Wunused-comparison, moved the implementation to piggy back on
the -Wunused-value implementation instead of rolling its own, different
mechanism for catching all of the "interesting" statements.

I like the unused-value mechanism for this better, but its currently
missing several top-level statements. For now, I've FIXME-ed out those
test cases. I'll enhance the generic infrastructure to catch these
statements in a subsequent patch.

This patch also removes the cast-to-void fixit hint. This hint isn't
available on any of the other -Wunused-value diagnostics, and if we want
it to be, we should add it generically rather than in one specific case.

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

13 years agoFix this test which had encoded the typo fixed in r137814.
Chandler Carruth [Wed, 17 Aug 2011 08:56:14 +0000 (08:56 +0000)]
Fix this test which had encoded the typo fixed in r137814.

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

13 years agoDon't suggest assignment in implausible situation. We still warn, as the
Chandler Carruth [Wed, 17 Aug 2011 08:38:11 +0000 (08:38 +0000)]
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.

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

13 years agoIntroduce a new warning, -Wtop-level-comparison. This warning is
Chandler Carruth [Wed, 17 Aug 2011 08:38:04 +0000 (08:38 +0000)]
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".

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

13 years agoHook up -W[no-]analyzer-incompatible-plugin to new warning, and unbreak buildbot.
Jordy Rose [Wed, 17 Aug 2011 06:25:12 +0000 (06:25 +0000)]
Hook up -W[no-]analyzer-incompatible-plugin to new warning, and unbreak buildbot.

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

13 years agoFix typo.
Jordy Rose [Wed, 17 Aug 2011 05:00:56 +0000 (05:00 +0000)]
Fix typo.

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

13 years ago[analyzer] Add a warning for an incompatible plugin version.
Jordy Rose [Wed, 17 Aug 2011 04:56:03 +0000 (04:56 +0000)]
[analyzer] Add a warning for an incompatible plugin version.

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

13 years agoSilence compiler warnings by casting object pointers to function pointers via intptr_t.
Benjamin Kramer [Wed, 17 Aug 2011 04:22:25 +0000 (04:22 +0000)]
Silence compiler warnings by casting object pointers to function pointers via intptr_t.

This is ugly but ISO C++ doesn't allow direct casts.

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

13 years agoDon't use BuiltinBug in analyzer plugin example.
Jordy Rose [Wed, 17 Aug 2011 03:23:51 +0000 (03:23 +0000)]
Don't use BuiltinBug in analyzer plugin example.

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

13 years ago[analyzer] Add some documentation for the new analyzer plugin infrastructure.
Jordy Rose [Wed, 17 Aug 2011 02:15:41 +0000 (02:15 +0000)]
[analyzer] Add some documentation for the new analyzer plugin infrastructure.

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

13 years ago[MSVC] Fix a warning C4334 "'operator' : result of 32-bit shift implicitly converted...
NAKAMURA Takumi [Wed, 17 Aug 2011 01:46:16 +0000 (01:46 +0000)]
[MSVC] Fix a warning C4334 "'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)".

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

13 years ago[analyzer] Add basic support for pluggable checkers.
Jordy Rose [Wed, 17 Aug 2011 01:30:59 +0000 (01:30 +0000)]
[analyzer] Add basic support for pluggable checkers.

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

13 years agoAdd serialization support for ClassScopeFunctionSpecializationDecl.
Francois Pichet [Wed, 17 Aug 2011 01:06:54 +0000 (01:06 +0000)]
Add serialization support for ClassScopeFunctionSpecializationDecl.

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

13 years ago[python] Add support for CXType to python bindings.
Argyrios Kyrtzidis [Wed, 17 Aug 2011 00:43:03 +0000 (00:43 +0000)]
[python] Add support for CXType to python bindings.
Patch by Anders Waldenborg!

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

13 years ago[libclang] Make clang_getCursor able to handle locations that point inside macro...
Argyrios Kyrtzidis [Wed, 17 Aug 2011 00:31:25 +0000 (00:31 +0000)]
[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.

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

13 years agoMake Lexer::GetBeginningOfToken able to handle macro arg expansion locations.
Argyrios Kyrtzidis [Wed, 17 Aug 2011 00:31:23 +0000 (00:31 +0000)]
Make Lexer::GetBeginningOfToken able to handle macro arg expansion locations.

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

13 years agoIntroduce SourceManager::getMacroArgExpandedLocation function.
Argyrios Kyrtzidis [Wed, 17 Aug 2011 00:31:20 +0000 (00:31 +0000)]
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.

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

13 years agoMake SourceManager::isBeforeInTranslationUnit handle macro locations correctly.
Argyrios Kyrtzidis [Wed, 17 Aug 2011 00:31:18 +0000 (00:31 +0000)]
Make SourceManager::isBeforeInTranslationUnit handle macro locations correctly.

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

13 years ago[PCH] When writing out ExpansionInfo, make sure we don't lose track if it's a macro...
Argyrios Kyrtzidis [Wed, 17 Aug 2011 00:31:14 +0000 (00:31 +0000)]
[PCH] When writing out ExpansionInfo, make sure we don't lose track if it's a macro arg expansion or not.

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

13 years agoSwitch this code to use the more idiomatic 'dyn_cast' pattern.
Chandler Carruth [Tue, 16 Aug 2011 22:30:10 +0000 (22:30 +0000)]
Switch this code to use the more idiomatic 'dyn_cast' pattern.

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

13 years agoMigrate test from llvm/test/FrontendC++.
Eric Christopher [Tue, 16 Aug 2011 21:41:54 +0000 (21:41 +0000)]
Migrate test from llvm/test/FrontendC++.

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

13 years agoMigrate from llvm/test/FrontendC++ and FileCheckize.
Eric Christopher [Tue, 16 Aug 2011 21:41:52 +0000 (21:41 +0000)]
Migrate from llvm/test/FrontendC++ and FileCheckize.

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

13 years agoMigrate from llvm/test/FrontendC++.
Eric Christopher [Tue, 16 Aug 2011 21:41:50 +0000 (21:41 +0000)]
Migrate from llvm/test/FrontendC++.

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

13 years agoMigrate test from llvm/test/FrontendC++ and FileCheckize.
Eric Christopher [Tue, 16 Aug 2011 21:41:48 +0000 (21:41 +0000)]
Migrate test from llvm/test/FrontendC++ and FileCheckize.

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

13 years agoMigrate test from llvm/test/FrontendC++.
Eric Christopher [Tue, 16 Aug 2011 21:41:46 +0000 (21:41 +0000)]
Migrate test from llvm/test/FrontendC++.

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

13 years agoMigrate from llvm/test/FrontendC++.
Eric Christopher [Tue, 16 Aug 2011 21:41:44 +0000 (21:41 +0000)]
Migrate from llvm/test/FrontendC++.

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

13 years agoMigrate from llvm/test/FrontendC++.
Eric Christopher [Tue, 16 Aug 2011 21:41:41 +0000 (21:41 +0000)]
Migrate from llvm/test/FrontendC++.

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

13 years agoMigrate test from llvm/test/FrontendC++.
Eric Christopher [Tue, 16 Aug 2011 21:41:40 +0000 (21:41 +0000)]
Migrate test from llvm/test/FrontendC++.

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

13 years agoMigrate from llvm/test/FrontendC++.
Eric Christopher [Tue, 16 Aug 2011 21:41:38 +0000 (21:41 +0000)]
Migrate from llvm/test/FrontendC++.

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

13 years agoMigrate varargs.cpp from llvm/test/FrontendC++.
Eric Christopher [Tue, 16 Aug 2011 21:41:35 +0000 (21:41 +0000)]
Migrate varargs.cpp from llvm/test/FrontendC++.

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

13 years agoMigrate weak-external.cpp from llvm/test/FrontendC++.
Eric Christopher [Tue, 16 Aug 2011 21:41:33 +0000 (21:41 +0000)]
Migrate weak-external.cpp from llvm/test/FrontendC++.

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

13 years agoMigrate x86-64-abi-sret-vs-2word-struct-param.cpp from
Eric Christopher [Tue, 16 Aug 2011 21:41:31 +0000 (21:41 +0000)]
Migrate x86-64-abi-sret-vs-2word-struct-param.cpp from
llvm/test/FrontendC++ and FileCheckize.

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

13 years agoMigrate thunk-linkonce-odr.cpp from llvm/test/FrontendC++.
Eric Christopher [Tue, 16 Aug 2011 21:41:26 +0000 (21:41 +0000)]
Migrate thunk-linkonce-odr.cpp from llvm/test/FrontendC++.

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

13 years ago[analyzer] teach ExprEngine about loads from static C++ class fields. Fixes <rdar...
Ted Kremenek [Tue, 16 Aug 2011 21:37:52 +0000 (21:37 +0000)]
[analyzer] teach ExprEngine about loads from static C++ class fields.  Fixes <rdar://problem/9948787>.

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

13 years ago[analyzer] Overhaul of checker registration in preparation for basic plugin support...
Jordy Rose [Tue, 16 Aug 2011 21:24:21 +0000 (21:24 +0000)]
[analyzer] Overhaul of checker registration in preparation for basic plugin support. Removes support for checker groups (we can add them back in later if we decide they are still useful), and -analyzer-checker-help output is a little worse for the time being (no packages).

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

13 years agoRobustify test, there is no need to check metadata number which can change.
Devang Patel [Tue, 16 Aug 2011 21:01:06 +0000 (21:01 +0000)]
Robustify test, there is no need to check metadata number which can change.

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

13 years agoFinalize debug info after all deferred globals are emitted.
Devang Patel [Tue, 16 Aug 2011 20:58:22 +0000 (20:58 +0000)]
Finalize debug info after all deferred globals are emitted.

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

13 years agoMacOSKeychainAPIChecker: Turn it on by default.
Anna Zaks [Tue, 16 Aug 2011 20:02:05 +0000 (20:02 +0000)]
MacOSKeychainAPIChecker: Turn it on by default.

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

13 years agoUpdate createMCAsmParser() to match r137735.
Jim Grosbach [Tue, 16 Aug 2011 18:33:55 +0000 (18:33 +0000)]
Update createMCAsmParser() to match r137735.

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

13 years agoMacOSKeychainAPIChecker: Do not report double allocation if first allocation returned...
Anna Zaks [Tue, 16 Aug 2011 16:30:24 +0000 (16:30 +0000)]
MacOSKeychainAPIChecker: Do not report double allocation if first allocation returned an error.

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

13 years ago[analyzer] Enhance ConditionVisitor to handle arbitrary ValueDecls in binary expressi...
Ted Kremenek [Tue, 16 Aug 2011 10:57:37 +0000 (10:57 +0000)]
[analyzer] Enhance ConditionVisitor to handle arbitrary ValueDecls in binary expressions, and also handle inverting the order of comparison when the named decl appears on the RHS.

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

13 years agoCMake: "clang-test" may not depend on check.deps.
NAKAMURA Takumi [Tue, 16 Aug 2011 03:45:31 +0000 (03:45 +0000)]
CMake: "clang-test" may not depend on check.deps.

...I believe it would not break anything...

FIXME: "check-all" may not be generated w/o LLVM_INCLUDE_TESTS.

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

13 years ago[analyzer] fix operation inversion calculation in ConditionVisitor.
Ted Kremenek [Tue, 16 Aug 2011 03:44:38 +0000 (03:44 +0000)]
[analyzer] fix operation inversion calculation in ConditionVisitor.

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

13 years ago[analyzer] Enhance ConditionVisitor to understand eagerly evaluated (simple) binary...
Ted Kremenek [Tue, 16 Aug 2011 01:53:41 +0000 (01:53 +0000)]
[analyzer] Enhance ConditionVisitor to understand eagerly evaluated (simple) binary conditions, and teach it to only focus on constraint changes.

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

13 years ago[analyzer] add ExprEngine::getEagerlyAssumedTags() to allow externally querying of...
Ted Kremenek [Tue, 16 Aug 2011 01:53:39 +0000 (01:53 +0000)]
[analyzer] add ExprEngine::getEagerlyAssumedTags() to allow externally querying of "eagerly assumed" expressions.

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

13 years ago[analyzer] Remove PostStmtCustom ProgramPoint. It can be represented using tagged...
Ted Kremenek [Tue, 16 Aug 2011 00:49:19 +0000 (00:49 +0000)]
[analyzer] Remove PostStmtCustom ProgramPoint.  It can be represented using tagged PostStmts.

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

13 years agoFix tests for non-darwin hosts.
Argyrios Kyrtzidis [Mon, 15 Aug 2011 23:43:33 +0000 (23:43 +0000)]
Fix tests for non-darwin hosts.

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

13 years agoMove test from llvm/test/FrontendCXX and update.
Eric Christopher [Mon, 15 Aug 2011 23:24:31 +0000 (23:24 +0000)]
Move test from llvm/test/FrontendCXX and update.

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