Anders Carlsson
6bbd268396
Add a CXXExceptions flag to LangOptions.
...
llvm-svn: 126299
2011-02-23 03:04:54 +00:00
Ted Kremenek
204f1d26d4
Add doxygen comments to Sema::DiagRuntimeBehavior().
...
llvm-svn: 126296
2011-02-23 02:26:43 +00:00
Ted Kremenek
ef59fe7845
Add test case (from PR 8876) for suppressing 'indirection of non-volatile null pointer...' warning due to reachability analysis.
...
llvm-svn: 126294
2011-02-23 02:15:19 +00:00
Peter Collingbourne
4b66c47a16
Sema: diagnose kernel calls to non-global functions
...
llvm-svn: 126292
2011-02-23 01:53:29 +00:00
Ted Kremenek
477c8f5440
Add test case for PR 9284, a false positive for -Warray-bounds that is now addressed using basic reachability analysis.
...
llvm-svn: 126291
2011-02-23 01:52:07 +00:00
Ted Kremenek
3427fac7c8
Enhance Sema::DiagRuntimeBehavior() to delay some diagnostics to see if the related code is reachable. This suppresses some
...
diagnostics that occur in unreachable code (e.g., -Warray-bound).
We only pay the cost of doing the reachability analysis when we issue one of these diagnostics.
llvm-svn: 126290
2011-02-23 01:52:04 +00:00
Ted Kremenek
80861ca9b5
Migrate CFGReachabilityAnalysis out of the IdempotentOperationsChecker and into its own analysis file.
...
llvm-svn: 126289
2011-02-23 01:51:59 +00:00
Ted Kremenek
cc7f1f8c2e
Have IdempotentOperationsChecker pull its CFGStmtMap from AnalysisContext.
...
llvm-svn: 126288
2011-02-23 01:51:53 +00:00
Ted Kremenek
1767a27b3e
Issue AnalysisBasedWarnings as part of calling Sema::PopBlockOrFunctionScope(). No real functionality change.
...
llvm-svn: 126287
2011-02-23 01:51:48 +00:00
Ted Kremenek
55ae319a28
Update Sema::DiagRuntimeBehavior() to take an optional Stmt* to indicate the code the diagnostic is associated with.
...
This Stmt* is unused, but we will use it shortly for pruning diagnostics associated
with unreachable code.
llvm-svn: 126286
2011-02-23 01:51:43 +00:00
Ted Kremenek
db3333df71
Change -Warray-bounds logic to use DiagRuntimeBehavior in preparation for using basic dataflow to suppress warnings on unreachable array bounds checks.
...
llvm-svn: 126285
2011-02-23 01:51:40 +00:00
Argyrios Kyrtzidis
dff865d10b
[analyzer] Migrate to CheckerV2:
...
CastToStructChecker
FixedAddressChecker
MacOSXAPIChecker
PointerArithChecker
PointerSubChecker
PthreadLockChecker
UnixAPIChecker
llvm-svn: 126284
2011-02-23 01:05:36 +00:00
Chandler Carruth
1aef0c5621
Switch the VerifyDiagnosticsClient to use PresumedLocs now that they
...
exist. Cheat and do this by adding some wrappers around the PresumedLoc
machinery that directly return the line and column number.
llvm-svn: 126281
2011-02-23 00:47:48 +00:00
Richard Smith
bb7dcf59a0
Update the www to indicate that auto is now implemented.
...
llvm-svn: 126280
2011-02-23 00:41:16 +00:00
Richard Smith
2abf6767e3
Fix PR9276: We were missing the checks for auto deducing to different types in the same declaration group in the template instantiation case.
...
llvm-svn: 126279
2011-02-23 00:37:57 +00:00
Argyrios Kyrtzidis
dd058d8a50
[analyzer] Migrate the BasicObjCFoundationChecks to CheckerV2:
...
NilArgChecker
CFNumberCreateChecker
ClassReleaseChecker
llvm-svn: 126275
2011-02-23 00:16:10 +00:00
Argyrios Kyrtzidis
22f2586bfb
[analyzer] Fix CheckerManager::runCheckersForObjCMessage.
...
It would run PostObjCMessage checkers even for PreObjCMessage checking.
llvm-svn: 126274
2011-02-23 00:16:07 +00:00
Argyrios Kyrtzidis
9631dbe5ce
Silence a MSVC warning.
...
llvm-svn: 126273
2011-02-23 00:16:04 +00:00
Argyrios Kyrtzidis
a1540db6e4
[analyzer] Refactor BugTypes and their ownership model.
...
-In general, don't have the BugReporter deleting BugTypes, BugTypes will eventually become owned by checkers
and outlive the BugReporter. In the meantime, there will be some leaks since some checkers assume that
the BugTypes they create will be destroyed by the BugReporter.
-Have BugReporter::EmitBasicReport create BugTypes that are reused if the same name & category strings
are passed to EmitBasicReport. These BugTypes are owned and destroyed by the BugReporter.
This allows bugs reported through EmitBasicReport to be coalesced.
-Remove the llvm::FoldingSet<BugReportEquivClass> from BugType and move it into the BugReporter.
For uniquing BugReportEquivClass also use the BugType* so that we can iterate over all of them using only one set.
llvm-svn: 126272
2011-02-23 00:16:01 +00:00
Argyrios Kyrtzidis
b9abca0000
In the clang.xcodeproj modify the 'clang' target to do nothing, not try to build anything.
...
llvm-svn: 126270
2011-02-23 00:15:56 +00:00
Fariborz Jahanian
82ff1e52df
Better parser recovery when method is
...
errornously defined inside an objc class.
// rdar://7029784
llvm-svn: 126269
2011-02-23 00:11:21 +00:00
Richard Smith
e97a53a446
DeclGroup's operator[] always returned the first Decl in the group.
...
llvm-svn: 126268
2011-02-23 00:09:59 +00:00
Matt Beaumont-Gay
06de2553f3
Clean up the error recovery at the bottom of Sema::LookupMemberExpr. This
...
mostly just shuffles various possibilities for recovery into a more
straightforward order, but also unifies a couple of diagnostics.
llvm-svn: 126266
2011-02-22 23:52:53 +00:00
Douglas Gregor
385d3fd97d
When checking for abstract types, don't crash when we have a
...
FunctionProtoTypeLoc with NULL function parameter types, which can
occur in invalid code. Fixes PR9247 / <rdar://problem/9037911>.
llvm-svn: 126262
2011-02-22 23:21:06 +00:00
Fariborz Jahanian
bb6db56028
Provide Fixit warning when 'auto' is intended as storage
...
specifier in legacy code. Patch is reviewed offline by Doug.
// rdar://9036633.
llvm-svn: 126261
2011-02-22 23:17:49 +00:00
John McCall
147d021b75
Emit the structure layout of the block literal parameter to a block
...
invocation function into the debug info. Rather than faking up a class,
which is tricky because of the custom layout we do, we just emit a struct
directly from the layout information we've already got.
Also, don't emit an unnecessarily parameter alloca for this "variable".
llvm-svn: 126255
2011-02-22 22:38:33 +00:00
John McCall
550d13aebb
Give ImplicitParamDecl a public constructor so that it can be allocated on
...
the stack.
llvm-svn: 126254
2011-02-22 22:25:56 +00:00
John McCall
b67608fe83
Provide a Decl::getNonClosureContext to look through any "closure" (i.e.
...
block and, eventually, C++ lambda) contexts.
llvm-svn: 126252
2011-02-22 22:25:23 +00:00
Douglas Gregor
996a735b88
We need a longer long when testing this pathe Microsoft fixed-underlying-type extension for enumeration types
...
llvm-svn: 126250
2011-02-22 21:42:31 +00:00
Devang Patel
b6ed369e77
A constructor call should force class's debug info even if -flimit-debug-info is enabled.
...
llvm-svn: 126246
2011-02-22 20:55:26 +00:00
Chris Lattner
ba9006df9e
improve support for SUSE Linux Enterprise Server 11 SP1 (x86_64).
...
Patch by Csaba Raduly!
llvm-svn: 126245
2011-02-22 20:47:07 +00:00
Douglas Gregor
a1aec29a2d
Enable enumeration types with a fixed underlying type, e.g.,
...
enum X : long { Value = 0x100000000 };
when in Microsoft-extension mode (-fms-extensions). This (now C++0x)
feature has been supported since Microsoft Visual Studio .NET 2003.
llvm-svn: 126243
2011-02-22 20:32:04 +00:00
Matt Beaumont-Gay
7a24210ebd
Use an unused-except-in-Debug variable.
...
llvm-svn: 126240
2011-02-22 20:00:16 +00:00
Devang Patel
d7185b755d
Use LLVM coding standard.
...
llvm-svn: 126232
2011-02-22 18:56:36 +00:00
Douglas Gregor
e2f943b5cb
Implement the GNU C extension which permits the initialization of an
...
array from a constant array compound literal. Fixes PR9261.
llvm-svn: 126230
2011-02-22 18:29:51 +00:00
Argyrios Kyrtzidis
ed35cf271d
[analyzer] Start moving the path-sensitive checkers to CheckerV2.
...
-Migrate ObjCSelfInitChecker to CheckerV2. In the process remove the 'preCallSelfFlags' field
from the checker class and use GRState for storing that info.
-Get ExprEngine to start delegating checker running to CheckerManager.
llvm-svn: 126229
2011-02-22 17:30:38 +00:00
Argyrios Kyrtzidis
98e35dda03
[analyzer] Separate CheckerContext into its own include file. No functionality change.
...
llvm-svn: 126228
2011-02-22 17:30:32 +00:00
Argyrios Kyrtzidis
b9eae65c63
[analyzer] Fix GRStatePartialTrait<bool> and introduce GRStatePartialTrait<unsigned>.
...
llvm-svn: 126227
2011-02-22 17:30:28 +00:00
Joerg Sonnenberger
fe74286a48
Remove the storage for -cxx-system-include. Make libcxx toolchain
...
use -nostdinc++ and -cxx-isystem.
llvm-svn: 126223
2011-02-22 15:19:35 +00:00
Peter Collingbourne
f29ce975ba
Reimplement __pragma support using a TokenLexer
...
llvm-svn: 126221
2011-02-22 13:49:06 +00:00
Peter Collingbourne
2c9f966600
Make TokenLexer capable of storing preprocessor directive tokens
...
llvm-svn: 126220
2011-02-22 13:49:00 +00:00
Oscar Fuentes
e16dc2a6e7
CMAKE_EXECUTABLE_SUFFIX is undefined when a cmake script is executed
...
with cmake -P ... so we need to deduce the correct executable prefix.
Fixes PR9286.
llvm-svn: 126219
2011-02-22 13:05:15 +00:00
John McCall
9e2e22f5c6
Establish the iteration variable of an ObjC for-in loop before
...
emitting the collection expression. Fixes some really, really broken
code.
llvm-svn: 126193
2011-02-22 07:16:58 +00:00
John McCall
c533cb7008
Reorganize the emission of local variables.
...
llvm-svn: 126189
2011-02-22 06:44:22 +00:00
Ted Kremenek
fb1a79af7a
Add CStringChecker support for strncpy. Patch by Lenny Maiorani!
...
llvm-svn: 126188
2011-02-22 04:58:34 +00:00
Ted Kremenek
280a01fa1b
Add CStringChecker support for strnlen. Patch by Lenny Maiorani!
...
llvm-svn: 126187
2011-02-22 04:55:05 +00:00
NAKAMURA Takumi
f8a6e802f9
lib/CodeGen/TargetInfo.cpp: On Win64, arg i128 should be emitted as INDIRECT.
...
mingw-w64's i128 tweak should be done with x86_64-mingw32.
llvm-svn: 126186
2011-02-22 03:56:57 +00:00
Douglas Gregor
6cd5ae4dfa
Fix a little bug in the handling of enumeration types with a fixed
...
underlying type: we weren't parsing unnamed enumeration types with a
fixed underlying type.
llvm-svn: 126184
2011-02-22 02:55:24 +00:00
Douglas Gregor
a78f193e7e
Warn about implicit conversions between values of different, named
...
enumeration types. Fixes <rdar://problem/8559831>.
llvm-svn: 126183
2011-02-22 02:45:07 +00:00
Anders Carlsson
3320e1575f
Make clang -cc1 disable Objective-C exceptions by default, and add a -fobjc-exceptions flag to turn them on.
...
Update all tests accordingly.
llvm-svn: 126177
2011-02-22 01:52:06 +00:00
Anders Carlsson
4fc229ef69
Move some Objective-C tests to SemaObjC and CodeGenObjC.
...
llvm-svn: 126175
2011-02-22 01:23:29 +00:00
Richard Smith
23eb9f707b
In Objective-C, there are no trailing return types, so don't produce diagnostics suggesting they are missing.
...
llvm-svn: 126174
2011-02-22 01:22:29 +00:00
Joerg Sonnenberger
cc9c8eb837
Bug#8945: Add -cxx-isystem option to specify C++ system directories.
...
It works like -isystem and the search path keeps -isystem and
-cxx-isystem in order relative to each other. -cxx-isystem is only used
for C++ sources though. Drop the existing -cxx-system-include option for
cc1 as it is now redundant.
llvm-svn: 126167
2011-02-22 00:40:56 +00:00
Richard Smith
59006e4338
Fix a few auto-related issues:
...
* 'auto' was being rejected on abstract-declarators with trailing return
types and on typedefs with trailing return types. 'auto' is always
allowed in these cases. This was found while testing the fix for PR 9278.
* A very poor diagnostic was being issued for auto (f() -> int): "return
type must be 'auto', not 'auto'". This is closely related to PR 9060.
* Trailing return type handling was happening slightly too late,
resulting in the checks for functions returning arrays and functions
returning functions being missed.
llvm-svn: 126166
2011-02-22 00:36:53 +00:00
Richard Smith
e51cb7dedf
Add reference to PR 9278 for archaeologists.
...
llvm-svn: 126164
2011-02-22 00:19:36 +00:00
Fariborz Jahanian
d7b0cb5388
Warn when type modifiers on objc method declarations in
...
protocols do not match with method implementation.
// rdar://7076235
llvm-svn: 126162
2011-02-21 23:49:15 +00:00
David Chisnall
055f064756
The instance size of a metaclass should be the size of a class. This is not, in fact, 0, even for very small classes. (GNU runtime)
...
llvm-svn: 126161
2011-02-21 23:47:40 +00:00
Richard Smith
27e39b11b1
C++0x's deduced auto is illegal in typedefs.
...
This actually rules out too much, since it also catches typedefs for pointers to functions with trailing return types:
typedef auto (*F)() -> int;
Fix for that (and the same issue in all abstract-declarators) to follow shortly.
llvm-svn: 126153
2011-02-21 23:18:00 +00:00
Daniel Dunbar
13adc7fefd
Targets/Darwin: mcount name on Darwin needs to be unmangled.
...
llvm-svn: 126152
2011-02-21 23:12:51 +00:00
Ted Kremenek
828f631af1
Fix a CFGBuilder bug exposed on convoluted control-flow in the Linux kernel.
...
llvm-svn: 126149
2011-02-21 22:11:26 +00:00
Chris Lattner
93ede02045
add one more case of mismatched input/output constraints.
...
When the mismatch is due to a larger input operand that is
a constant, truncate it down to the size of the output. This
allows us to accept some cases in the linux kernel and elsewhere.
Pedantically speaking, we generate different code than GCC, though
I can't imagine how it would matter:
Clang:
movb $-1, %al
frob %al
GCC:
movl $255, %eax
frob %al
llvm-svn: 126148
2011-02-21 22:09:29 +00:00
Chris Lattner
e3694b166a
more code restructuring, no functionality change.
...
llvm-svn: 126146
2011-02-21 21:50:25 +00:00
Chris Lattner
70a4e9b5e2
split the iteration loop out to a helper function, no functionality change.
...
llvm-svn: 126145
2011-02-21 21:40:33 +00:00
Chris Lattner
169766f306
fix a comment.
...
llvm-svn: 126143
2011-02-21 21:15:10 +00:00
Stuart Hastings
b6a4d3ebd2
Test case for r126127 and r126141. Radar 9012638.
...
llvm-svn: 126142
2011-02-21 21:08:21 +00:00
Richard Smith
5503805555
Mangling of undeduced 'auto' types, as specified by Itanium C++ ABI.
...
llvm-svn: 126140
2011-02-21 20:10:02 +00:00
Richard Smith
b2bc2e6752
Tweaks to C++0x deduced auto type support:
...
* Flag indicating 'we're parsing this auto typed variable's initializer' moved from VarDecl to Sema
* Temporary template parameter list for auto deduction is now allocated on the stack.
* Deduced 'auto' types are now uniqued.
llvm-svn: 126139
2011-02-21 20:05:19 +00:00
Ted Kremenek
bda17491c4
Fix call to send_error() in scan-view. An int error code is expected but a string was being sent. Patch by Andrew Price!
...
llvm-svn: 126138
2011-02-21 19:26:48 +00:00
John McCall
15dd404c46
Don't warn about static const integral data members with in-line constant
...
initializers just because they don't have a proper out-of-line definition.
Such code is technically ill-formed but is too common and too unlikely to be
a problem to be seriously worth worrying about.
llvm-svn: 126137
2011-02-21 19:25:48 +00:00
Fariborz Jahanian
786e04cda5
Turn on 'auto' in plain objc mode.
...
llvm-svn: 126134
2011-02-21 18:37:13 +00:00
Chris Lattner
d0257f79bc
Pass the right linker flag in openbsd::Link::ConstructJob,
...
patch by Matthew Dempsky!
llvm-svn: 126133
2011-02-21 18:36:51 +00:00
Fariborz Jahanian
f5bfc46c95
Remove warning on future change in ivar lookup rule
...
when doing the property default synthesis.
// rdar://9027673.
llvm-svn: 126128
2011-02-21 17:31:28 +00:00
John McCall
5decec97e5
Reorganize subelement initialization checking, no functionality change.
...
llvm-svn: 126116
2011-02-21 07:57:55 +00:00
John McCall
66884dd93c
Small optimization: avoid redundant checks of whether a type is an array
...
when checking an initialization.
llvm-svn: 126115
2011-02-21 07:22:22 +00:00
John McCall
701417a0ac
Pseudo-revirtualize CallExpr::getSourceRange by making it follow the
...
logic from CXXMemberCallExpr and by making it check for
CXXOperatorCallExpr in order to defer. This is not really an awesome solution,
but I don't have a better idea.
llvm-svn: 126114
2011-02-21 06:23:05 +00:00
John McCall
e9dab636df
Bind references to opaque r-values correctly. Add a few test cases
...
for ?: on record types.
llvm-svn: 126113
2011-02-21 05:25:38 +00:00
NAKAMURA Takumi
19c9fb6cbc
CMake: Eliminate duplicate -D__STDC_LIMIT_MACROS and -D__STDC_CONSTANT_MACROS. llvm/cmake/modules/HandleLLVMOptions.cmake defines them.
...
llvm-svn: 126105
2011-02-21 03:19:49 +00:00
John McCall
f2e9110a9f
Rename test/CodeGenCXX/gnu-conditional-scalar-ext.cpp to conditional-gnu-ext.cpp
...
for consistency with other tests (and to remove "scalar" from the name).
llvm-svn: 126104
2011-02-21 02:28:50 +00:00
Chandler Carruth
d05b352b0e
Clean up the tests for warning about unused function results given the
...
appropriate attribute. Add a bit more testing that finds a pretty bad
regression (since ~forever) in this warning. Fix it with a nice 2 line
change. =]
llvm-svn: 126098
2011-02-21 00:56:56 +00:00
Chandler Carruth
468b5cbd40
Allow -Wformat to be enabled without -Wformat-security. GCC gates
...
-Wformat-security on -Wformat, not vice-versa.
Fixes PR8486. Patch by Oleg Slezberg.
llvm-svn: 126096
2011-02-21 00:07:51 +00:00
Oscar Fuentes
15fe190027
Put targets on folders, if the IDE supports the feature.
...
Requires CMake 2.8.3 or newer.
llvm-svn: 126094
2011-02-20 22:06:44 +00:00
Oscar Fuentes
6f72540e46
New function for tablegenning: clang_tablegen.
...
llvm-svn: 126093
2011-02-20 22:06:32 +00:00
Oscar Fuentes
e9c7994669
Correct name of dependent target.
...
CMake complained about this while generating VS project files but was
okay with it while generating makefiles on Linux.
llvm-svn: 126090
2011-02-20 19:41:34 +00:00
Daniel Dunbar
bd466d404a
tests: Fix test on Win32.
...
llvm-svn: 126087
2011-02-20 17:41:24 +00:00
Benjamin Kramer
ae1e5c250c
Remove unused function.
...
llvm-svn: 126084
2011-02-20 16:04:14 +00:00
Richard Smith
7ee0d5664e
Turn on __has_feature(cxx_auto_type). The feature is now fully implemented.
...
llvm-svn: 126078
2011-02-20 12:13:05 +00:00
Daniel Dunbar
67e556249c
Remove a dead variable.
...
llvm-svn: 126073
2011-02-20 06:15:13 +00:00
Richard Smith
30482bc786
Implement the C++0x deduced 'auto' feature.
...
This fixes PR 8738, 9060 and 9132.
llvm-svn: 126069
2011-02-20 03:19:35 +00:00
Ken Dyck
6d90e8937c
Expand use of CharUnits in LayoutField(). No change in functionality
...
intended.
llvm-svn: 126066
2011-02-20 02:06:09 +00:00
Ken Dyck
d24099de04
Add const qualifier to getTypeInfoInChars().
...
llvm-svn: 126064
2011-02-20 01:55:18 +00:00
Richard Smith
1daeacbda8
Test commit.
...
llvm-svn: 126063
2011-02-20 00:59:54 +00:00
Anders Carlsson
08ce5ed1b1
Add a LangOptions::areExceptionsEnabled and start using it.
...
llvm-svn: 126062
2011-02-20 00:20:27 +00:00
Anders Carlsson
ce8dd3a5d4
Add a new ObjCExceptions member variable to LangOptions. This controls whether Objective-C exceptions are enabled or not (they are by default).
...
llvm-svn: 126061
2011-02-19 23:53:54 +00:00
Peter Collingbourne
8f5cf74c77
Re-instate r125819 and r125820 with no functionality change
...
llvm-svn: 126060
2011-02-19 23:03:58 +00:00
Chris Lattner
29eb47bd68
Fix PR9253, allowing attribute(aligned) to reduce the alignment of
...
a typedef.
llvm-svn: 126059
2011-02-19 22:55:41 +00:00
Douglas Gregor
5b05454f24
Don't produce "comparison is always (true|false)" warnings when the
...
comparison itself is a constant expression. Fixes PR7536.
llvm-svn: 126057
2011-02-19 22:34:59 +00:00
Chris Lattner
b0ed51da10
implement a tiny amount of codegen support for gnu array range
...
designators: allowing codegen when the element initializer is a
constant or something else without a side effect. This unblocks
enough to let process.c in the linux kernel build, PR9257.
llvm-svn: 126056
2011-02-19 22:28:58 +00:00
Douglas Gregor
d66828daf6
In addition to in-class member functions marked with the "used"
...
attribute, we also care about those with the "constructor"
attribute. Fixes PR6521.
llvm-svn: 126055
2011-02-19 21:54:50 +00:00
Anders Carlsson
b94ad3ec22
There's no need to return early if we encounter a try/throw and exceptions are disabled.
...
llvm-svn: 126053
2011-02-19 21:53:09 +00:00
Rafael Espindola
a6d2bff0c5
Revert 125820 and 125819 to fix PR9266.
...
llvm-svn: 126050
2011-02-19 21:39:31 +00:00