Commit Graph

28254 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 4975170267 [analyzer] lib/StaticAnalyzer/Checkers/ExprEngineExperimentalChecks.cpp -> lib/StaticAnalyzer/Checkers/ExperimentalChecks.cpp
llvm-svn: 125123
2011-02-08 22:30:15 +00:00
Argyrios Kyrtzidis f410a6299f [analyzer] lib/StaticAnalyzer/Checkers/ExprEngineExperimentalChecks.h -> lib/StaticAnalyzer/Checkers/ExperimentalChecks.h
llvm-svn: 125122
2011-02-08 22:30:11 +00:00
Argyrios Kyrtzidis f99d595cfd [analyzer] lib/StaticAnalyzer/Checkers/ExprEngineInternalChecks.h -> lib/StaticAnalyzer/Checkers/InternalChecks.h
llvm-svn: 125121
2011-02-08 22:30:02 +00:00
John McCall 53c72e71cc Test case accidentally left out of my last commit.
llvm-svn: 125119
2011-02-08 22:28:39 +00:00
Douglas Gregor 92a96f5c32 Split the serialized representation for the detailed preprocessing
record away from the core processor record. The tangling of these two
data structures led to some inefficiencies (e.g., deserializing all
of the detailed preprocessing record when we didn't need it, such as
while performing code completion) along with some unnecessary
ugliness.

llvm-svn: 125117
2011-02-08 21:58:10 +00:00
Peter Collingbourne 3a34725ed1 AST: support for pre-arg expressions on CallExpr subclasses
llvm-svn: 125115
2011-02-08 21:18:02 +00:00
Peter Collingbourne 4b279a033b StmtPrinter: factor out arg printing code to PrintCallArgs
llvm-svn: 125114
2011-02-08 21:17:54 +00:00
Benjamin Kramer 1a648d1930 Allow multiple -B prefixes. Patch by Joerg Sonnenberger.
llvm-svn: 125111
2011-02-08 20:31:42 +00:00
John McCall d396b97c5a Clear the linkage cache recursively. Fixes PR8926.
llvm-svn: 125104
2011-02-08 19:01:05 +00:00
Argyrios Kyrtzidis 898fdbf82d In Sema::CheckShadow, get the DeclContext from the variable that we are checking
instead from the Scope; Inner scopes in bodies don't have DeclContexts associated with them.

Fixes http://llvm.org/PR9160 & rdar://problem/8966163.

llvm-svn: 125097
2011-02-08 18:21:25 +00:00
Fariborz Jahanian 87967425f9 Support for objextive-c++ use of property-dot syntax as receiver
in liu of a class method getter. 
// rdar://8962253

llvm-svn: 125094
2011-02-08 18:05:59 +00:00
Douglas Gregor 0beaec05af Update the writing of the block-information block in the AST file
format, so that llvm-bcanalyzer knows about all of the various record
kinds.

llvm-svn: 125086
2011-02-08 16:34:17 +00:00
John McCall ad7c5c1657 Reorganize CodeGen{Function,Module} to eliminate the unfortunate
Block{Function,Module} base class.  Minor other refactorings.

Fixed a few address-space bugs while I was there.

llvm-svn: 125085
2011-02-08 08:22:06 +00:00
John McCall b0a3ecb41c Extend the const capture optimization to C++ record types with no
mutable fields and with trivial destructors and copy constructors.

llvm-svn: 125073
2011-02-08 03:07:00 +00:00
Douglas Gregor a57a66e8d0 Sema::MaybeBindToTemporary() shouldn't treat any expression returning
a glvalue as a temporary. Previously, we were enumerating all of the
cases that coul return glvalues and might be called with
Sema::MaybeBindToTemporary(), but that was gross and we missed the
Objective-C property reference case.

llvm-svn: 125070
2011-02-08 02:14:35 +00:00
Ken Dyck bec0285d7f Convert RecordLayout::NonVirtualAlign to CharUnits. No change in
functionality intended.

llvm-svn: 125069
2011-02-08 02:02:47 +00:00
John McCall 653dac4b0a dgregor accidentally killed this assert, but on investigation, it can fire
on invalid code and we don't really care, so kill it harder.

llvm-svn: 125068
2011-02-08 01:59:10 +00:00
Fariborz Jahanian 14889fc671 Support for objc use of property-dot syntax as receiver
in liu of a class method getter. objc++ uses a different
code path and is more involved (TBD).

llvm-svn: 125061
2011-02-08 00:23:07 +00:00
John McCall 93be3f75cc When copy-capturing values for a nested capture, use a BlockDeclRefExpr.
llvm-svn: 125021
2011-02-07 18:37:40 +00:00
Ted Kremenek e6a12a97d4 Move uninitialized variable checking back under -Wuninitialized-experimental. It is clear from user feedback that this warning is not quite ready.
llvm-svn: 125007
2011-02-07 17:38:38 +00:00
John McCall 351762cda2 A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
  - BDREs no longer store copy expressions
  - BlockDecls now store a list of captured variables, information about
    how they're captured, and a copy expression if necessary
    
With that in hand, change IR generation to use the captures data in       
blocks instead of walking the block independently.        

Additionally, optimize block layout by emitting fields in descending
alignment order, with a heuristic for filling in words when alignment
of the end of the block header is insufficient for the most aligned
field.

llvm-svn: 125005
2011-02-07 10:33:21 +00:00
Anton Yartsev 85129b8a86 pre/post ++/-- for AltiVec vectors. (with builtins-ppc-altivec.c failure fixed)
llvm-svn: 125000
2011-02-07 02:17:30 +00:00
Anders Carlsson 43760c3d42 Add another test that we can fully devirtualize now.
llvm-svn: 124988
2011-02-06 20:16:20 +00:00
Anders Carlsson e866d44417 Fix self-host; if a thunk already exists and has available_externally linkage, we should change its linkage instead of asserting.
llvm-svn: 124986
2011-02-06 20:09:44 +00:00
Anders Carlsson 8b02183ff3 When building with optimizations, emit thunks with available_externally linkage so devirtualized function calls can also be de-thunked.
llvm-svn: 124984
2011-02-06 18:31:40 +00:00
Anders Carlsson fe8a9939f9 Simplify thunks code.
llvm-svn: 124983
2011-02-06 17:15:43 +00:00
Oscar Fuentes ced8836182 CLANG_BINARY_DIR is not the same thing as LLVM_BINARY_DIR when Clang
is built as part of LLVM.

llvm-svn: 124982
2011-02-06 15:33:08 +00:00
Chris Lattner 7031ae38bb add some missing builtins.
llvm-svn: 124981
2011-02-06 12:45:51 +00:00
Oscar Fuentes 82a0d26294 Support running tests from the VS IDE and XCode.
Untested, but should work :)

llvm-svn: 124975
2011-02-05 21:37:51 +00:00
Oscar Fuentes 1b6a38e3c6 Remove the clang++ symlink with `make clean'.
llvm-svn: 124974
2011-02-05 21:37:37 +00:00
Douglas Gregor 7115aee109 Add a __has_feature check for default template arguments in function
templates, a C++0x feature.

llvm-svn: 124973
2011-02-05 20:35:30 +00:00
Oscar Fuentes c9fe3b94a5 CMake: libclang shall be named libclang.so, not liblibclang.so.
It is not possible to simply change that target name to `clang'
because we already have one.

llvm-svn: 124972
2011-02-05 20:00:13 +00:00
Douglas Gregor 606c4ac325 Improve our uniquing of file entries when files are re-saved or are
overridden via remapping. Thus, when we create a "virtual" file in the
file manager, we still stat() the real file that lives behind it so
that we can provide proper uniquing based on inodes. This helps keep
the file manager much more consistent.

To take advantage of this when reparsing files in libclang, we disable
the use of the stat() cache when reparsing or performing code
completion, since the stat() cache is very likely to be out of date in
this use case.

llvm-svn: 124971
2011-02-05 19:42:43 +00:00
Sebastian Redl 0890502f44 Basic implementation of inherited constructors. Only generates declarations, and probably only works for very basic use cases.
llvm-svn: 124970
2011-02-05 19:23:19 +00:00
Oscar Fuentes 84cb3947e5 Support `make clang-test' when Clang is compiled outside of LLVM.
This may not work on build platforms that place the binaries on
special folders ($build_dir/bin/Release/) such as the VS IDE and
XCode. For fixing this it is necessary to add a lit.py configuration
option for saying where the Clang binaries are, and apply to that path
the same magit that is used with the path to the LLVM tools binary
directory. Doing this requires a bit of autoconf work.

llvm-svn: 124969
2011-02-05 19:08:56 +00:00
Anders Carlsson 73f97534b0 Pass a 'ForVTable' flag to GetAddrOfThunk and pass it along to GetOrCreateLLVMFunction so that we
won't assert when building a thunk for an implicit virtual member function that is not marked used.

llvm-svn: 124967
2011-02-05 18:48:55 +00:00
Tobias Grosser b0e0597d07 python bindings: Add support for different kind of completion chunks
llvm-svn: 124959
2011-02-05 17:54:10 +00:00
Tobias Grosser b0949a17a0 python bindings: Get the string representation of a CompletionChunk
llvm-svn: 124958
2011-02-05 17:54:07 +00:00
Tobias Grosser 85bb48fce7 python bindings: Add CodeCompletionResults
llvm-svn: 124957
2011-02-05 17:54:04 +00:00
Tobias Grosser 2a8aac5ff4 python bindings: Add support for translationUnit.reparse().
This is the first step to make the clang_complete vim plugin work with
libclang. Reparsing improves parsing time from 0.8 to 0.25 secs for
one of my LLVM .cpp files.

llvm-svn: 124956
2011-02-05 17:54:00 +00:00
Tobias Grosser 4748651060 python bindings: Include local headers the right way.
llvm-svn: 124955
2011-02-05 17:53:55 +00:00
Tobias Grosser 0e19c192f5 python bindings: Remove unneeded instruction
llvm-svn: 124954
2011-02-05 17:53:53 +00:00
Tobias Grosser 5153e79931 python bindings: fix Diagnostics.range iterator
The iterator did never throw an IndexError. It was therefore not possible
to use it in a normal foreach loop as that loop would never stop.

llvm-svn: 124953
2011-02-05 17:53:51 +00:00
Tobias Grosser 82c18a502f python bindings: Use python Diagnostics as function arguments
This improves the readability of the code and fixes one testsuite bug.

The bug happend, because we only stored the pointer to the diagnostic in the
FixIt iterator, but not the python Diagnostic object. So it could happen that
the FixIt iterator still exists, but the python Diagnostic object is freed.
However, as the python Diagnostic is freed the pointer to the diagnostic is also
freed and the FixIt iterator is referencing a freed pointer.

llvm-svn: 124952
2011-02-05 17:53:48 +00:00
Tobias Grosser 2128823e74 python bindings: Synchronize cursor kinds
clang-c/Index.h contained cursor kinds not yet available in the python bindings.

Contributed-By: jmuizelaar@mozilla.com
llvm-svn: 124951
2011-02-05 17:53:47 +00:00
Argyrios Kyrtzidis dd03d8ddaa [analyzer] Fix a false positive of the 'self' initialization checker.
A common pattern in classes with multiple initializers is to put the
subclass's common initialization bits into a static function that receives
the value of 'self', e.g:

   if (!(self = [super init]))
     return nil;
   if (!(self = _commonInit(self)))
     return nil;

It was reported that 'self' was not set to the result of [super init].
Until we can use inter-procedural analysis, in such a call, transfer the
ObjCSelfInitChecker flags associated with 'self' to the result of the call.

Fixes rdar://8937441 & http://llvm.org/PR9094

llvm-svn: 124940
2011-02-05 05:54:53 +00:00
Argyrios Kyrtzidis 3d3208675f When the out-of-line definition differs from the declaration in the return type,
say "out-of-line definition differ from the declaration in the return type" instead of
the silly "functions that differ only in their return type cannot be overloaded".

Addresses rdar://7980179.

llvm-svn: 124939
2011-02-05 05:54:49 +00:00
Anders Carlsson 3c23948481 Re-land r124768, with a fix for PR9130.
We now emit everything except unused implicit virtual member functions when building the vtable.

llvm-svn: 124935
2011-02-05 04:35:53 +00:00
Ted Kremenek 6c9cd14bf9 Don't suggest -Wuninitialized fixits for uninitialized enum types.
llvm-svn: 124924
2011-02-05 01:18:18 +00:00
Ted Kremenek 359c4a1369 Don't crash when generating USRs for ObjC methods in protocols.
llvm-svn: 124920
2011-02-05 01:10:26 +00:00
Fariborz Jahanian a533af7d98 Restore a test which I accientally overwrote in my last
patch.

llvm-svn: 124911
2011-02-04 23:30:23 +00:00
Fariborz Jahanian c9b7c209bb -Wselector should warn on implemented selectors only
when selector metadata is generated, which is triggered 
by at least on class implementation. This is to match gcc's
behavior. // rdar://8851684.

llvm-svn: 124909
2011-02-04 23:19:27 +00:00
John McCall 490112f7bf Assert during instantiation of blocks that we've captured everything that
we captured in the dependent case.

llvm-svn: 124887
2011-02-04 18:33:18 +00:00
Bob Wilson d1447c45fa Add better support for ARM EABI triples.
Patch by Renato Golin!

llvm-svn: 124878
2011-02-04 17:59:28 +00:00
Daniel Dunbar 80f787c1c1 Driver: Fix spurious warning (from -cc1) about unused -fapple-kext on C inputs.
llvm-svn: 124875
2011-02-04 17:24:47 +00:00
Daniel Dunbar 74c9ea6343 build: Prevent duplicate inclusion of Makefile.rules, which causes make to warn
like crazy.
 - How no one else is bothered by this I can't understand!

llvm-svn: 124873
2011-02-04 17:12:27 +00:00
Douglas Gregor a522693f66 Improve our handling of the current instantiation for qualified
id-expression, e.g., 

  CurrentClass<T>::member

Previously, if CurrentClass<T> was dependent and not complete, we
would treat it as a dependent-scoped declaration reference expression,
even if CurrentClass<T> referred to the current instantiation.

Fixes PR8966 and improves type checking of templates.

llvm-svn: 124867
2011-02-04 13:35:07 +00:00
Douglas Gregor 789adec6bd Before checking bitfield initialization, make sure that neither the
bit-field width nor the initializer value are type- or
value-dependent. Fixes PR8712.

llvm-svn: 124866
2011-02-04 13:09:01 +00:00
Douglas Gregor 125fa40c34 When calling a bound pointer to member function, check the
cv-qualifiers on the object against the cv-qualifiers on the member
function. Fixes PR8315.

llvm-svn: 124865
2011-02-04 12:57:49 +00:00
Douglas Gregor 4d5c297607 Tweak my fix for PR8748, and update the incorrect PR number in the test case.
llvm-svn: 124863
2011-02-04 12:22:53 +00:00
Douglas Gregor 87866ceda7 Implement proper (de-)serialization for explicit template argument
lists with zero template arguments. Fixes some seriously scary
crashers in C++ PCH.

llvm-svn: 124862
2011-02-04 12:01:24 +00:00
Douglas Gregor 5d8b8babd5 Fix test for previous commit
llvm-svn: 124861
2011-02-04 11:59:47 +00:00
Douglas Gregor 0fcaac9ef3 Fix a crash-on-invalid where we were trying to parse C++ constructs in
C, then hitting an assertion because C code shouldn't try to parse
optional nested-name-specifiers. Fixes PR9137.

llvm-svn: 124860
2011-02-04 11:57:16 +00:00
Ted Kremenek 05edf944c0 USRs for Objective-C methods use the USR of the @interface as their base, not the USR of the class category or extension.
llvm-svn: 124859
2011-02-04 07:13:40 +00:00
Ted Kremenek d68ec818c3 Downgrade error about attribute 'iboutlet' and 'ibaction' being applied to anything but a instance method to a warning.
llvm-svn: 124858
2011-02-04 06:54:16 +00:00
Douglas Gregor a99fb4c77d Tighten up the semantics of default template arguments, per C++0x
[temp.param]p9 and C++ DR226. Fixes PR8747.

llvm-svn: 124856
2011-02-04 04:20:44 +00:00
Douglas Gregor 8b481d8ac2 When a function template's template parameter has a default argument,
it's okay for the following template parameters to not have default
arguments (since those template parameters can still be
deduced). Also, downgrade the error about default template arguments
in function templates to an extension warning, since this is a
harmless C++0x extension.

llvm-svn: 124855
2011-02-04 03:57:22 +00:00
Daniel Dunbar 7aa71f9423 build: Add support for DISABLE_DEFAULT_STRICT_ALIASING, which does what one
might expect.

llvm-svn: 124848
2011-02-04 02:20:39 +00:00
Daniel Dunbar 5ad0d7edfa Fix 80-col violins.
llvm-svn: 124847
2011-02-04 02:20:34 +00:00
Fariborz Jahanian e28342c401 minor refactoring of -fapple-kext stuff.
llvm-svn: 124837
2011-02-04 00:32:39 +00:00
Fariborz Jahanian 7cadb2f65b What was I thinking?
llvm-svn: 124835
2011-02-04 00:08:13 +00:00
Fariborz Jahanian f7f04458b3 -fapple-kext cannot have 'weak' visibility in this
abi.

llvm-svn: 124834
2011-02-04 00:01:24 +00:00
Douglas Gregor 149239651d If any Fix-Its attached to a diagnostic have invalid source locations
or source locations that refer into a macro instantiation, delete all
of the Fix-Its on that diagnostic.

llvm-svn: 124833
2011-02-03 23:41:12 +00:00
Oscar Fuentes edeaf16f2c Moved here from LLVM Clang's configuration options and related macros.
llvm-svn: 124825
2011-02-03 22:48:20 +00:00
Argyrios Kyrtzidis 58f8b590e1 [analyzer] Fix a crash until we can handle temporary struct objects properly.
llvm-svn: 124822
2011-02-03 22:01:32 +00:00
Douglas Gregor 7c60768590 Add __has_feature() for each of the type traits
llvm-svn: 124820
2011-02-03 21:57:35 +00:00
Oscar Fuentes ce8661608b Optionally, Clang now builds using LLVM as an external library.
The user sets the variable CLANG_PATH_TO_LLVM_BUILD pointing to a LLVM
build directory or to a directory where LLVM was installed. When using
a non-installed LLVM build, it is necessary to set
CLANG_PATH_TO_LLVM_SOURCE as well.

llvm-svn: 124817
2011-02-03 20:57:53 +00:00
Fariborz Jahanian 7f6f81ba9b Clean up of -fapple-kext abi code. No change otherwise.
llvm-svn: 124807
2011-02-03 19:27:17 +00:00
Argyrios Kyrtzidis 7272d9cf36 Implement -Woverloaded-virtual.
The difference with gcc is that it warns if you overload virtual methods only if
the method doesn't also override any method. This is to cut down on the number of warnings
and make it more useful like reported here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20423.
If we want to warn that not all overloads are overriden we can have an additional
warning like -Wpartial-override.

-Woverloaded-virtual, unlike gcc, is added to -Wmost. Addresses rdar://8757630.

llvm-svn: 124805
2011-02-03 18:01:15 +00:00
Douglas Gregor e664276bcf Teach SourceManager::getLocation() how to cope with a source file
whose inode has changed since the file was first created and that is
being seen through a different path name (e.g., due to symlinks or
relative path elements), such that its FileEntry pointer doesn't match
a known FileEntry pointer. Since this requires a system call (to
stat()), we only perform this deeper checking if we can't find the
file by comparing FileEntry pointers.

Also, add a micro-optimization where we don't bother to compute line
numbers when given the location (1, 1). This improves the
efficiency of clang_getLocationForOffset().
 

llvm-svn: 124800
2011-02-03 17:17:35 +00:00
Axel Naumann 6cff969eec Remove unnecessary RUN: directive.
llvm-svn: 124795
2011-02-03 14:05:55 +00:00
John McCall 2bd04c3114 More tweaks to the compatibility page.
llvm-svn: 124792
2011-02-03 11:29:18 +00:00
John McCall 93adb039b5 More minor documentation tweaks.
llvm-svn: 124791
2011-02-03 11:05:04 +00:00
John McCall 37d30c93ca Rework the __block jump-checking section, including a justification of
why this bug can go uncaught.

llvm-svn: 124790
2011-02-03 10:56:31 +00:00
John McCall 55199a63df Rework and embellish the C99 inline compatibility section.
llvm-svn: 124789
2011-02-03 10:16:40 +00:00
NAKAMURA Takumi 22ec6604f6 CMake: Fix test. CMake has not built unittests yet.
llvm-svn: 124787
2011-02-03 09:01:12 +00:00
John McCall 5f2d556a92 Capture a few implicit references to 'self'.
llvm-svn: 124786
2011-02-03 09:00:02 +00:00
John McCall f3a8860ee1 More capturing of 'this': implicit member expressions. Getting that
right for anonymous struct/union members led to me discovering some
seemingly broken code in that area of Sema, which I fixed, partly by  
changing the representation of member pointer constants so that    
IndirectFieldDecls aren't expanded.  This led to assorted cleanups with   
member pointers in CodeGen, and while I was doing that I saw some random
other things to clean up.                   

llvm-svn: 124785
2011-02-03 08:15:49 +00:00
Ted Kremenek 436cc8ffe7 Reenable -Wuninitialized warning for captured block variables.
llvm-svn: 124782
2011-02-03 06:51:50 +00:00
Rafael Espindola 2915731b6e Add test from PR9130.
llvm-svn: 124781
2011-02-03 06:36:50 +00:00
Rafael Espindola af5b92e8f7 Revert 124768.
This reopens PR99114, but that one at least can be avoided with an #include.
PR9130 cannot.

llvm-svn: 124780
2011-02-03 06:30:58 +00:00
Jeffrey Yasskin c7da993dee Add gTest unittests to clang, and write the first one.
This is the Makefile version only; the cmake implementation is coming soon.

llvm-svn: 124777
2011-02-03 04:51:52 +00:00
Rafael Espindola 5b55454065 Revert 124754 and 124760 as they made clang unusable in the presence of symbolic
links.

llvm-svn: 124776
2011-02-03 04:35:45 +00:00
Daniel Dunbar 9aa47fcb55 Frontend: Switch -header-include-file output to use unbuffered raw_ostreams with
the atomic writes option, since the intent is that this option be set for an
entire build, which may have any number of compiler instances writing to the
same output file.

llvm-svn: 124772
2011-02-03 03:45:00 +00:00
Anders Carlsson bac84bef65 Don't try to mark virtual members referenced for classes where the key function
is not defined in the current translation unit. Doing so lead to compile errors
such as PR9114.

Instead, when CodeGen is building the vtable, don't try to emit a definition
for functions that aren't marked used in the current translation unit.
Fixes PR9114.

llvm-svn: 124768
2011-02-03 02:08:44 +00:00
Francois Pichet 50a2e0e894 Fix Microsoft bit field problem. This resolves the Index\complete-exprs.c regression on Win32.
llvm-svn: 124767
2011-02-03 02:02:42 +00:00
Douglas Gregor 8c0577faf3 Improve the performance of filename canonicalization by avoiding
redundant searches in the string. No functionality change.

llvm-svn: 124760
2011-02-03 00:18:12 +00:00
Ted Kremenek b3dbe28e31 Based on user feedback, swap -Wuninitialized diagnostics to have the warning refer to the bad use, and the note to the variable declaration.
llvm-svn: 124758
2011-02-02 23:35:53 +00:00
Fariborz Jahanian 0c12ed1429 -fapple-kext, elimination of all direct calls to virtual dtors.
llvm-svn: 124757
2011-02-02 23:12:46 +00:00
Devang Patel 84ffdd9ba3 Emit debug info for template value parameters.
llvm-svn: 124756
2011-02-02 22:36:18 +00:00