Commit Graph

6506 Commits

Author SHA1 Message Date
John McCall 9dfb16210e Warn on top-level 'asm volatile' (instead of misparsing it).
"Fixes" rdar://problem/7574870

llvm-svn: 94458
2010-01-25 22:27:48 +00:00
Ted Kremenek fe0fc40c3b Move BugReporter.h, PathDiagnostic.h, and BugType.h to 'include/Checker/BugReporter'
llvm-svn: 94428
2010-01-25 17:10:22 +00:00
Ted Kremenek b2c9aa6cbc Add missing header.
llvm-svn: 94409
2010-01-25 05:19:37 +00:00
Ted Kremenek d6b8708643 Split libAnalysis into two libraries: libAnalysis and libChecker.
(1) libAnalysis is a generic analysis library that can be used by
    Sema.  It defines the CFG, basic dataflow analysis primitives, and
    inexpensive flow-sensitive analyses (e.g. LiveVariables).

(2) libChecker contains the guts of the static analyzer, incuding the
    path-sensitive analysis engine and domain-specific checks.

Now any clients that want to use the frontend to build their own tools
don't need to link in the entire static analyzer.

This change exposes various obvious cleanups that can be made to the
layout of files and headers in libChecker.  More changes pending.  :)

This change also exposed a layering violation between AnalysisContext
and MemRegion.  BlockInvocationContext shouldn't explicitly know about
BlockDataRegions.  For now I've removed the BlockDataRegion* from
BlockInvocationContext (removing context-sensitivity; although this
wasn't used yet).  We need to have a better way to extend
BlockInvocationContext (and any LocationContext) to add
context-sensitivty.

llvm-svn: 94406
2010-01-25 04:41:41 +00:00
Daniel Dunbar fcf2d428e4 ASTUnit: Don't check that input files exist when parsing ASTs from the command
line -- they may be remapped (fake) files. This is useful for testing parsing
entirely from memory.

llvm-svn: 94395
2010-01-25 00:44:02 +00:00
Daniel Dunbar d01592617f Update comment.
llvm-svn: 94393
2010-01-25 00:43:14 +00:00
Anders Carlsson 6515d877c0 Fix a pretty bad bug where if a constructor (or conversion function) was marked as 'explicit', but then defined out-of-line, we would not treat it as being explicit.
llvm-svn: 94366
2010-01-24 17:15:04 +00:00
Anders Carlsson 77babdb99a Implement [dcl.fct.spec]p6.
llvm-svn: 94365
2010-01-24 16:49:46 +00:00
Mike Stump 20a2c618f2 Ok, turn back off -Wunreachable-code by default.
llvm-svn: 94364
2010-01-24 16:16:01 +00:00
Sebastian Redl 0432dcd15c Mark PartialDiagnostic.h as a C++ header
llvm-svn: 94363
2010-01-24 10:02:25 +00:00
Anders Carlsson aaeef07280 Implement instantiation of AsmStmts (Crazy, I know)
llvm-svn: 94361
2010-01-24 05:50:09 +00:00
Daniel Dunbar b9999fdc67 Tweak clang_visitChildren comment.
llvm-svn: 94360
2010-01-24 04:10:31 +00:00
Daniel Dunbar 62ebf25f44 Index.h: Tweak comments, delete trailing whitespace, fix a few typos, etc.
llvm-svn: 94351
2010-01-24 02:54:26 +00:00
Chris Lattner 8fd2d01118 fix PR6034, a crash on invalid where the switch stack would get
unbalanced.

llvm-svn: 94347
2010-01-24 01:50:29 +00:00
Chris Lattner 11092645da add a prototype for __builtin_fpclassify. We don't know how to
codegen it, so we get 'cannot compile this builtin function yet'
errors, just like we do currently for __builtin_isinf.  However,
this should let us parse headers that use it without barfing,
which should help PR6083.

llvm-svn: 94346
2010-01-24 01:30:04 +00:00
Anders Carlsson 0bd52403d4 Use new initialization code when dealing with [dcl.init.aggr]p12. This fixes the bug where array elements and member initializers weren't copied correctly.
llvm-svn: 94340
2010-01-24 00:19:41 +00:00
Mike Stump 38013e109e Temporary flip default for -Wunreachable-code so some bots can test it
out.  They should all be done later tonight, but if something bad
happens, feel free to revert sooner.

llvm-svn: 94330
2010-01-23 20:23:40 +00:00
Eli Friedman d6ef69a7db Add bzero builtin; this should help codegen quality for code using this
function.

llvm-svn: 94320
2010-01-23 19:00:10 +00:00
Anders Carlsson 7802f31bfc Fix typo.
llvm-svn: 94315
2010-01-23 18:26:49 +00:00
Ted Kremenek 3e315a28b1 Add doxygen comment to clang_getClangVersion().
llvm-svn: 94311
2010-01-23 17:51:23 +00:00
John McCall 6d174646dd Produce a special diagnostic when users call a function with an argument of
incomplete type (or a pointer/reference to such).

The causes of this problem are different enough to justify a different "design"
for the diagnostic.  Most notably, it doesn't give an operand index:
it's usually pretty obvious which operand is the problem, it adds a lot of
clutter to mention it, and the fix is usually in a different part of the file
anyway.

This is yet another diagnostic that should really have an analogue in the
non-overloaded case --- which should be much easier to write because of
the weaker space constraints.

llvm-svn: 94303
2010-01-23 08:10:49 +00:00
Anders Carlsson 8e01dcf6f6 Fix the EntityKind order so that all entity kinds that can be copied (using copy constructors) come first. Also, fix a bug where EK_New was left out of the err_init_conversion_failed diagnostic (It is now reported as 'new value'). Please review Doug :)
llvm-svn: 94289
2010-01-23 05:47:27 +00:00
David Chisnall 481e3a87fe Created __builtin___NSStringMakeConstantString() builtin, which generates constant Objective-C strings.
llvm-svn: 94274
2010-01-23 02:40:42 +00:00
Ted Kremenek 4c0df3dc1d Rename getClangFullVendorVersion() to getClangFullVersion().
llvm-svn: 94273
2010-01-23 02:11:34 +00:00
John McCall 553c0796ee Implement elementary access control.
llvm-svn: 94268
2010-01-23 00:46:32 +00:00
Douglas Gregor aa98ed9a07 Extend clang_createTranslationUnitFromSourceFile() to support creating
translation units that include unsaved files.

llvm-svn: 94258
2010-01-23 00:14:00 +00:00
Ted Kremenek c0f3f72fa4 Add 'clang_getClangVersion()' function to CIndex. This exposes the full Clang version string through the CIndex API.
llvm-svn: 94242
2010-01-22 22:44:15 +00:00
Ted Kremenek 51b8bc93f8 Move version string generation (e.g., "clang 1.1 ...") to libBasic/Version.cpp, getClangFullVendorVersion().
llvm-svn: 94235
2010-01-22 22:29:50 +00:00
Douglas Gregor 6007cf2e9e Improve content and structure of the Doxygen documentation for the
CIndex API. No functionality change.

llvm-svn: 94234
2010-01-22 22:29:16 +00:00
Ted Kremenek 18e066f6a9 (1) Rename getClangSubversionRevision() to getClangRevision(), and
have it return a StringRef instead of an integer (to be more VCS
    agnostic).

(2) Add getClangFullRepositoryVersion(), which contains an
    amalgamation of the repository name and the revision.

(3) Change PCH to only emit the string returned by
    getClangFullRepositoryVersion() instead of also emitting the value
    of getClangSubversionRevision() (which has been removed).  This is
    functionally equivalent.

More cleanup to version string generation pending...

llvm-svn: 94231
2010-01-22 22:12:47 +00:00
Douglas Gregor 816fd36316 Yet more CIndex API cleanup:
- Added more routines to manipulate/compare source locations and ranges
  - Switched clang_getCursor() over to take a CXSourceLocation rather
  than file/line/column.

llvm-svn: 94226
2010-01-22 21:44:22 +00:00
Ted Kremenek 17437130e9 Rename pch::SVN_BRANCH_REVISION to pch::VERSION_CONTROL_BRANCH_REVISION.
llvm-svn: 94214
2010-01-22 20:59:36 +00:00
Ted Kremenek 2377a0e0ea Rename getClangSubversionPath() -> getClangRepositoryPath() and have it return a StringRef.
llvm-svn: 94213
2010-01-22 20:55:35 +00:00
Douglas Gregor 562c1f9365 Teach CIndex's cursor visitor to restrict its traversal to a specific
region of interest (if provided). Implement clang_getCursor() in terms
of this traversal rather than using the Index library; the unified
cursor visitor is more complete, and will be The Way Forward.

Minor other tweaks needed to make this work:
  - Extend Preprocessor::getLocForEndOfToken() to accept an offset
  from the end, making it easy to move to the last character in the
  token (rather than just past the end of the token).
  - In Lexer::MeasureTokenLength(), the length of whitespace is zero.

llvm-svn: 94200
2010-01-22 19:49:59 +00:00
Zhongxing Xu a1293a67cd Process cast according to the cast kind. Prepare for more specific cast
handling (for C++). No functionality change for now.

llvm-svn: 94153
2010-01-22 04:30:00 +00:00
Daniel Dunbar 7cde09ac8a Driver/Darwin: Update tool chain to use static clang_rt libraries provided by
compiler-rt. This tool chain now works on x86 and ARM, but isn't the x86 default
yet. 

This drastically cleans up the linker invocation, old invocation:
--
"/Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-weak_reference_mismatches" "non-weak" "-o" "a.out" "-lcrt1.10.6.o" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.." "t.o" "-lSystem" "-lgcc"
--

New invocation:
--
# For 10.6:
 "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "t.o" "-lSystem"
# For 10.4:
 "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.4" "-o" "a.out" "-lcrt1.o" "t.o" "-lSystem" "-lgcc_s.10.4" "/Volumes/Data/ddunbar/llvm.obj.64/Debug/lib/clang/1.1/lib/darwin/libclang_rt.10.4.a"
--

llvm-svn: 94150
2010-01-22 03:38:14 +00:00
Douglas Gregor d824f8825b Teach the cursor visitor to walk all of the C and Objective-C
declarations that have enough source information to make such a walk
useful. This includes walking into variable initializers and enum
constants, the types behind typedefs, etc.

llvm-svn: 94124
2010-01-22 00:50:27 +00:00
Chris Lattner fde85356c6 revert my patch for rdar://7520940 that warns when a published header
is #included with "foo.h" style syntax instead of framework syntax.
It produced too much noise.

llvm-svn: 94120
2010-01-22 00:14:44 +00:00
John McCall 1848ea4fe3 Due to local reversions and re-patching, I accidentally had multiple copies
of the 'payload' in this header.

llvm-svn: 94109
2010-01-21 22:59:41 +00:00
Mike Stump fcd6f94ba7 Improve unreachable code warnings for with respect to dead functional casts in C++.
llvm-svn: 94106
2010-01-21 22:12:18 +00:00
Ted Kremenek 819e873791 Allocate the 'Protocols' array in ObjCInterfaceType and
ObjCObjectPointerType using the allocator associated with ASTContext.
Not only does this fix a memory leak, but it also makes these arrays
BumpPtrAllocated (in the typical case).

llvm-svn: 94090
2010-01-21 19:22:34 +00:00
Fariborz Jahanian e344e41fed Fixes a comment.
llvm-svn: 94088
2010-01-21 17:39:43 +00:00
Fariborz Jahanian da8ec2bc9e Patch to implement rewriting of properties.
Fixes radar 7562952.

llvm-svn: 94087
2010-01-21 17:36:00 +00:00
Douglas Gregor 93f899509d Introduce type references into the C API, capturing references to
typedefs only (for now).

llvm-svn: 94078
2010-01-21 16:28:34 +00:00
Mike Stump 04c6851cd6 Speed up compilation by avoiding generating exceptional edges from
CallExprs as those edges help cause a n^2 explosion in the number of
destructor calls.  Other consumers, such as static analysis, that
would like to have more a more complete CFG can select the inclusion
of those edges as CFG build time.

This also fixes up the two compilation users of CFGs to be tolerant of
having or not having those edges.  All catch code is assumed be to
live if we didn't generate the exceptional edges for CallExprs.

llvm-svn: 94074
2010-01-21 15:20:48 +00:00
Mike Stump 6bf1c08e99 Add infrastructure to add base initializers and member initializers to
the CFG.  WIP.

llvm-svn: 94062
2010-01-21 02:21:40 +00:00
Douglas Gregor fed36b1aa1 Stash a CXXUnit pointer into each cursor. This allows us to simplify
the interface to clang_visitChildren() by eliminating the
CXTranslationUnit pointer.

llvm-svn: 94051
2010-01-20 23:57:43 +00:00
Douglas Gregor c8e390c215 Yet more Doxygen-comment tweaking in the CIndex library.
llvm-svn: 94044
2010-01-20 22:45:41 +00:00
Douglas Gregor 802f12f719 Improve Doxygen documentation for the CIndex library, somewhat.
llvm-svn: 94042
2010-01-20 22:28:27 +00:00
John McCall 97c5a140c2 Change LLVM/clang #includes to use quotes, not angle-brackets. Just a think-o
prompted by the #include <iterator> above.

llvm-svn: 94040
2010-01-20 22:16:29 +00:00