Commit Graph

21436 Commits

Author SHA1 Message Date
Ted Kremenek 48ad2c92fc Bump clang minor version (1.5).
llvm-svn: 98801
2010-03-18 04:39:55 +00:00
Ted Kremenek c342c9c001 Refactor argument checking in CallAndMessageChecker to be the same
for both CallExprs and ObjCMessageExprs.

llvm-svn: 98800
2010-03-18 03:22:29 +00:00
Anders Carlsson 18c582d9c8 When dumping vtables, also dump the thunks.
llvm-svn: 98799
2010-03-18 02:44:19 +00:00
Ted Kremenek 9c05f4ef69 Detect pass-by-value arguments that are structs that contain
uninitialized data.

llvm-svn: 98796
2010-03-18 02:17:27 +00:00
Ted Kremenek e174fda979 Tweak dead stores checker to not emit a warning when initialization
a scalar variable with a scalar parameter.  This is a
form of defensive programming.  If the variable is unused,
it will be caused by -Wunused-variable.

llvm-svn: 98795
2010-03-18 01:22:39 +00:00
Ted Kremenek 1bc22f719f Simplify code (and remove 'dyn_cast') by using ObjCProperyDecl::findPropertyDecl().
llvm-svn: 98794
2010-03-18 01:22:36 +00:00
Ted Kremenek 1ff615ce4c Turn several PCH reader assertions into compiler errors, thus making
the PCHReader more robust to corrupt or invalid PCH files.

llvm-svn: 98788
2010-03-18 00:56:54 +00:00
Douglas Gregor 92a524fd47 Experimental stab at using relexing to identify preprocessor
directives while annotating tokens in CIndex. This functionality
should probably be factored out of this routine, but we're not there
yet. 

llvm-svn: 98786
2010-03-18 00:42:48 +00:00
Anders Carlsson 56446146fd More work on thunks.
llvm-svn: 98765
2010-03-17 20:06:32 +00:00
John McCall 39e8288b40 Implement non-dependent friend functions and classes.
llvm-svn: 98764
2010-03-17 20:01:29 +00:00
John McCall 71ba5f27de ActOnTagDefinitionError is supposed to 'unwind' ActOnTagStartDefinition, not
ActOnStartCXXMemberDeclaration.  We haven't started the field collector on this
class yet, so don't stop it.  Fixes a crash in the VS buildbot and a memory error
on all the others.

llvm-svn: 98760
2010-03-17 19:25:57 +00:00
Douglas Gregor ee8fed0146 Reduce the default alignment for ASTContext and Stmt/Expr allocation
from 16 bytes to 8 bytes, since we don't ever use those low 4
bits. Should save some storage.

llvm-svn: 98754
2010-03-17 18:46:59 +00:00
Douglas Gregor fc20f82726 XFAIL this test on that silly Windows platform. Grrr
llvm-svn: 98750
2010-03-17 18:28:02 +00:00
Douglas Gregor f475990d86 Remove this test. It is causing problems has has relatively little value
llvm-svn: 98730
2010-03-17 16:04:04 +00:00
Douglas Gregor 319aa6c4b5 Remove warning about shadowing a built-in; built-ins aren't actually
considered to be a part of the translation unit unless they're named
in a way that brings them into existence.

llvm-svn: 98729
2010-03-17 16:03:44 +00:00
Douglas Gregor 4ad3da2843 Entering the main source file in the preprocessor can fail if the
source file has been changed. Handle that failure more gracefully.

llvm-svn: 98727
2010-03-17 15:44:30 +00:00
Douglas Gregor 22fde23b6e Check the inode in addition to size and modification time to determine
whether a file has changed since it was originally read.

llvm-svn: 98726
2010-03-17 15:33:06 +00:00
Douglas Gregor 6597f59506 Use a simple diagnostic (file modified) when we detect that a file has
changed, rather than trying to point out how it changed. The "why"
doesn't matter.

llvm-svn: 98725
2010-03-17 15:30:15 +00:00
Kovarththanan Rajaratnam eeed0cc32d Simplify error path using OwningPtr
llvm-svn: 98722
2010-03-17 09:47:30 +00:00
Kovarththanan Rajaratnam 9ff84d9c27 Simplify ProcessWarningOptions since it can't fail
llvm-svn: 98721
2010-03-17 09:36:02 +00:00
Kovarththanan Rajaratnam 5d272cda19 Remove useless forward decl.
llvm-svn: 98720
2010-03-17 09:25:49 +00:00
Kovarththanan Rajaratnam 4a94ba56f1 Issue a proper diagnostic if we couldn't open dump file
llvm-svn: 98719
2010-03-17 09:24:48 +00:00
Kovarththanan Rajaratnam c1e817ef51 Remove useless foward decl.
llvm-svn: 98718
2010-03-17 08:44:19 +00:00
John McCall cb81625851 Add another compatibility note and tweak a few of the existing ones.
llvm-svn: 98717
2010-03-17 07:10:56 +00:00
Chandler Carruth 7b621ea10a Fix a typo in a tag.
llvm-svn: 98713
2010-03-17 05:46:21 +00:00
John McCall fb803d7dcb Grant nested classes the access privileges of their enclosing classes.
llvm-svn: 98710
2010-03-17 04:58:56 +00:00
Rafael Espindola fcc4739089 Document common clang compatibility issues.
Patch by Zhanyong Wan.

llvm-svn: 98708
2010-03-17 04:31:53 +00:00
Rafael Espindola cd7eef900f Correctly mangle dependent TypenameType.
Fixes PR6625.

llvm-svn: 98707
2010-03-17 04:28:11 +00:00
Zhongxing Xu 03fd76663e Mark CXXThisRegion in the current or parent stack frame context as live so that
their bindings are not removed.

llvm-svn: 98705
2010-03-17 03:35:08 +00:00
John McCall 59bb1d4657 Make -faccess-control and -fno-access-control driver options.
llvm-svn: 98703
2010-03-17 01:32:13 +00:00
John McCall 9a3da8e6cf Provide a test case for PR6629.
llvm-svn: 98702
2010-03-17 01:31:25 +00:00
John McCall 2ff380a43a Clean up after ourselves when there's an error parsing the base clause.
Fixes the crash-on-invalid in PR6629.

llvm-svn: 98698
2010-03-17 00:38:33 +00:00
Douglas Gregor 81dfb30e4c Don't "take" the file manager and source manager when
ASTUnit::LoadFromCompilerInvocation() fails to create target
information.

llvm-svn: 98697
2010-03-17 00:32:06 +00:00
Fariborz Jahanian b8b0ea330c objective-c patch to provide type safty when blocks are passing or
returning objc objects. There will be a corresponding objective-c++
patch soon.

llvm-svn: 98696
2010-03-17 00:20:01 +00:00
Douglas Gregor 5444aa6d3d Emit output of PCH consistency checking test case to a separate text file and grep that
llvm-svn: 98695
2010-03-17 00:09:23 +00:00
Fariborz Jahanian fa24e1066f Issue error when a byref array is accessed in a block
literal. Fixes radar 7760213.

llvm-svn: 98693
2010-03-16 23:39:51 +00:00
Douglas Gregor 1668355e06 Remove unused variable
llvm-svn: 98691
2010-03-16 22:54:32 +00:00
Douglas Gregor 82752ec843 Teach SourceManager's content cache to keep track of whether its
buffer was invalid when it was created, and use that bit to always set
the "Invalid" flag according to whether the buffer is invalid. This
ensures that all accesses to an invalid buffer are marked invalid,
improving recovery.

llvm-svn: 98690
2010-03-16 22:53:51 +00:00
Douglas Gregor dc970f0866 Audit all Preprocessor::getSpelling() callers, improving failure
recovery for those that need it.

llvm-svn: 98689
2010-03-16 22:30:13 +00:00
Blaine Garst a41f71212a fix copyright & typo
llvm-svn: 98688
2010-03-16 22:02:16 +00:00
John McCall 9a9ae00442 Forgot the testcases.
llvm-svn: 98685
2010-03-16 21:50:59 +00:00
John McCall a2a3f7dc11 Implement -Wshadow. Based on a patch by Mike M.!
llvm-svn: 98684
2010-03-16 21:48:18 +00:00
Chris Lattner 87c5e2f5d4 update link
llvm-svn: 98682
2010-03-16 21:43:03 +00:00
John McCall a630995f50 Perform access control for the implicit calls to base and member destructors
that occur in constructors (on the unwind path).

llvm-svn: 98681
2010-03-16 21:39:52 +00:00
Blaine Garst ade4303e2b at least give the Apple ABI a name that reflects Apple in prep for other ABI specs that might come along
llvm-svn: 98678
2010-03-16 21:22:41 +00:00
Blaine Garst 1832cdb2d3 rev existing doc to account for recent ABI changes
llvm-svn: 98676
2010-03-16 21:21:07 +00:00
Douglas Gregor a71b9d0678 Update get*LineNumber() and get*ColumnNumber() functions to pass the
Invalid bit through; there are no safety-critical callers of these
functions.

llvm-svn: 98674
2010-03-16 20:53:17 +00:00
Douglas Gregor 42fe858cd6 Audit all callers of SourceManager::getCharacterData(); update some of
them to recover more gracefully on failure.

llvm-svn: 98672
2010-03-16 20:46:42 +00:00
Douglas Gregor 554e0b1ec2 Audit all callers of SourceManager::getBufferData(); fix the one that
needs better error recovery.

llvm-svn: 98667
2010-03-16 20:26:15 +00:00
Douglas Gregor 4fb7fbef3b Audit all getBuffer() callers (for both the FullSourceLoc and
SourceManager versions), updating those callers that need to recover
gracefully from failure.

llvm-svn: 98665
2010-03-16 20:01:30 +00:00
Douglas Gregor 26266da3c3 Teach the one caller of SourceManager::getMemoryBufferForFile() to cope with errors
llvm-svn: 98664
2010-03-16 19:49:24 +00:00
Chris Lattner 379e1b9cc9 accept and ignore __gcc_tdiag__ so we don't produce warnings
building mainline GCC, PR6542

llvm-svn: 98661
2010-03-16 19:29:19 +00:00
Douglas Gregor a2f4945099 Make sure we actually override ReadHeaderFileInfo when we meant to
llvm-svn: 98655
2010-03-16 19:09:18 +00:00
Daniel Dunbar 35621a9dcc Driver: Fix forwarding of -fno-lax-vector-conversions.
llvm-svn: 98639
2010-03-16 16:57:46 +00:00
Douglas Gregor 5712ebced0 Fix header-search problems with precompiled headers, where the
presence or absence of header map arguments when using the precompiled
header would cause Clang to get confused about which headers had
already been included/imported, along with their controlling
macros. The fundamental problem is that the serialization of the
header search information was relying on the UIDs of FileEntry objects
at PCH generation time and PCH load time to be equivalent, which
effectively means that we had to probe the same files in the same
order. Differing header map arguments caused an extra FileEntry
lookup, but it's easy to imagine other minor command-line arguments
triggering this problem.

Header-search information is now encoded along with the
source-location entry for a file, so that we register information
about a file's properties as a header at the same time we create the
FileEntry for that file.

Fixes <rdar://problem/7743243>.

llvm-svn: 98636
2010-03-16 16:35:32 +00:00
Benjamin Kramer 0ca3c62078 Switch another function to StringRef instead of char pointer pairs.
llvm-svn: 98631
2010-03-16 14:48:07 +00:00
Benjamin Kramer eb92dc0b09 Let SourceManager::getBufferData return StringRef instead of a pair of two const char*.
llvm-svn: 98630
2010-03-16 14:14:31 +00:00
Zhongxing Xu 0eb690390d Add VisitCXXContructExpr logic to the analyzer. This still has not fully worked
since RemoveDeadBinding mistakenly remove the binding to CXXThisRegion. 

llvm-svn: 98629
2010-03-16 13:14:16 +00:00
John McCall ab8c273b4f Access control for implicit calls to copy assignment operators and copy
constructors from implicitly-defined members.

llvm-svn: 98614
2010-03-16 06:11:48 +00:00
Douglas Gregor 00a0cf70d9 Don't consume tokens past the end-of-file in an @interface. Fixes
<rdar://problem/7735566>.

llvm-svn: 98613
2010-03-16 06:04:47 +00:00
John McCall f857e0bbe7 Perform access control even for the implicit destructor calls from implicit
destructor definitions.  Remove some code duplication.

llvm-svn: 98611
2010-03-16 05:36:30 +00:00
John McCall 1064d7ef29 Perform access control for the implicit base and member destructor calls
required when emitting a destructor definition.

llvm-svn: 98609
2010-03-16 05:22:47 +00:00
Douglas Gregor 7bda4b8310 Introduce optional "Invalid" parameters to routines that invoke the
SourceManager's getBuffer() and, therefore, could fail, along with
Preprocessor::getSpelling(). Use the Invalid parameters in the literal
parsers (string, floating point, integral, character) to make them
robust against errors that stem from, e.g., PCH files that are not
consistent with the underlying file system.

I still need to audit every use caller to all of these routines, to
determine which ones need specific handling of error conditions.

llvm-svn: 98608
2010-03-16 05:20:39 +00:00
Douglas Gregor 874cc62876 Use SourceManager's Diagnostic object for all file-reading errors,
simplifying the SourceManager interfaces somewhat.

llvm-svn: 98598
2010-03-16 00:35:39 +00:00
Douglas Gregor e0fbb83b8b Give SourceManager a Diagnostic object with which to report errors,
and start simplifying the interfaces in SourceManager that can fail.

llvm-svn: 98594
2010-03-16 00:06:06 +00:00
Douglas Gregor 0adf3182b0 Add some <cstdio> includes to unbreak the buildbots
llvm-svn: 98591
2010-03-15 23:33:37 +00:00
Eric Christopher 8c6f61394f Add remaining sse4.1 intrinsics and builtins.
llvm-svn: 98587
2010-03-15 23:22:58 +00:00
Douglas Gregor 802b77601e Introduce a new BufferResult class to act as the return type of
SourceManager's getBuffer() (and similar) operations. This abstract
can be used to force callers to cope with errors in getBuffer(), such
as missing files and changed files. Fix a bunch of callers to use the
new interface.

Add some very basic checks for file consistency (file size,
modification time) into ContentCache::getBuffer(), although these
checks don't help much until we've updated the main callers (e.g.,
SourceManager::getSpelling()).

llvm-svn: 98585
2010-03-15 22:54:52 +00:00
Ted Kremenek d133a86aa3 Move method FindPropertyVisibleInPrimaryClass() from ObjCContainerDecl to ObjCInterfaceDecl.
Also change this method to lookup property declarations using DeclContext::lookup().

llvm-svn: 98574
2010-03-15 20:30:07 +00:00
Ted Kremenek ddcd1093a4 Change ObjCCategoryDecl::FindPropertyDeclaration() to lookup
property decls using DeclContext::lookup().

llvm-svn: 98571
2010-03-15 20:11:53 +00:00
Ted Kremenek 4fb821ec0d Make 'findPropertyDecl()' a static method of ObjCPropertyDecl.
llvm-svn: 98570
2010-03-15 20:11:46 +00:00
Ted Kremenek e01bec9791 Add 'expected-note'
llvm-svn: 98560
2010-03-15 18:47:29 +00:00
Ted Kremenek 679708ee34 Correctly determine if the @property has been previously declared. If
a property has the same name as the ivar it wraps then the old logic
wouldn't find the previous property declaration.

llvm-svn: 98559
2010-03-15 18:47:25 +00:00
Fariborz Jahanian b397e43dea objective-c++ must take into account qualifiers when
considering valid objc pointer converions.

llvm-svn: 98557
2010-03-15 18:36:00 +00:00
Ted Kremenek f3bc99dd56 Add comment to CFG to 'buildCFG()' arguments indicating that scope
support is not fully implemented.

llvm-svn: 98555
2010-03-15 17:45:13 +00:00
Ted Kremenek bc1a67bee3 Rename clang_constructUSR_ObjCategory to clang_constructUSR_ObjCCategory.
(there was a missing 'C').

llvm-svn: 98554
2010-03-15 17:38:58 +00:00
Kovarththanan Rajaratnam 94b9af889e Remove useless forward decl.
llvm-svn: 98553
2010-03-15 17:31:29 +00:00
Douglas Gregor ea16606fcd During C++ name lookup, use DeclContext::Equals() rather than
comparing DeclContext pointers, to avoid having to remember to call
getPrimaryContext() everywhere. This is the last part PR6594.

llvm-svn: 98546
2010-03-15 15:26:48 +00:00
Douglas Gregor 6623006249 Implement C++ [temp.local]p8, which specifies that a template
parameter hides a namespace-scope declararion with the same name in an
out-of-line definition of a template. The lookup requires a strange
interleaving of lexical and semantic scopes (go C++), which I have not
yet handled in the typo correction/code completion path.

Fixes PR6594.

llvm-svn: 98544
2010-03-15 14:33:29 +00:00
John McCall c33dec3664 Add support for -Wwrite-strings. Patch by Mike M! Fixes PR 4804.
llvm-svn: 98541
2010-03-15 10:54:44 +00:00
John McCall 3e11ebebc8 Remember declaration scope qualifiers in the AST. Imposes no memory overhead
on unqualified declarations.

Patch by Enea Zaffanella!  Minimal adjustments:  allocate the ExtInfo nodes
with the ASTContext and delete them during Destroy().  I audited a bunch of
Destroy methods at the same time, to ensure that the correct teardown was
being done.

llvm-svn: 98540
2010-03-15 10:12:16 +00:00
John McCall 1e3a1a7eff Remember access paths for visible conversion decls.
llvm-svn: 98539
2010-03-15 09:07:48 +00:00
Anton Korobeynikov 762c6b7346 Fix thinko and enable clang build on mingw again (hopefully)
llvm-svn: 98492
2010-03-14 12:55:35 +00:00
Kovarththanan Rajaratnam b4c0f5cc79 Add EmitString helper method
llvm-svn: 98488
2010-03-14 08:35:19 +00:00
Kovarththanan Rajaratnam d3fa9721fb Unbreak last commit. This should have been part of r98478.
llvm-svn: 98480
2010-03-14 07:55:43 +00:00
Kovarththanan Rajaratnam fb0762057e Pass file string by reference
llvm-svn: 98478
2010-03-14 07:38:15 +00:00
Kovarththanan Rajaratnam d16d38c0b9 Path related cleanup. Remove unnecessary variables.
llvm-svn: 98473
2010-03-14 07:15:57 +00:00
Kovarththanan Rajaratnam a9c81a8848 Use makeAbsolute()
llvm-svn: 98472
2010-03-14 07:06:50 +00:00
Kovarththanan Rajaratnam b65a14802c Move to anonymous namespace
llvm-svn: 98469
2010-03-14 06:48:05 +00:00
David Chisnall 2bfc50bf68 Fixed copy-and-paste error causing categories to contain the protocols declared on the class, not the protocols declared on the category.
llvm-svn: 98455
2010-03-13 22:20:45 +00:00
Benjamin Kramer f156b9d55d Revert 98439. There is a bad race condition in sys::Path::makeUnique on win32.
llvm-svn: 98452
2010-03-13 21:22:49 +00:00
Rafael Espindola a530f9c03b Add missing space.
llvm-svn: 98448
2010-03-13 20:14:52 +00:00
Douglas Gregor b14d123774 Give explicit template instantiations weak ODR linkage. Former
iterations of this patch gave explicit template instantiation
link-once ODR linkage, which permitted the back end to eliminate
unused symbols. Weak ODR linkage still requires the symbols to be
generated.

llvm-svn: 98441
2010-03-13 18:23:07 +00:00
Rafael Espindola 13327bbe55 Fix PR6562. If a type is dependent, we don't know if it will have implicit
destructors.

llvm-svn: 98440
2010-03-13 18:12:56 +00:00
Benjamin Kramer 84c37f9903 Make getTemporaryPath a static member of CIndexer and use it to replace tmpnam calls.
This fixes linker warnings on linux.

llvm-svn: 98439
2010-03-13 13:05:20 +00:00
Benjamin Kramer 69b3c43391 Use raw_ostream instead of sprintf.
llvm-svn: 98438
2010-03-13 12:06:51 +00:00
Benjamin Kramer 5ac3b0be2d Simplify code.
llvm-svn: 98437
2010-03-13 11:34:41 +00:00
Kovarththanan Rajaratnam ba2c65277a Use SmallString instead of SmallVector
llvm-svn: 98436
2010-03-13 10:17:05 +00:00
Kovarththanan Rajaratnam e5f1c197af No need to call setIdentifierInfo() after LookUpIdentifierInfo() which LookUpIdentifierInfo() will automatically do
llvm-svn: 98435
2010-03-13 08:53:33 +00:00
Douglas Gregor 17b76185f1 Re-revert the explicit template instantiation linkage patch. I am beginning to look incompetent
llvm-svn: 98425
2010-03-13 03:49:57 +00:00