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

34035 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek ce506ae231 Tighten format string diagnostic and make it a bit clearer (and a bit closer to GCC's).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148579 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 21:52:58 +00:00
David Blaikie 3026348bd4 More dead code removal (using -Wunreachable-code)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148577 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 21:50:17 +00:00
Ted Kremenek 18932a0f2a Add ability to specifiy 'restrict' on parameters of builtins, and correct this oversight for scanf functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148573 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 21:40:12 +00:00
Ted Kremenek 3eaaa99c7e Per PR 11814, use Monospace instead of Andale Mono.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148567 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 20:39:55 +00:00
Anna Zaks 02019f7134 [analyzer] Add taint awareness to DivZeroChecker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148566 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 20:28:31 +00:00
Fariborz Jahanian 86f960143c arc migrator: replace "retain" attribute with "strong"
which have same semantics in mrr as well as arr.
// rdar://10688312


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148559 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 19:15:02 +00:00
Anna Zaks afb51afd98 [analyzer] Tweak the buildbot script to include the experimental taint checker and correct the checker enabling setting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148558 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 19:10:59 +00:00
Kostya Serebryany c891666f47 use llvm:Attributes instead of unsigned
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148554 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 17:57:16 +00:00
Argyrios Kyrtzidis d9806c912a Enhance Lexer::makeFileCharRange to check for ranges inside a macro argument
expansion, in which case it returns a file range in the location where the
argument was spelled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148551 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 16:52:43 +00:00
Benjamin Kramer 74fe66181d Replace a dubious use of SmallVectorImpl with a proper copy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148549 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 16:39:18 +00:00
Douglas Gregor eabcf7e1d4 Fix broken unit test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148547 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 16:33:00 +00:00
Douglas Gregor 1f6b2b5c82 Extract the (InputKind, std::string) pair used to describe inputs to
the front end into its own class, FrontendInputFile, to make it easier
to introduce new per-input data. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148546 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 16:28:04 +00:00
Benjamin Kramer b7ff74a676 Localize variable, remove unused assignment.
Found by the clang static analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148544 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 14:57:34 +00:00
Benjamin Kramer dc370c1e70 Remove unused variables.
Found by clang's own static analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148542 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 14:42:32 +00:00
Ted Kremenek a8180e5a87 Reenable DeadStoresChecker under --analyze, and move the IdempotentOperationsChecker to the 'experimental' category. Fixes <rdar://problem/10146347>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148533 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 06:00:17 +00:00
Ted Kremenek b63d8d8f7b Implement checker that looks for calls to mktemps and friends that have fewer than 6 Xs. Implements <rdar://problem/6336672>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148531 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 05:35:06 +00:00
Ted Kremenek 76a54246db Turn 'SecuritySyntaxChecker' into a "meta" security checker for insecure APIs. Now
multiple checks are exposed as separate checkers, but CheckerManager only creates
one Checker object.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148525 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 01:44:29 +00:00
Argyrios Kyrtzidis 0b28928a71 [libclang] Fix crash when indexing attributes, rdar://10702250.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148524 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 01:38:51 +00:00
Eli Friedman ef331b783b Remove PotentiallyPotentiallyEvaluated, and replace it with a much simpler and less error-prone way of handling the relevant cases. Towards marking of whether a declaration is used more accurately.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148522 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 01:26:23 +00:00
Anna Zaks 2bf8fd8408 [analyzer] Add socket API as a source of taint.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148518 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 00:11:19 +00:00
Anna Zaks be97b7edb1 [analyzer] Skip casts when determining taint dependencies + pretty
printing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148517 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 00:11:16 +00:00
Anna Zaks 461af1e502 [analyzer] Add a utility method that allows to find the macro name used
at the given location. 

This could be useful when checkers' logic depends on whether a function
is called with a given macro argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148516 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 00:11:12 +00:00
Anna Zaks 3352ea9146 [analyzer] Cleanup of Symbol dump methods.
This solves a the issue of crashing gdb when dumping a symbol; +
consistent vitualization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148515 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 00:11:08 +00:00
Anna Zaks 315ff366e4 [analyzer] www: A minor cleanup to the dev manual.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148514 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 00:11:04 +00:00
Richard Smith eb96af8a90 Further testing for instantiation of out-of-line constexpr static data member
template definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148506 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 22:50:02 +00:00
Richard Smith 796c1a1e3e An instantiation of a constexpr static data member in a class template is
constexpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148505 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 22:46:17 +00:00
Richard Trieu fcaf27e185 Extend the error of invalid token after declarations to include fixits for
!=, %=, ^=, &=, *=, -=, |=, /=, <<=, <=, >=, and >>= to =.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148499 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 22:01:51 +00:00
Benjamin Kramer 65eccf007d Silence set-but-unused warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148496 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 21:12:23 +00:00
Argyrios Kyrtzidis e64d903765 Introduce Lexer::getSourceText() that returns a string for the source
that the given source range encompasses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148481 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 15:59:19 +00:00
Argyrios Kyrtzidis 11b652d41d Introduce Lexer::makeFileCharRange() that accepts a token source range
and returns a character range with file locations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148480 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 15:59:14 +00:00
Argyrios Kyrtzidis 69bda4c027 For Lexer's isAt[Start/End]OfMacroExpansion add an out parameter for the macro
start/end location.

It is commonly needed after calling the function; with this way we avoid
recalculating it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148479 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 15:59:08 +00:00
Argyrios Kyrtzidis 19d5aea478 Add unit testing for Lexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148478 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 15:59:01 +00:00
Evgeniy Stepanov f5f18bfde0 Extend unwind.h with the ARM unwinder interface.
These declarations come from the sample code in the
"Exception Handling ABI for the ARM Architecture" document.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148469 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 11:39:05 +00:00
Tanya Lattner b0f9dd22bf A few style changes.
Change CheckVectorLogicalOperands to pass params by ref.
Add another test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148452 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 01:16:16 +00:00
Kaelyn Uhrain bcdd7d9288 Remove the now-unused CorrectTypoContext enum.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148441 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 00:33:34 +00:00
Richard Smith 8ef7b20333 constexpr: converted constant expression handling for enumerator values, case
values and non-type template arguments of integral and enumeration types.

This change causes some legal C++98 code to no longer compile in C++11 mode, by
enforcing the C++11 rule that narrowing integral conversions are not permitted
in the final implicit conversion sequence for the above cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148439 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 23:55:52 +00:00
Richard Trieu d6c7c67313 Change the error when a '+=' follows a declaration to suggest a fixit to '=' instead of just suggesting a ';'.
Old error:
plusequaldeclare1.cc:3:8: error: expected ';' at end of declaration
  int x += 6;
       ^
       ;

New error:
plusequaldeclare1.cc:3:9: error: invalid '+=' at end of declaration; did you
      mean '='?
  int x += 6;
        ^~
        =



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148433 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 22:54:52 +00:00
Fariborz Jahanian 8e87490124 Use -Wdeprecated-objc-isa-usage for option to issue
deprecated usage of 'isa'. // rdar://8290002


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148430 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 22:18:30 +00:00
Kaelyn Uhrain 43e875d261 Convert SemaDecl.cpp to pass callback objects to CorrectTypo.
Includes tests highlighting the cases where accuracy has improved
(there is one call that does no filtering beyond selecting the set
of allowed keywords, and one call that only triggers for ObjC code
for which a test by someone who knows ObjC would be welcome). Also
fixes a small typo in one of the suggestion messages, and drops a
malformed "expected-note" for a suggestion that did not occur even
when the malformed note was committed as r145930.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148420 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 21:41:41 +00:00
Douglas Gregor 057df20b31 Optimize unqualified/global name lookup in modules by introducing a
generational scheme for identifiers that avoids searching the hash
tables of a given module more than once for a given
identifier. Previously, loading any new module invalidated all of the
previous lookup results for all identifiers, causing us to perform the
lookups repeatedly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148412 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 20:56:22 +00:00
Anna Zaks c2a8d6cee0 Refactor: Pull getImmediateMacroName() out of DiagnosticRenderer and
into Lexer and Preprocessor; making it widely available.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148410 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 20:17:16 +00:00
Fariborz Jahanian 556b1d0f3a objc: deprecate direct usage of 'isa' of objc objects
in favor of usage of api's intended for.
// rdar://8290002


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148404 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 19:08:56 +00:00
Douglas Gregor 64554ba9fc In the driver, -fmodules enables modules for C/Objective-C but one
also needs -fcxx-modules to enable modules for C++/Objective-C++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148393 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 15:19:58 +00:00
Seth Cantrell 7748cbc97f Add and update tests for character literals
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148392 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 12:27:10 +00:00
Seth Cantrell 5393e213f1 stop claiming unicode escape sequences are too long in strings, because they never are
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148391 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 12:27:08 +00:00
Seth Cantrell 79f0a8262b Fix char literal types in C
L'x' is actually wchar_t

support C11 u and U char literals

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148390 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 12:27:06 +00:00
Seth Cantrell be77352623 Improves support for Unicode in character literals
Updates ProcessUCNExcape() for C++. C++11 allows UCNs in character
and string literals that represent control characters and basic
source characters. Also C++03 allows UCNs that refer to surrogate
codepoints.

UTF-8 sequences in character literals are now handled as single
c-chars.

Added error for multiple characters in Unicode character literals.

Added errors for when a the execution charset encoding of a c-char
cannot be represented as a single code unit in the associated
character type. Note that for the purposes of this error the asso-
ciated character type for a narrow character literal is char, not
int, even though in C narrow character literals have type int.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148389 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 12:27:04 +00:00
Seth Cantrell 7d6a7c0043 test svn commit access
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148388 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 12:11:32 +00:00
Kaelyn Uhrain 4798f8dfdb Convert DiagnoseEmptyLookup to use correction callbacks.
No new unit tests yet as there is no behavioral change
(except for slightly more specific filtering in
Sema::ActOnStartOfLambdaDefinition). Tests will be added
as the code paths are traced in greater depth to determine
how to improve the results--there are at least one or two
known bugs that require those improvements. This commit
lays the groundwork for those changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148382 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 05:58:54 +00:00
Richard Smith 4c3fc9b38d Move narrowing conversion detection code from SemaInit to SemaOverload, ready
for it to be used in converted constant expression checking, and fix a couple
of issues:
 - Conversion operators implicitly invoked prior to the narrowing conversion
   were not being correctly handled when determining whether a constant value
   was narrowed.
 - For conversions from floating-point to integral types, the diagnostic text
   incorrectly always claimed that the source expression was not a constant
   expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148381 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 05:21:49 +00:00