Commit Graph

29498 Commits

Author SHA1 Message Date
Fariborz Jahanian 3b9819b4a2 Fix lookup for class messages sent to qualified-class
types such that protocols are seached first. Fixes
// rdar://9224670

llvm-svn: 129016
2011-04-06 18:40:08 +00:00
Eric Christopher 534b6a01e8 Add support for Fedora16, gcc 4.6.0 and Fedora Rawhide.
Patch by Bobby Powers

llvm-svn: 129014
2011-04-06 18:22:53 +00:00
John Thompson 9bfba16a66 Added link to LLVM cmake page in Visual Studio section.
llvm-svn: 129013
2011-04-06 18:22:12 +00:00
Fariborz Jahanian 5de5313abe Refine rules for atomic property api to
pass a previously failing clang test.
// rdar://8808439

llvm-svn: 129004
2011-04-06 16:05:26 +00:00
Peter Collingbourne ba3e6667cc Do not use IR marker for LLVM intrinsics
llvm-svn: 129001
2011-04-06 12:29:09 +00:00
Peter Collingbourne eafa4e4b5b If this is an intrinsic function, set the function's attributes to the intrinsic's attributes.
llvm-svn: 129000
2011-04-06 12:29:04 +00:00
John McCall 3337ca5f95 When updating the retain summary based on {cf,ns}_consumed attributes,
be sure to consume the argument index that actually had the attribute
rather than always the first.  rdar://problem/9234108

llvm-svn: 128998
2011-04-06 09:02:12 +00:00
John McCall b1915d62a7 Make this a -cc1 test with a triple and a target feature.
llvm-svn: 128993
2011-04-06 06:48:04 +00:00
John McCall 3cacdf5dbb Anonymify this test.
llvm-svn: 128987
2011-04-06 04:29:52 +00:00
John McCall 91a528841b Implement the AVX cmp builtins as macros instead of static inlines.
Patch by Syoyo Fujita!  Reviewed by Chris Lattner!  Checked in by me!

llvm-svn: 128984
2011-04-06 03:37:51 +00:00
John McCall c5e6b97523 Diagnose a missing ')' on what looks like a statement expression.
A situation where we can get an invalid ExprResult without an error.
Fixes PR8394.  Patch by Justin Bogner!

llvm-svn: 128979
2011-04-06 02:35:25 +00:00
John McCall 75ca6d72c2 Fix getLocForEndOfToken to not double-count spurious internal characters
within a token, like trigraphs and escaped newlines.               
Patch by Marcin Kowalczyk!

llvm-svn: 128978
2011-04-06 01:50:22 +00:00
Devang Patel f3d881c840 Add a test case for r128957. It fixed a bug!
llvm-svn: 128966
2011-04-06 00:01:52 +00:00
Devang Patel 78019ec14d Simplify.
llvm-svn: 128957
2011-04-05 23:26:36 +00:00
Fariborz Jahanian 10a95ca876 Fixes a regression caused by my last patch.
As a result, I had to remove a c++ version of a clang
test which requires more scrutiny on my part.

llvm-svn: 128950
2011-04-05 23:01:27 +00:00
Devang Patel b87c428055 Emit debug info for function template parameters.
llvm-svn: 128948
2011-04-05 22:54:11 +00:00
Ted Kremenek 43d47cc397 Add ToolChain support to get Clang to recognize Ubuntu/ppc and Gentoo/ppc64.
llvm-svn: 128944
2011-04-05 22:04:27 +00:00
Fariborz Jahanian 0f4c711895 Generate atomic api for atomic properties (x86 and x86_64
targets) when load/store results in multiple instructions.
// rdar://8808439

llvm-svn: 128937
2011-04-05 21:41:23 +00:00
Chandler Carruth 78c7e34485 Commit a bit of a hack to fully handle the situation where variables are
marked explicitly as uninitialized through direct self initialization:

  int x = x;

With r128894 we prevented warnings about this code, and this patch
teaches the analysis engine to continue analyzing subsequent uses of
'x'. This should wrap up PR9624.

There is still an open question of whether we should suppress the
maybe-uninitialized warnings resulting from variables initialized in
this fashion. The definitely-uninitialized uses should always be warned.

llvm-svn: 128932
2011-04-05 21:36:30 +00:00
Devang Patel e1dd424380 Remove unintentional check-in.
llvm-svn: 128928
2011-04-05 21:05:56 +00:00
Roman Divacky 27ec14fad7 Enable sse4 and aes for SandyBridge. Leave avx support commented out for now.
llvm-svn: 128923
2011-04-05 20:32:44 +00:00
Devang Patel 095421b4a8 Fix typo.
llvm-svn: 128921
2011-04-05 20:28:21 +00:00
Lenny Maiorani de909e4946 Add security syntax checker for strcat() which causes the Static Analyzer to generate a warning any time the strcat() function is used with a note suggesting to use a function which provides bounded buffers. CWE-119.
Also, brings the security syntax checker more inline with coding standards.

llvm-svn: 128916
2011-04-05 20:18:46 +00:00
Devang Patel 98d26c91da Use TemplateParameterList to extract template parameter name.
llvm-svn: 128915
2011-04-05 20:15:06 +00:00
Andrew Trick 15e36e8edd Added *hidden* flags -print-options and -print-all-options so
developers can see if their driver changed any cl::Option's. The
current implementation isn't perfect but handles most kinds of
options. This is nice to have when decomposing the stages of
compilation and moving between different drivers. It's also a good
sanity check when comparing results produced by different command line
invocations that are expected to produce the comparable results.

Note: This is not an attempt to prolong the life of cl::Option. On the
contrary, it's a placeholder for a feature that must exist when
cl::Option is replaced by a more appropriate framework. A new
framework needs: a central option registry, dynamic name lookup,
non-global containers of option values (e.g. per-module,
per-function), *and* the ability to print options values and their defaults at
any point during compilation.

llvm-svn: 128911
2011-04-05 18:56:55 +00:00
Andrew Trick b2a84726f6 whitespace
llvm-svn: 128908
2011-04-05 18:49:32 +00:00
Chandler Carruth dd8f0d0525 Simplify the tracking of when to issue a fixit hint, making the helper
function more clear and obvious in behavior.

Add some comments documenting the behavior of the primary diagnostic helper.

llvm-svn: 128901
2011-04-05 18:27:05 +00:00
Chandler Carruth 7a0372023a Separate the logic for issuing the initialization fixit hint from the
diagnostic emission. The fixit hint, when suggested, typically has
nothing to do with the nature or form of the reference.

llvm-svn: 128899
2011-04-05 18:18:08 +00:00
Chandler Carruth 895904da51 Begin refactoring the uninitialized warning code that I uglied up. This
extracts a function to handle the emission of the diagnostic separately
from the walking over the set of uninitialized uses.

Also updates the naming used within this extracted function to be a bit
more consistent with the rest of Clang's naming patterns.

The next step will be breaking this apart so that we can go through
different functions rather than tracking so many boolean variables.

llvm-svn: 128898
2011-04-05 18:18:05 +00:00
Michael J. Spencer 7692db3ea2 Fix spelling.
llvm-svn: 128896
2011-04-05 17:57:51 +00:00
Chandler Carruth b5d4831f83 Fix PR9624 by explicitly disabling uninitialized warnings for direct self-init:
int x = x;

GCC disables its warnings on this construct as a way of indicating that
the programmer intentionally wants the variable to be uninitialized.
Only the warning on the initializer is turned off in this iteration.

This makes the code a lot more ugly, but starts commenting the
surprising behavior here. This is a WIP, I want to refactor it
substantially for clarity, and to determine whether subsequent warnings
should be suppressed or not.

llvm-svn: 128894
2011-04-05 17:41:31 +00:00
Devang Patel 7522abd3ce Refactor.
llvm-svn: 128893
2011-04-05 17:30:54 +00:00
David Chisnall ec343e8544 Fix copy-and-paste bug that I introduced while tidying up the code.
Does anyone want to buy me a new brain?

llvm-svn: 128890
2011-04-05 17:15:18 +00:00
Eric Christopher 1d70625970 Make this const, there's probably no harm in it and it silences a bunch
of warnings when passing const arguments into the function.

Fixes PR9426

llvm-svn: 128880
2011-04-05 07:54:42 +00:00
Chandler Carruth 4e02182a74 Cleanup the style of some of this code prior to functional changes.
I think this moves the code in the desired direction of the new style
recommendations (and style conventional in Clang), but if anyone prefers
the previous style, or has other suggestions just chime in and I'll
follow up.

llvm-svn: 128878
2011-04-05 06:48:00 +00:00
Chandler Carruth 7f3654f65c Refactor one helper function to merely forward to another so that there
is a single implementation. No functionality change intended.

llvm-svn: 128877
2011-04-05 06:47:57 +00:00
NAKAMURA Takumi 584f2de0a3 docs/UsersManual.html: Fix some inconsistent HTML elements.
llvm-svn: 128876
2011-04-05 04:31:31 +00:00
NAKAMURA Takumi a33296392e docs/UsersManual.html: """ize in a paragraph. A few unpaired quotations might confuse HTML-aware text edtors.
llvm-svn: 128871
2011-04-05 00:57:02 +00:00
Sandeep Patel 45df3dd3fe Set AAPCS-VFP calling convention accordingly and hard float ABI command handling.
llvm-svn: 128866
2011-04-05 00:23:47 +00:00
Ted Kremenek 75bb01b47d Filter our experimental checks in scan-build's checker listing.
llvm-svn: 128865
2011-04-05 00:21:49 +00:00
Argyrios Kyrtzidis cbef9ca22a Fix building with gcc.
llvm-svn: 128863
2011-04-05 00:14:22 +00:00
Ted Kremenek 378819342e Fix PR 9626 (duplicated self-init warnings under -Wuninitialized) with numerous CFG and UninitializedValues analysis changes:
1) Change the CFG to include the DeclStmt for conditional variables, instead of using the condition itself as a faux DeclStmt.
2) Update ExprEngine (the static analyzer) to understand (1), so not to regress.
3) Update UninitializedValues.cpp to initialize all tracked variables to Uninitialized at the start of the function/method.
4) Only use the SelfReferenceChecker (SemaDecl.cpp) on global variables, leaving the dataflow analysis to handle other cases.

The combination of (1) and (3) allows the dataflow-based -Wuninitialized to find self-init problems when the initializer
contained control-flow.

llvm-svn: 128858
2011-04-04 23:29:12 +00:00
Devang Patel 44927690c3 Eliminate conservative check that is covered by isIncompleteType() check.
llvm-svn: 128857
2011-04-04 23:23:39 +00:00
Devang Patel a540f1462c Incomplete type does not have any size.
llvm-svn: 128855
2011-04-04 23:18:38 +00:00
Argyrios Kyrtzidis 0e93ac675e Also update CMakeList.txt
llvm-svn: 128854
2011-04-04 23:17:56 +00:00
Argyrios Kyrtzidis 02d32aec00 Add missing file for my previous commit.
llvm-svn: 128853
2011-04-04 23:16:36 +00:00
Argyrios Kyrtzidis 5cf423ec8a Move Driver::createInvocationFromArgs function to Frontend library to avoid dependency cycle
between libFrontend and libDriver.

llvm-svn: 128852
2011-04-04 23:11:45 +00:00
Sandeep Patel f87b3739cc Explain why layout prefers 32 for small types on Thumb.
llvm-svn: 128850
2011-04-04 22:58:12 +00:00
Argyrios Kyrtzidis 3657c006cc Change test/Analysis/idempotent-operations.c to output the .plist file in the test output directory.
llvm-svn: 128849
2011-04-04 22:30:01 +00:00
Argyrios Kyrtzidis f606b82e9a Introduce Driver::createInvocationFromArgs used to create a CompilerInvocation from command-line args.
llvm-svn: 128848
2011-04-04 21:38:51 +00:00
Ted Kremenek b8d8c4ec56 -Wuninitialized: use "self-init" warning when issue uninitialized values warnings from the dataflow analysis that include within the initializer of a variable.
llvm-svn: 128843
2011-04-04 20:56:00 +00:00
Devang Patel 84852bbb42 Revert r128770, r128771, r128773 and r128776 for now. It breaks debug info.
llvm-svn: 128842
2011-04-04 20:36:06 +00:00
Ted Kremenek 352a7081a8 -Wuninitialized: don't warn about uninitialized variables in unreachable code.
llvm-svn: 128840
2011-04-04 20:30:58 +00:00
Ted Kremenek 35d800c39f -Wuninitialized: don't issue fixit for initializer if a variable declaration already has an initializer.
llvm-svn: 128838
2011-04-04 19:43:57 +00:00
Ted Kremenek 99a337eed0 When emitting a "too many arguments to function call..." error, also include a note with a location for the function prototype.
llvm-svn: 128833
2011-04-04 17:22:27 +00:00
Bob Wilson e3a15fed08 Change ARM data layout strings to match llvm-gcc.
Sandeep Patel noticed that the alignment was wrong for Neon vector types,
and this change is partly derived from his patch.  For the APCS ABI, however,
additional changes were required: the maximum ABI alignment is 32 bits and
the preferred alignment for i64 and f64 types should be 64 bits.

llvm-svn: 128825
2011-04-04 16:53:11 +00:00
NAKAMURA Takumi ce60187a89 docs/UsersManual.html: Add cygming notes.
llvm-svn: 128819
2011-04-04 15:02:41 +00:00
Eli Friedman 72adff255e PR9585: add __decltype as a keyword. While I'm here, alphabetize the list.
llvm-svn: 128809
2011-04-04 07:19:40 +00:00
Eli Friedman 2d9c47ea6c PR9615: make sure we destroy any temporaries returned by operator->.
I'm pretty sure this is the right fix, but I would appreciate it if someone
else would double-check.

llvm-svn: 128806
2011-04-04 01:18:25 +00:00
Richard Smith 13f68cf53e clang has had full and tested support for C++0x trailing-return-type and auto type deduction since r126166. Update the website to reflect this, and add a __has_feature test.
trailing-return-type codegen is not tested yet (name mangling in particular).

llvm-svn: 128787
2011-04-03 14:12:46 +00:00
Lenny Maiorani fca2e9618a Refactoring the security checker a little bit so that each CallExpr check doesn't get called for each CallExpr. Instead it does a switch and only runs the check for the proper identifier. Slight speed improvement (probably significant on very large ASTs), and should make it easier and more clear to add more checks for other CallExpr's later.
llvm-svn: 128785
2011-04-03 05:07:11 +00:00
Ted Kremenek a95594416e static analyzer: Add a new ProgramPoint PostCondition to represent the post position of a branch condition, and a new generateNode method to BranchNodeBuilder using PostCondition ProgramPoint. This method generates a new ExplodedNode but not a new block edge.
Patch by Lei Zhang!

llvm-svn: 128784
2011-04-03 04:34:49 +00:00
Ted Kremenek 850d35be16 Fix RegionStore bug when doing a field load whose parent is also a field assigned a LazyCompoundValue. Fixes <rdar://problem/9163742> and PR 9522.
llvm-svn: 128783
2011-04-03 04:09:15 +00:00
Nico Weber cc2b8717c5 Make -Wheader-hygiene not complain about USING_NAMESPACE_THROUGH_MACRO in a non-header file.
llvm-svn: 128780
2011-04-02 19:45:15 +00:00
Argyrios Kyrtzidis 6402c97eed [analyzer] Simplify CheckerFn template and use it more to reduce duplication. No functionality change.
llvm-svn: 128779
2011-04-02 19:37:26 +00:00
Ken Dyck 1473c9a7c4 Change the return type of CodeGenVTables::getVirtualBaseOffsetOffset() to
CharUnits. No change in functionality intended.

llvm-svn: 128776
2011-04-02 17:52:22 +00:00
Ken Dyck 1b23db93df Use CharUnits for the offsets in the VirtualBaseClassOffsetOffsetsMapTy. No
change in functionality intended.

llvm-svn: 128773
2011-04-02 17:13:02 +00:00
Ken Dyck cf4ef5314f Use CharUnits for the offset type in the ClassNamesAndOffsets map in
dumpLayout(). No change in functionality intended.

llvm-svn: 128771
2011-04-02 17:03:24 +00:00
Ken Dyck 1eac9f1546 Use CharUnits for the offsets in the VBaseOffsetOffsetsMapTy types. No
change in functionality intended.

llvm-svn: 128770
2011-04-02 16:57:20 +00:00
Chandler Carruth f20ec92331 Apply a bug-fix patch from Marcin Kowalczyk to the source locations for
a couple of operator overloads which form interesting expressions in the
AST.

I added test cases for both bugs with the c-index-test's token
annotation feature. Also, thanks to John McCall for confirming that this
is the correct solution.

llvm-svn: 128768
2011-04-02 09:47:38 +00:00
Zhongxing Xu af2371e368 Remove a redundant method. We have a const version.
llvm-svn: 128762
2011-04-02 03:20:45 +00:00
Ted Kremenek 8f89f7c893 Teach IdempotentOperationsChecker about paths aborted because ExprEngine didn't know how to handle a specific Expr type.
llvm-svn: 128761
2011-04-02 02:56:23 +00:00
Ted Kremenek c703a666f7 static analyzer: Rename 'BlocksAborted' to 'BlocksExhausted' to reflect that a given CFGBlock was analyzed too many times.
llvm-svn: 128760
2011-04-02 02:56:17 +00:00
Ken Dyck 6b20919317 Convert BaseOffset::NonVirtualOffset to CharUnits. No change in
functionality intended.

llvm-svn: 128756
2011-04-02 01:32:03 +00:00
Ken Dyck 872d74a591 Convert offset parameters and return values of VTableComponent methods to
CharUnits. No change in functionality intended.

llvm-svn: 128754
2011-04-02 01:14:48 +00:00
Ken Dyck 496906629b Convert the offsets in VCallOffsetMap to CharUnits. No change in
functionality intended.

llvm-svn: 128753
2011-04-02 00:51:15 +00:00
Ken Dyck eff7fe645b Convert offset parameters of VTableBuilder::IsOverriderUsed() to CharUnits.
No change in functionality intended.

llvm-svn: 128752
2011-04-02 00:44:58 +00:00
Fariborz Jahanian c6078c87d1 Fixes a rewriter bug rewriting call to a byref
block pointer nested inside a block. // rdar:// 9204669

llvm-svn: 128747
2011-04-01 23:08:13 +00:00
Daniel Dunbar 16d970950f Driver/Darwin: Tweak simulator link logic a bit more to be closer to GCC.
llvm-svn: 128738
2011-04-01 21:02:42 +00:00
Fariborz Jahanian 5bba75f1a7 ANother rewrite bug, rewriting a call of
__byref block. // rdar://9204669

llvm-svn: 128726
2011-04-01 19:19:28 +00:00
Devang Patel 1ffe23464a Do not try calculate the size of forward-declared template type array.
llvm-svn: 128725
2011-04-01 19:02:33 +00:00
Ted Kremenek c8e6f5110c Don't store reports when scan-build's build command matches /autogen/ (same as configure).
llvm-svn: 128723
2011-04-01 18:47:06 +00:00
Chandler Carruth 3d7e3daaa6 Fix an error in TreeTransform where we failed to copy the TemplateName's
location into a TemplateSpecializationTypeLoc. These were found using
a hand-written program to inspect every source location in
TemplateSpecializationTypeLocs and Valgrind. I don't know of any way to
test them in Clang's existing test suite sadly.

Example code that triggers the ElaboratedType case:
  template <typename T> struct X1 {
    template <typename U> struct X1_1 {
      int x;
    };
  };

  template <typename T, typename U> struct X2 {
    typename X1<T>::template X1_1<U> B;
  };

  X2<char, int> x2;

The other fix was simply spotted by inspection. I audited all constructions of
[Dependent]TemplateSpecializationTypeLocs in TreeTransform.h, and the rest set
the TemplateNameLoc properly.

llvm-svn: 128702
2011-04-01 02:03:23 +00:00
Daniel Dunbar 826342774e IRgen: Reapply r128691 with a fix to ensure we don't increase alignment past
that of the array element type.

llvm-svn: 128698
2011-04-01 00:49:43 +00:00
Daniel Dunbar ea6b81a2ad Revert r128691, "IRgen: Improve GCC compatibility when dealing with packed
arrays by propagating", it's breaking test in ways I don't understand yet.

llvm-svn: 128693
2011-04-01 00:13:33 +00:00
Daniel Dunbar 417bf0f147 IRgen: Improve GCC compatibility when dealing with packed arrays by propagating
the array alignment to the array access.
 - This is more or less the best we can do without having alignment present in
   the type system, but is a long way from truly matching how GCC handles this.

llvm-svn: 128691
2011-03-31 23:32:15 +00:00
Fariborz Jahanian ff51d4e559 Fix couple of rewriter bugs related to rewriting a
__block block declaration. //rdar://9204669

llvm-svn: 128682
2011-03-31 22:49:32 +00:00
Ted Kremenek 77361761fb -Wuninitialized should not warn about variables captured by blocks as byref.
Note this can potentially be enhanced to detect if the __block variable
is actually written by the block, or only when the block "escapes" or
is actually used, but that requires more analysis than it is probably worth
for this simple check.

llvm-svn: 128681
2011-03-31 22:32:41 +00:00
Lenny Maiorani 6ffe738f24 Add security syntax checker for strcpy() which causes the Static Analyzer to generate a warning any time the strcpy() function is used with a note suggesting to use a function which provides bounded buffers.
llvm-svn: 128679
2011-03-31 22:09:14 +00:00
Lenny Maiorani 79d74141b1 Adding Static Analyzer checker for mempcpy().
Models mempcpy() so that if length is NULL the destination pointer is returned. Otherwise, the source and destination are confirmed not to be NULL and not overlapping. Finally the copy is validated to not cause a buffer overrun and the return value is bound to the address of the byte after the last byte copied.

llvm-svn: 128677
2011-03-31 21:36:53 +00:00
Lenny Maiorani 70568c2be7 Fix spelling in a comment. (test commit)
llvm-svn: 128670
2011-03-31 21:26:55 +00:00
Sebastian Redl 7ac974122f Make ChainedIncludesSource an ExternalSemaSource, otherwise initialization of the ASTReader is incomplete, leading to errors like not realizing std::type_info is already defined.
llvm-svn: 128664
2011-03-31 19:29:24 +00:00
Sebastian Redl 604caf4008 Tell the diagnostic client about starting and ending source files when automatically creating chained PCHs. This way, we don't get a crash whenever a diagnostic is emitted while processing the include.
llvm-svn: 128663
2011-03-31 19:29:18 +00:00
Daniel Dunbar ebc34dff18 Driver/Darwin: Tweak link logic for simulator.
llvm-svn: 128641
2011-03-31 17:12:33 +00:00
John McCall 7c623641a6 Whoops.
llvm-svn: 128621
2011-03-31 09:19:20 +00:00
John McCall f9b056b002 After much contemplation, I've decided that we probably shouldn't "unique"
__block object copy/dispose helpers for C++ objects with those for
different variables with completely different semantics simply because
they happen to both be no more aligned than a pointer.

Found by inspection.

Also, internalize most of the helper generation logic within CGBlocks.cpp,
and refactor it to fit my peculiar aesthetic sense.

llvm-svn: 128618
2011-03-31 08:03:29 +00:00
Ted Kremenek 40d16c0e75 Static analyzer: fix bug in handling of dynamic_cast<>. The sink node wouldn't always be the final node, thus causing the state to continue propagating. Instead,
recover some path-sensitivity by conjuring a symbol.

llvm-svn: 128612
2011-03-31 04:46:53 +00:00
Ted Kremenek 61a4f6682a Teach static analyzer about the basics of handling new[]. We still don't simulate constructors, but at least the analyzer doesn't think the return value is uninitialized.
llvm-svn: 128611
2011-03-31 04:04:48 +00:00
John McCall 7306487077 Move all the significant __block code into CGBlocks.cpp. No functionality
change.

llvm-svn: 128608
2011-03-31 01:59:53 +00:00
Matt Beaumont-Gay 873c6dd875 Oops, prefer C-style cast here
llvm-svn: 128607
2011-03-31 01:56:27 +00:00