Devang Patel
0043977f09
Remove unintended code that was checked in as part of r108916.
...
llvm-svn: 108951
2010-07-20 22:32:37 +00:00
Devang Patel
11a42a4655
Remove unused argument.
...
llvm-svn: 108946
2010-07-20 22:20:10 +00:00
John McCall
5add20cefa
Fix the IR generation for catching pointers by references.
...
Fixes <rdar://problem/8212123>.
llvm-svn: 108944
2010-07-20 22:17:55 +00:00
Chris Lattner
32ac583d91
in 'new int[4]', constant fold the 4*4=16 instead of
...
doing an overflow check.
llvm-svn: 108943
2010-07-20 21:55:52 +00:00
Sebastian Redl
0675030cf9
Allow loading source locations from any file in the chain. WIP
...
llvm-svn: 108942
2010-07-20 21:50:20 +00:00
Chris Lattner
94027202e0
don't demand names to be on IR.
...
llvm-svn: 108937
2010-07-20 21:34:36 +00:00
Chris Lattner
2be2074f75
temporarily disable this to fix the build bot.
...
llvm-svn: 108936
2010-07-20 21:32:10 +00:00
Sebastian Redl
b293a45d28
More work on getting PCHReader to handle multiple files. Promote SLocOffsets to per-file data. WIP
...
llvm-svn: 108930
2010-07-20 21:20:32 +00:00
Chris Lattner
f2f3870189
Follow the implementation approach suggested by PR6687,
...
which generates more efficient and more obviously conformant
code. We now test for overflow of the multiply then force
the result to -1 if so. On X86, this generates nice code
like this:
__Z4testl: ## @_Z4testl
## BB#0: ## %entry
subl $12, %esp
movl $4, %eax
mull 16(%esp)
testl %edx, %edx
movl $-1, %ecx
cmovel %eax, %ecx
movl %ecx, (%esp)
call __Znam
addl $12, %esp
ret
llvm-svn: 108927
2010-07-20 21:07:09 +00:00
Fariborz Jahanian
217af240b5
Adopt objc_assign_threadlocal() for __thread variables of GC types.
...
Implements radar 8203301.
llvm-svn: 108917
2010-07-20 20:30:03 +00:00
Devang Patel
6c01820900
Print template argument names for template class.
...
llvm-svn: 108916
2010-07-20 20:24:18 +00:00
Chris Lattner
26008e07de
implement rdar://5739832 - operator new should check for overflow in multiply,
...
causing clang to compile this code into something that correctly throws a
length error, fixing a potential integer overflow security attack:
void *test(long N) {
return new int[N];
}
int main() {
test(1L << 62);
}
We do this even when exceptions are disabled, because it is better for the
code to abort than for the attack to succeed.
This is heavily based on a patch that Fariborz wrote.
llvm-svn: 108915
2010-07-20 20:19:24 +00:00
Douglas Gregor
af82e3510b
Introduce a new lexer function to compute the "preamble" of a file,
...
which is the part of the file that contains all of the initial
comments, includes, and preprocessor directives that occur before any
of the actual code. Added a new -print-preamble cc1 action that is
only used for testing.
llvm-svn: 108913
2010-07-20 20:18:03 +00:00
Dan Gohman
481e40c681
Use getDebugLoc and setDebugLoc instead of getDbgMetadata and setDbgMetadata,
...
avoiding MDNode overhead.
llvm-svn: 108911
2010-07-20 20:13:52 +00:00
Ted Kremenek
4407ea4948
Hookup checking for invalid length modifiers in scanf format strings.
...
llvm-svn: 108907
2010-07-20 20:04:47 +00:00
Ted Kremenek
ea28f83a5f
Move 'hasValidLengthModifier' from PrintfFormatSpecifier to FormatSpecifier.
...
llvm-svn: 108906
2010-07-20 20:04:42 +00:00
Ted Kremenek
36521956f7
Cleanup whitespace in switch statement. No functionality change.
...
llvm-svn: 108905
2010-07-20 20:04:36 +00:00
Ted Kremenek
bb0ffd7ade
Refactor ScanfConversionSpecifier to subclass ConversionSpecifier.
...
llvm-svn: 108904
2010-07-20 20:04:32 +00:00
Ted Kremenek
f03e6d85a1
Add 'ConversionSpecifier' root class in 'analyze_format_string' namespace and
...
derived 'PrintfConversionSpecifier' from this class. We will do the same for
'ScanfConversionSpecifier'.
llvm-svn: 108903
2010-07-20 20:04:27 +00:00
Ted Kremenek
fe1316882c
Tidy up analyze_printf::ConversionSpecifier::Kind declaration, prepping it to be merged
...
with analyze_scanf::ConversionSpecifier::Kind.
llvm-svn: 108902
2010-07-20 20:04:20 +00:00
Ted Kremenek
348d1499c1
Rename 'UnicodeStrArg' to 'SArg'.
...
llvm-svn: 108901
2010-07-20 20:04:15 +00:00
Ted Kremenek
516ef222ba
Rename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and printf checking).
...
llvm-svn: 108900
2010-07-20 20:04:10 +00:00
Ted Kremenek
1ce32be36a
Rename 'VoidPtrArg' to 'pArg' in printf/scanf checking.
...
llvm-svn: 108899
2010-07-20 20:04:04 +00:00
Ted Kremenek
563e3edbc2
Rename 'CStrArg' to 'sArg' for printf checking to match with the analagous enum for scanf checking.
...
llvm-svn: 108898
2010-07-20 20:03:58 +00:00
Ted Kremenek
ab0fe8a48d
Rename analyze_printf::ConversionSpecifier::IntAsCharArg to 'cArg' to match
...
analagous enum in analyze_scanf. This is prep for refactoring the logic for handling
ConversionSpecifiers for both scanf and printf.
llvm-svn: 108897
2010-07-20 20:03:49 +00:00
Ted Kremenek
b65a9d5a1a
Rename diagnostic so that it can be reused with scanf checking. No functionality change.
...
llvm-svn: 108896
2010-07-20 20:03:43 +00:00
Chris Lattner
b7a95cf165
delete a loop that just generates dead code. In an example
...
like this:
void *test(long N) {
return new int[N][42][42];
}
the loop generates two dead mul instructions:
%tmp = load i64* %N.addr ; <i64> [#uses=2]
%0 = mul i64 %tmp, 7056 ; <i64> [#uses=1]
%1 = mul i64 %tmp, 42 ; <i64> [#uses=1]
%2 = mul i64 %1, 42 ; <i64> [#uses=0]
%call = call noalias i8* @_Znam(i64 %0) ; <i8*> [#uses=1]
The scale of these multiplies is already handled by the typesize stuff.
llvm-svn: 108884
2010-07-20 18:49:33 +00:00
Chris Lattner
cb46bdc34f
remove the special case for constant array sizes from
...
EmitCXXNewAllocSize. This code uses IRBuilder, which does
constant folding already.
llvm-svn: 108882
2010-07-20 18:45:57 +00:00
Jim Grosbach
71d963e954
Re-apply fixed version of 108749, correctly conditionalizing the new sections on
...
ObjC ABI version 2 this time.
llvm-svn: 108847
2010-07-20 16:20:26 +00:00
Douglas Gregor
73a18fdd39
Slip up long string literal
...
llvm-svn: 108838
2010-07-20 14:34:35 +00:00
Douglas Gregor
b37b46e488
Complain when string literals are too long for the active language
...
standard's minimum requirements.
llvm-svn: 108837
2010-07-20 14:33:20 +00:00
Argyrios Kyrtzidis
dde5790562
Hide FunctionTemplateDecl's specializations folding set as implementation detail and introduce
...
FunctionTemplateDecl::findSpecialization.
Redeclarations of specializations will not cause the previous decl to be removed from the set,
the set will keep the canonical decl. findSpecialization will return the most recent redeclaration.
llvm-svn: 108834
2010-07-20 13:59:58 +00:00
Argyrios Kyrtzidis
c1624e9eda
Whether the specialization should be added to template's folding set when read from PCH,
...
is determined by a isCanonicalDecl check.
llvm-svn: 108833
2010-07-20 13:59:40 +00:00
Argyrios Kyrtzidis
47470f2f3f
Hide the specializations folding sets of ClassTemplateDecl as an implementation detail (InsertPos
...
leaks though) and add methods to its interface for adding/finding specializations.
Simplifies its users a bit and we no longer need to replace specializations in the folding set with
their redeclarations. We just return the most recent redeclarations.
As a bonus, it fixes http://llvm.org/PR7670 .
llvm-svn: 108832
2010-07-20 13:59:28 +00:00
Rafael Espindola
38360b3ff7
Add -lstdc++ to DragonFly tools.
...
Patch by Sascha Wildner.
llvm-svn: 108830
2010-07-20 12:59:03 +00:00
Zhongxing Xu
edb77fe8b4
Constify all references to Stmt* and CFGBlock* in libChecker.
...
llvm-svn: 108811
2010-07-20 06:22:24 +00:00
Zhongxing Xu
09a95d7448
Add const iterator to InitListExpr.
...
llvm-svn: 108810
2010-07-20 06:15:27 +00:00
Sebastian Redl
c57d34bc35
Update ImplicitCastExpr to be able to represent an XValue.
...
llvm-svn: 108807
2010-07-20 04:20:21 +00:00
Daniel Dunbar
08d047666a
Fix test for Win32.
...
llvm-svn: 108806
2010-07-20 04:06:54 +00:00
Zhongxing Xu
6694255306
Constify.
...
llvm-svn: 108804
2010-07-20 02:56:49 +00:00
Zhongxing Xu
70856f7986
remove const_cast.
...
llvm-svn: 108803
2010-07-20 02:53:15 +00:00
Daniel Dunbar
9d8416b799
Driver: Switch to using a SmallVector instead of std::vector, and stop
...
accessing outside the range of the vector (which always asserts on Win32).
llvm-svn: 108802
2010-07-20 02:47:40 +00:00
Zhongxing Xu
3e02548d22
constify.
...
llvm-svn: 108801
2010-07-20 02:46:11 +00:00
Zhongxing Xu
c2acbe0f45
Constify.
...
llvm-svn: 108800
2010-07-20 02:41:28 +00:00
Zhongxing Xu
08ce5dd0f0
Add comments.
...
llvm-svn: 108795
2010-07-20 02:14:22 +00:00
Stuart Hastings
7d7bc561bf
Correct line info for declarations/definitions. Radar 8063111.
...
llvm-svn: 108785
2010-07-19 23:56:31 +00:00
Jim Grosbach
428a7103d9
and revert the related tests, too
...
llvm-svn: 108766
2010-07-19 22:53:57 +00:00
Jim Grosbach
50c63168ed
Temporarily revert. Some odd internal breakage is likely related.
...
llvm-svn: 108764
2010-07-19 22:43:34 +00:00
Sebastian Redl
3d3f0b1039
Remove PCHReader::getStream(), it was unused. Inline PCHReader::getDelsCursor() into its sole caller and remove it. This reduces the attack surface of multiple PCH files towards code outside the PCH implementation.
...
llvm-svn: 108763
2010-07-19 22:38:35 +00:00
Sebastian Redl
bd1b5befee
Promote IdentifierOffsets to per-file data.
...
llvm-svn: 108762
2010-07-19 22:28:42 +00:00
Sebastian Redl
9e687994f3
Promote DeclOffsets and TypeOffsets to per-file data.
...
llvm-svn: 108760
2010-07-19 22:06:55 +00:00
Fariborz Jahanian
3c7ebc3a5e
Patch to type match comparing Objective-C Classes which implement
...
protocols (Radar 8191774).
llvm-svn: 108758
2010-07-19 22:02:22 +00:00
Ted Kremenek
6cd694233d
Don't warn when a '%%' or '%*d' (scanf) is used in a format string with positional arguments, since
...
these don't actually consume an argument.
llvm-svn: 108757
2010-07-19 22:01:06 +00:00
Douglas Gregor
aa21cc401b
Introduce a new libclang API, clang_reparseTranslationUnit(), which
...
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance
optimizations.
llvm-svn: 108756
2010-07-19 21:46:24 +00:00
Jim Grosbach
6331d9781c
Update tests for r108749
...
llvm-svn: 108754
2010-07-19 21:39:14 +00:00
Ted Kremenek
ce81542d61
Hook up 'invalid conversion' warning for scanf format strings.
...
llvm-svn: 108750
2010-07-19 21:25:57 +00:00
Jim Grosbach
f699594de8
Put ObjC method names, method types and class names in separate string literal
...
sections. rdar://8207705
llvm-svn: 108749
2010-07-19 20:54:43 +00:00
Sebastian Redl
393f8b76c0
Promote the identifier table to per-file data. Also, if a CHAINED_METADATA record exists, it has to be the first thing in the PCH file.
...
llvm-svn: 108748
2010-07-19 20:52:06 +00:00
Ted Kremenek
f34f346dac
Put warnings in the 'Deprecated' group into a 'Deprecations' DiagCategory. Fixes <rdar://problem/8203182>.
...
llvm-svn: 108743
2010-07-19 20:20:06 +00:00
Ted Kremenek
5c3e1b9a54
Add missing conversion specifier parsing for 'u', 'x', 'o', and 's'. Fixes <rdar://problem/8204052>.
...
llvm-svn: 108742
2010-07-19 19:47:40 +00:00
Daniel Dunbar
99b5524324
Driver: Make -fnext-runtime the default when rewriting Objective-C.
...
llvm-svn: 108741
2010-07-19 19:44:22 +00:00
Daniel Dunbar
2c91be4261
IRgen: Add a test case I forgot to commit at some point.
...
llvm-svn: 108713
2010-07-19 17:11:38 +00:00
Daniel Dunbar
354e96df95
Driver/Darwin: Add deployment target after doing argument translation, so that
...
-mmacosx-version-min works inside a -Xarch_ flag.
llvm-svn: 108712
2010-07-19 17:11:36 +00:00
Daniel Dunbar
b2b8a91aa4
Driver: Factor out Darwin::AddDeploymentTarget.
...
llvm-svn: 108711
2010-07-19 17:11:33 +00:00
Douglas Gregor
549c1cd2c5
Remove unused location-to-AST-node resolver. libclang's implementation supercedes it
...
llvm-svn: 108708
2010-07-19 16:18:30 +00:00
Fariborz Jahanian
2a36089eef
Categories cannot synthesize property ivars,
...
and a minor cleanup.
llvm-svn: 108707
2010-07-19 16:14:33 +00:00
Rafael Espindola
77a067a653
Implement support for reading arguments specified in a file with @file . If
...
there is no file named "file", keep the @file option unchanged.
llvm-svn: 108697
2010-07-19 15:20:12 +00:00
Zhongxing Xu
eb2528104a
Fix construction of AnalysisContext. Thanks Daniel.
...
llvm-svn: 108694
2010-07-19 13:16:50 +00:00
Benjamin Kramer
1b925d5717
Adjust test for float printing differences. Windows uses three digits for the exponent, everyone else two.
...
llvm-svn: 108693
2010-07-19 11:48:10 +00:00
Argyrios Kyrtzidis
3816ed4d58
Fix http://llvm.org/PR7660
...
A ParmVarDecl instantiated from a FunctionProtoType may have Record as DeclContext,
in which case isStaticDataMember() will erroneously return true.
llvm-svn: 108692
2010-07-19 10:14:41 +00:00
Daniel Dunbar
00c57967da
Revert r108672, "Implement support for reading arguments specified in a file
...
with @file.", it doesn't correctly handle cases where arguments starting with
'@' are passed to other command line arguments.
llvm-svn: 108686
2010-07-19 07:21:12 +00:00
Chris Lattner
8d72f2aa3a
tidy up comment.
...
llvm-svn: 108676
2010-07-19 05:07:24 +00:00
Rafael Espindola
129e43d29b
Implement support for reading arguments specified in a file with @file .
...
llvm-svn: 108672
2010-07-19 03:08:01 +00:00
Zhongxing Xu
cf144c6322
fix test case.
...
llvm-svn: 108671
2010-07-19 02:06:14 +00:00
Zhongxing Xu
a74af93eaf
remove CallInliner.cpp.
...
llvm-svn: 108670
2010-07-19 01:55:38 +00:00
Zhongxing Xu
ec5623570e
Add double close check to StreamChecker. Patch by Lei Zhang.
...
llvm-svn: 108669
2010-07-19 01:52:29 +00:00
Zhongxing Xu
84f65e0692
Reapply r108617.
...
llvm-svn: 108668
2010-07-19 01:31:21 +00:00
Daniel Dunbar
e38764c66c
Driver: Change the driver to take the path to the main executable, instead of
...
taking it in pieces.
- Fixes a problem where the Clang executable path was not initialized properly
on Win32, because sys::Path::getBasename() doesn't do what I always think it
does. Imagine that, a sys::Path interface that is confusing!
llvm-svn: 108667
2010-07-19 00:44:04 +00:00
Daniel Dunbar
deaff5d792
Update for LLVM API change.
...
llvm-svn: 108665
2010-07-19 00:33:53 +00:00
Rafael Espindola
7661436220
Refactor the code a bit so that there is only one call to BuildCompilation. The
...
StringPointers vector will also be used in the normal case to handle @file
arguments.
llvm-svn: 108660
2010-07-18 22:03:55 +00:00
Daniel Dunbar
b31b76f1eb
Driver: Fix a possible use after free.
...
llvm-svn: 108659
2010-07-18 21:16:15 +00:00
Chandler Carruth
3973af797a
Fix a goof in my previous patch -- not all of the builtins return a value, some
...
fixed return types.
llvm-svn: 108657
2010-07-18 20:54:12 +00:00
Eli Friedman
f8340deacd
Fix mangling for static member variables of classes inside an extern "C"
...
linkage specification. Not sure if this is the ideal fix, but I'm reasonably
sure it's correct vs. gcc.
llvm-svn: 108656
2010-07-18 20:49:59 +00:00
Chris Lattner
e03a5745b1
daniel doesn't hate me, he hates macpython 2.5, which
...
is a very reasonable position on life!
llvm-svn: 108651
2010-07-18 18:42:35 +00:00
Peter Collingbourne
9e73cae25e
When instantiating function definitions set parameter names to those used in template
...
The rationale is that we are copying the entire definition including
parameter names which may differ between the declaration and the
definition.
This is particularly important if any parameters are unnamed in the
declaration, as a DeclRef to an unnamed ParmVarDecl would cause the
pretty printer to produce invalid output.
llvm-svn: 108643
2010-07-18 16:45:46 +00:00
Douglas Gregor
3efffd05d5
Revert -Wdiscard-qual typo
...
llvm-svn: 108641
2010-07-18 11:27:38 +00:00
Chandler Carruth
bc8cab16c5
Improve the representation of the atomic builtins in a few ways. First, we make
...
their call expressions synthetically have the "deduced" types based on their
first argument. We only insert conversions in the AST for arguments whose
values require conversion to match the value type expected. This keeps PR7600
closed by maintaining the return type, but avoids assertions due to unexpected
implicit casts making the type unsigned (test case added from Daniel).
The magic is moved into the codegen for the atomic builtin which inserts the
casts as needed at the IR level to raise the type to an integer suitable for
the LLVM intrinsic. This shouldn't cause any real change in functionality, but
now we can make the builtin be more truly polymorphic.
llvm-svn: 108638
2010-07-18 07:23:17 +00:00
Chris Lattner
ad4f38b1a9
BUILD_ARCHIVE is the default for libraries, no need to set it.
...
llvm-svn: 108633
2010-07-18 00:14:47 +00:00
Eli Friedman
3ee1022f37
Fix crash initializing a bit-field with a non-constant in a place where we
...
try to evaluate the initializer as a constant.
llvm-svn: 108632
2010-07-17 23:55:01 +00:00
Eli Friedman
e98194d9e8
Check for casts to an incomplete type in C. Improves diagnostics for cast to
...
incomplete union (PR5692) and incomplete enum, and fixes obscure
accepts-invalid on cast to incomplete struct.
llvm-svn: 108630
2010-07-17 20:43:49 +00:00
Fariborz Jahanian
aea8e1e3d2
Added PCH/ASTImporter code for ObjCIvarDecl's field.
...
llvm-svn: 108627
2010-07-17 18:35:47 +00:00
Chris Lattner
52c00bdd5b
Add another terrible VC++ compatibility hack: allow users to
...
allow invalid token pastes (when in -fms-extensions mode)
with -Wno-invalid-token-paste
llvm-svn: 108624
2010-07-17 16:24:30 +00:00
Chris Lattner
b2c4937ee4
rename test
...
llvm-svn: 108623
2010-07-17 16:18:46 +00:00
Chris Lattner
3e40dd34c4
rename test
...
llvm-svn: 108622
2010-07-17 16:17:41 +00:00
Benjamin Kramer
e2e031ed6f
Revert r108617, it broke the build.
...
llvm-svn: 108621
2010-07-17 13:51:58 +00:00
Zhongxing Xu
8de7966fd5
Fix cmake build.
...
llvm-svn: 108619
2010-07-17 11:59:16 +00:00
Zhongxing Xu
4ca4a999b1
Prepare the analyzer for the callee in another translation unit:
...
Let AnalysisContext contain a TranslationUnit.
Let CallEnter refer to an AnalysisContext instead of a FunctionDecl.
llvm-svn: 108617
2010-07-17 11:12:42 +00:00
Daniel Dunbar
05474285aa
clang -cc1as: Switch to using AsmParser constructor function.
...
llvm-svn: 108605
2010-07-17 02:26:21 +00:00
Ted Kremenek
b32964d02d
Fix '<rdar://problem/8202272> __imag passed non-complex should not crash' by removing a bogus assertion.
...
llvm-svn: 108602
2010-07-17 01:28:55 +00:00
Fariborz Jahanian
6a06144021
Another test case for on demand synthesis of ivars.
...
llvm-svn: 108600
2010-07-17 01:16:59 +00:00