Commit Graph

31894 Commits

Author SHA1 Message Date
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
Jordy Rose 9db0719242 [analyzer] Add some documentation for the new analyzer plugin infrastructure.
llvm-svn: 137805
2011-08-17 02:15:41 +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
Francois Pichet 09af8c36d1 Add serialization support for ClassScopeFunctionSpecializationDecl.
llvm-svn: 137799
2011-08-17 01:06:54 +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
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
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
Eric Christopher 82da54d872 Migrate from llvm/test/FrontendC++.
llvm-svn: 137767
2011-08-16 21:41:41 +00:00
Eric Christopher 2e4877fcb2 Migrate test from llvm/test/FrontendC++.
llvm-svn: 137766
2011-08-16 21:41:40 +00:00
Eric Christopher f1b912b88e Migrate from llvm/test/FrontendC++.
llvm-svn: 137765
2011-08-16 21:41:38 +00:00
Eric Christopher 74733d2e12 Migrate varargs.cpp from llvm/test/FrontendC++.
llvm-svn: 137764
2011-08-16 21:41:35 +00:00
Eric Christopher 9eeae42a6e Migrate weak-external.cpp from llvm/test/FrontendC++.
llvm-svn: 137763
2011-08-16 21:41:33 +00:00
Eric Christopher 148bdfa58a Migrate x86-64-abi-sret-vs-2word-struct-param.cpp from
llvm/test/FrontendC++ and FileCheckize.

llvm-svn: 137762
2011-08-16 21:41:31 +00:00
Eric Christopher 8a24ed567c Migrate thunk-linkonce-odr.cpp from llvm/test/FrontendC++.
llvm-svn: 137761
2011-08-16 21:41:26 +00:00
Ted Kremenek e1962328f5 [analyzer] teach ExprEngine about loads from static C++ class fields. Fixes <rdar://problem/9948787>.
llvm-svn: 137760
2011-08-16 21:37:52 +00:00
Jordy Rose 59cce71af6 [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).
llvm-svn: 137758
2011-08-16 21:24:21 +00:00
Devang Patel 0e3a9f645b Robustify test, there is no need to check metadata number which can change.
llvm-svn: 137752
2011-08-16 21:01:06 +00:00
Devang Patel ffa30ab216 Finalize debug info after all deferred globals are emitted.
llvm-svn: 137750
2011-08-16 20:58:22 +00:00
Anna Zaks a06421a02c MacOSKeychainAPIChecker: Turn it on by default.
llvm-svn: 137740
2011-08-16 20:02:05 +00:00
Jim Grosbach acb07b599c Update createMCAsmParser() to match r137735.
llvm-svn: 137736
2011-08-16 18:33:55 +00:00
Anna Zaks 01ae1e1197 MacOSKeychainAPIChecker: Do not report double allocation if first allocation returned an error.
llvm-svn: 137720
2011-08-16 16:30:24 +00:00
Ted Kremenek 31fdb61618 [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.
llvm-svn: 137714
2011-08-16 10:57:37 +00:00
NAKAMURA Takumi f665ce60c2 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.
llvm-svn: 137709
2011-08-16 03:45:31 +00:00
Ted Kremenek 01401a54f8 [analyzer] fix operation inversion calculation in ConditionVisitor.
llvm-svn: 137708
2011-08-16 03:44:38 +00:00
Ted Kremenek 667417ef9c [analyzer] Enhance ConditionVisitor to understand eagerly evaluated (simple) binary conditions, and teach it to only focus on constraint changes.
llvm-svn: 137705
2011-08-16 01:53:41 +00:00
Ted Kremenek b1bf2680f5 [analyzer] add ExprEngine::getEagerlyAssumedTags() to allow externally querying of "eagerly assumed" expressions.
llvm-svn: 137704
2011-08-16 01:53:39 +00:00
Ted Kremenek 9815709cd2 [analyzer] Remove PostStmtCustom ProgramPoint. It can be represented using tagged PostStmts.
llvm-svn: 137697
2011-08-16 00:49:19 +00:00
Argyrios Kyrtzidis e593e7fe6f Fix tests for non-darwin hosts.
llvm-svn: 137688
2011-08-15 23:43:33 +00:00
Eric Christopher d4737be322 Move test from llvm/test/FrontendCXX and update.
llvm-svn: 137682
2011-08-15 23:24:31 +00:00
Anna Zaks 5443a6497b MacOSKeychainAPIChecker: The security API/memory leak checker should always generate regular nodes instead of sink nodes.
llvm-svn: 137681
2011-08-15 23:23:15 +00:00
Ted Kremenek 32b9e234fe Add ProgramState.cpp.
llvm-svn: 137677
2011-08-15 23:05:22 +00:00
Ted Kremenek cb8473643b Add missing header files.
llvm-svn: 137676
2011-08-15 23:03:51 +00:00
Devang Patel e24d324762 Use new DIBuilder::finalize() at the end to wrap up debug info encoding for a translation unit.
llvm-svn: 137674
2011-08-15 23:01:55 +00:00
Eric Christopher d9afc5c749 FileCheckize this test.
llvm-svn: 137671
2011-08-15 22:48:14 +00:00
Argyrios Kyrtzidis 2c7f4f133f [libclang] Require explicit cursor visitation for all TypeLocs (compilation will
fail if a TypeLoc kind is not handled) and handle DecltypeTypeLoc and InjectedClassNameTypeLoc.

llvm-svn: 137670
2011-08-15 22:40:24 +00:00
Eric Christopher bf005ecd9c 'pure' and 'const' functions should also be marked nounwind. Migrate
test over from llvm/test/FrontendC++ and update others to account for
the change.

llvm-svn: 137669
2011-08-15 22:38:22 +00:00
Ted Kremenek faaef9e334 Take 2 (take 3?) at removing derelict clang.xcodeproj. All Xcode users should be using CMake, as the clang.xcodeproj is never up-to-date and cannot actually build Clang.
llvm-svn: 137666
2011-08-15 22:10:47 +00:00
Ted Kremenek 001fd5b498 Rename GRState to ProgramState, and cleanup some code formatting along the way.
llvm-svn: 137665
2011-08-15 22:09:50 +00:00
Argyrios Kyrtzidis 5ef35b7ce2 Fix the buildbot test.
llvm-svn: 137660
2011-08-15 21:45:01 +00:00
Richard Smith a77a0a6bf2 Track in the AST whether a function is constexpr.
llvm-svn: 137653
2011-08-15 21:04:07 +00:00
Bob Wilson 11403367c0 Make -findirect-virtual-calls and -fterminated-vtables aliases of -fapple-kext.
Outside the driver, they were already treated that way, but the driver was not
giving them the same special treatment as -fapple-kext, e.g., falling back to
llvm-gcc for i386/Darwin kexts.  Radar 9868422.

llvm-svn: 137639
2011-08-15 19:13:06 +00:00
Bob Wilson 08b3756633 Remove duplicate option.
llvm-svn: 137638
2011-08-15 19:13:02 +00:00
Argyrios Kyrtzidis 48ff9a0bd5 [libclang] Handle AttributedTypeLoc for cursor visitation. Fixes rdar://9535717.
llvm-svn: 137634
2011-08-15 18:44:43 +00:00
Anna Zaks 29f9b7adc3 MacOSKeychainAPIChecker: Use llvm::SmallString instead of std::string (as per code review for r137523).
llvm-svn: 137633
2011-08-15 18:42:00 +00:00
Matt Beaumont-Gay 0a0ba9d883 Add fixit notes for -Wconstant-logical-operand.
llvm-svn: 137620
2011-08-15 17:50:06 +00:00
Douglas Gregor 3ec7910e10 Teach reference initialization from the result of a user-defined
conversion to initialize the standard conversion *after* the
user-defined conversion properly. Fixes PR10644.

llvm-svn: 137608
2011-08-15 13:59:46 +00:00
Francois Pichet 127bea8f48 fix typo in test.
llvm-svn: 137592
2011-08-14 22:30:29 +00:00
Francois Pichet daa7f2d613 Another typo found by Nico; Doug also warned me about it, but I didn't listen to him.
llvm-svn: 137591
2011-08-14 21:38:35 +00:00
Francois Pichet 5792825fb2 Fix typo.
llvm-svn: 137585
2011-08-14 14:28:49 +00:00
Eli Friedman 0be3970804 Fix r137086 to actually work properly in general. PR10650.
llvm-svn: 137574
2011-08-14 04:50:34 +00:00
Francois Pichet 00c7e6ceb1 Implement function template specialization at class scope extension in Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization.
Example:
template <class T>
class A {
public:
  template <class U> void f(U p) {  }
  template <> void f(int p) {  } // <== class scope specialization
};

This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code.
BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error.

llvm-svn: 137573
2011-08-14 03:52:19 +00:00
NAKAMURA Takumi c77574a2e3 Fix "Uninitialized" warnings on g++-4.4.
In fact, they are false warnings but it seems g++-4.4 might be unable to know they must be false.

llvm-svn: 137568
2011-08-14 00:37:22 +00:00
Bob Wilson 0d45f58cbb Reject -mkernel for i386/Darwin C++ code; fall back to llvm-gcc instead.
Since -mkernel implies -fapple-kext, this just extends the current behavior
for -fapple-kext to apply for -mkernel as well.  Radar 9933387.

llvm-svn: 137566
2011-08-13 23:48:55 +00:00
Nico Weber ed8080cb9f Add support of -x objc-cpp-output, -x objc++-cpp-output to the Driver.
Matches gcc, and is also required for using ccache with clang.

llvm-svn: 137563
2011-08-13 23:13:37 +00:00
Nico Weber c687cae11d Accept -x objc++-cpp-output as an alias for -x objective-c++-cpp-output
This is the ObjC++ version of r129201. It's for example needed to use
ccache with clang.

llvm-svn: 137560
2011-08-13 19:03:50 +00:00
Jeffrey Yasskin 9a56e37927 Fix C++0x narrowing conversion errors in Clang.
llvm-svn: 137552
2011-08-13 05:47:04 +00:00
Bob Wilson 445c24f8f0 Move handling of vget_lane/vset_lane before the code that checks the type.
Unlike most of the other Neon intrinsics, these are not overloaded and do not
have the extra argument that specifies the vector type.  This has not been
fatal because the lane number operand is supposed to be an ICE and so that
value has harmlessly been used as the type identifier.  Radar 9901281.

llvm-svn: 137550
2011-08-13 05:03:46 +00:00
Anna Zaks 80319c1702 MacOSKeychainAPIChecker: Test all APIs.
llvm-svn: 137549
2011-08-13 02:10:15 +00:00
Chad Rosier 58b662c3e3 [driver] Make sure to update the iterator end when erasing for Args.
llvm-svn: 137539
2011-08-12 23:38:19 +00:00
Ted Kremenek 5ef32dbf2a Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at.
llvm-svn: 137537
2011-08-12 23:37:29 +00:00
Eli Friedman 729ed799c7 Update clang tests for r137527.
llvm-svn: 137535
2011-08-12 23:33:52 +00:00
Chad Rosier 4f81fc21a0 [driver] When generating clang failure diagnostics, don't try to preprocess
inputs that aren't preprocessable.

llvm-svn: 137532
2011-08-12 23:30:05 +00:00
Chad Rosier 4bc3de4070 Return the proper type for objects when given a .o extension.
llvm-svn: 137531
2011-08-12 23:16:53 +00:00
Ted Kremenek 75fd43c61d Document purpose of ProgramPointTag::getTagKind().
llvm-svn: 137530
2011-08-12 23:06:47 +00:00
Ted Kremenek e8f7316fee [analyzer] change "tag" in ProgramPoint from "void*" to a ProgramPointTag*.
Having a notion of an actual ProgramPointTag will aid in introspection of the analyzer's behavior.
For example, the GraphViz output of the analyzer will pretty-print the tags in a useful manner.

llvm-svn: 137529
2011-08-12 23:04:46 +00:00
Anna Zaks 59d741fec6 MacOSKeychainAPIChecker: If the allocated data address entered as an enclosing function parameter, skip it to avoid false positives.
llvm-svn: 137526
2011-08-12 22:47:22 +00:00
Chad Rosier ecdede8f5f [driver] Refactor a bit to enable a few fixes when generating diagnostics. No functional change intended.
llvm-svn: 137524
2011-08-12 22:08:57 +00:00
Anna Zaks fdd0aca0a5 MacOSKeychainAPIChecker:
Report errors earlier: on checkDeadSymbols() and clear the state after the symbol we are tracking goes out of scope. 

Also, perform lazy error checking. Instead of forcing the paths to be split depending one the return value of the allocator, make the return symbol depend on the allocated data symbol, which prolongs its life span to the time when the allocated data symbol becomes dead.

llvm-svn: 137523
2011-08-12 21:56:43 +00:00
Jordy Rose add45b78dd [analyzer] Nitpicks on Olaf's patch, which I meant to e-mail but then didn't in
time. One is cleanup, the other is me being OCD about enum group nesting.

llvm-svn: 137517
2011-08-12 21:41:07 +00:00
Anna Zaks c94894fbc2 MacOSKeychainAPIChecker: There is no need to use SymbolMetadata to represent the allocated data symbol, we can just use the symbol corresponding to the SymbolicRegion. This simplifies tracking of the symbol, for example, SymbolMetadata needs to go through extra hoops to stay alive.
Make AllocationState internal to the MacOSKeychainAPIChecker class.

llvm-svn: 137514
2011-08-12 21:14:26 +00:00
Jeffrey Yasskin 94f8c77931 Conversions to bool count as integer conversions for the purposes of
the C++0x narrowing error.

llvm-svn: 137512
2011-08-12 20:56:43 +00:00
Fariborz Jahanian 70a315c363 metadata generated by the compiler does not include the weak
attribute of a property. patch by Remy Demarest fixes it.

llvm-svn: 137509
2011-08-12 20:47:08 +00:00
Ted Kremenek 26794fe096 Place err_cfstring_literal_not_string_constant and warn_cfstring_truncated under "-WCFString" flag.
llvm-svn: 137508
2011-08-12 20:46:54 +00:00
Ted Kremenek 95c3b73f3a Place diagnostic warn_stringcompare under the "-Wstring-compare" flag.
llvm-svn: 137507
2011-08-12 20:46:52 +00:00
Ted Kremenek d713fec9cc Place warnings related to incorrect "main()" declaration under "-Wmain".
llvm-svn: 137506
2011-08-12 20:46:49 +00:00
Ted Kremenek 8facefab10 Add -Wtypename-missing flag for diagnostic warn_typename_missing.
llvm-svn: 137505
2011-08-12 20:46:45 +00:00
Ted Kremenek 8df44b2632 [analyzer] Introduce new MemRegion, "TypedValueRegion", so that we can separate TypedRegions that implement getValueType() from those that don't.
Patch by Olaf Krzikalla!

llvm-svn: 137498
2011-08-12 20:02:48 +00:00
Richard Smith def8bdbfac Fix some comments.
llvm-svn: 137491
2011-08-12 18:44:32 +00:00
Chris Lattner 5ec04a51fa switch clang to use the new-new way of creating llvm::StructType's.
llvm-svn: 137472
2011-08-12 17:43:31 +00:00
Douglas Gregor c45c287ab6 Overriding the predefined Protocol isn't something that's actually
done and is likely to not work well anyway; take away this unnecessary
complexity.

llvm-svn: 137465
2011-08-12 17:09:30 +00:00
Ted Kremenek 50aa2d480c Revert "Fix crash in CFGBuilder involving implicit destructor calls and gotos jumping after an object was declared. Fixes PR 10620."
llvm-svn: 137459
2011-08-12 14:41:23 +00:00
Douglas Gregor 801c99d22d Switch the __int128_t and __uint128_t types over to predefined types
in the AST format, which are built lazily by the ASTContext when
requested.

llvm-svn: 137437
2011-08-12 06:49:56 +00:00
NAKAMURA Takumi 5ae5353894 docs/doxygen.css: Import .memitem, .memproto and .memdoc from llvm/doxygen.
llvm-svn: 137435
2011-08-12 06:24:04 +00:00
Douglas Gregor 52e02808c5 Switch the Objective-C 'SEL' type over to a predefined type in the
AST file format, lazily generating the actual declaration in
ASTContext as needed.

llvm-svn: 137434
2011-08-12 06:17:30 +00:00
Douglas Gregor 0a58618a09 Switch the Objective-C 'Class' type over to a predefined type in the
AST file format, lazily generating the actual declaration in
ASTContext as needed.

llvm-svn: 137431
2011-08-12 05:59:41 +00:00