Граф коммитов

19054 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson ca755fe38f Eliminate yet another old-school PerformCopyInitialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94874 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 01:56:32 +00:00
Ted Kremenek c9a89fec60 Add format string checking of 'double' arguments. Fixes <rdar://problem/6931734>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94867 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 01:02:18 +00:00
Ted Kremenek f7066acc50 Add test case for <rdar://problem/7068334> (which was fixed by r94864).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94865 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 00:56:00 +00:00
Ted Kremenek d635c5fcc4 Add basic type checking of format string conversion specifiers and their arguments. Thanks to Cristian Draghici for his help with this patch!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94864 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 00:49:51 +00:00
Ted Kremenek 31f8e32788 Be a little more permissive than C99: allow 'unsigned' to be used for
the field width and precision of a format specifier instead of just
'int'.  This matches GCC, and fixes <rdar://problem/6079850>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94856 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 23:32:22 +00:00
Ted Kremenek 40888ada60 Fix spacing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94852 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 23:00:35 +00:00
Ted Kremenek 33567d2feb Per a suggestion from Cristian Draghici, add a method to FormatSpecifier that returns the expected type of the matching data argument. It isn't complete, but should handle several of the important cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94851 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 22:59:32 +00:00
Devang Patel d528905966 Use appropriate context for typedefs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94849 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 22:29:31 +00:00
Daniel Dunbar 4a5290e773 Driver: Don't honor -std-default for C++, this makes it hard to run the gdb test
suite with clang++ enabled.

The right fix here is PR6175, although we would still have to find a different
work around for the gdb test suite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94838 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 21:03:02 +00:00
Ted Kremenek f88c8e02da Switch Sema over to using the new implementation of format string
checking.  It passes all existing tests, and the diagnostics have been
refined to provide better range information (we now highlight
individual format specifiers) and more precise wording in the
diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94837 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 20:55:36 +00:00
Ted Kremenek 4dcb18ff9d Enhancements to the alternate (WIP) format string checking:
- Add ConversionSpecifier::consumesDataArgument() as a helper method
  to determine if a conversion specifier requires a matching argument.
- Add support for glibc-specific '%m' conversion
- Add an extra callback to HandleNull() for locations within the
  format specifier that have a null character


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94834 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 20:29:53 +00:00
Douglas Gregor e14654b3b7 PR5909 had a test case for binding of const, non-volatile references
to bitfields. Add it here.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94832 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 19:42:41 +00:00
Douglas Gregor ef06e2451c Fix reference-binding when we have a reference to const volatile type;
previously, we were allowing this to bind to a temporary. Now, we
don't; add test-cases and improve diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94831 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 19:39:15 +00:00
Ted Kremenek c0178e9cf4 Fix subtle bug in Preprocessor::AdvanceToTokenCharacter(): use '+=' instead of '='.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94830 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 19:38:24 +00:00
Douglas Gregor de4b1d86bf Fix reference binding of const lvalue references to bit-fields, which
requires a temporary. Previously, we were building an initialization
sequence that bound to the bit-field as if it were a real lvalue. Note
that we previously (and still) diagnose binding of non-const
references to bit-fields, as we should.

There's no real way to test that this code is correct, since reference
binding does not *currently* have any representation in the AST. This
fix should make it easier for that to happen, so I've verified this
fix with...

Added InitializationSequence::dump(), to print an initialization
sequence for debugging purposes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94826 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 19:14:02 +00:00
Anders Carlsson 3faa486935 And yet another call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94824 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 18:43:53 +00:00
Anders Carlsson 38f88abead Another PerformCopyInitialization call bites the dust.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94823 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 18:37:50 +00:00
Devang Patel 188aed328a New test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94821 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 18:32:33 +00:00
Anders Carlsson c6acbc58a7 Get rid of another old PerformCopyInitialization call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94819 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 18:30:20 +00:00
Devang Patel 3dd96a1489 Maintain a map of regions (lexical scopes) and use it to find context for a global variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94817 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 18:11:03 +00:00
Ted Kremenek 3c9e03bda5 Add comment to test linking it back to the original Bugzilla PR.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94816 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 18:07:41 +00:00
Douglas Gregor 86b8e09498 When naming a function template via a qualified-id (or any other way
that ADL is suppressed), we need to build an
UnresolvedLookupExpr. Fixes PR6063, which was hitting Boost headers
pretty hard.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94814 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 17:15:43 +00:00
Daniel Dunbar 3239a67361 cindex/Python: Update to support _getInstantiationLocation's new offset value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94813 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 17:02:32 +00:00
Daniel Dunbar 1a3c1d9dcf Driver/Darwin: Fix a crash when diagnosing conflicting deployment targets.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94812 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 17:02:25 +00:00
Douglas Gregor 46287c7922 Name mangling for cast expressions, from Matthias Schiffer! Fixes PR5876.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94811 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 16:37:09 +00:00
Benjamin Kramer ddc6b664e4 Fix typo found by clang++. Yay for -Wuninitialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94810 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 15:58:21 +00:00
Chandler Carruth e89d1d5be4 Bring driver link order in CMake into alignment with the order in the Makefile.
This includes the fix in r94797 to reflect the new dependency of Sema on
Analysis.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94806 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 10:03:42 +00:00
Anders Carlsson 4e1c181e2b Add getters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94803 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 06:34:33 +00:00
Anders Carlsson 9cfe0ec4de Use EmitLValueForFieldInitialization when synthesizing the copy ctor as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 05:41:25 +00:00
Anders Carlsson 06a2970e94 Add a new EmitLValueForFieldInitialization that will be used for initializing fields (and reference type fields in particular).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94799 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 05:24:29 +00:00
Anders Carlsson e6d2a53485 Simplify EmitLValueForField - we can get whether the field is part of a union or not from the FieldDecl (through its DeclContext).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94798 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 05:05:36 +00:00
Zhongxing Xu 0c98670e24 Fix linking problem on Linux.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94797 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 03:25:47 +00:00
Daniel Dunbar 679855a6e1 ARM/APCS ABI: Fix some problems with bit-fields in structures. After rereading
the ABI spec, this turns out to simplify the code. We still have some annoying
code which mismatches the spec with regard to empty structures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94796 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 03:22:29 +00:00
Ted Kremenek 808015a18b Alternate format string checking: issue warnings for incomplete format specifiers.
In addition, move ParseFormatString() and FormatStringHandler() from
the clang::analyze_printf to the clang namespace.  Hopefully this will
resolve some link errors on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94794 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 03:16:21 +00:00
Anders Carlsson a6fe0bf89d Simplify InitListChecker::CheckReferenceType
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94793 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 02:47:33 +00:00
Ted Kremenek 26ac2e07b4 Alternate format string checking: issue a warning for invalid conversion specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94792 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 02:40:24 +00:00
Anders Carlsson eb60edffa1 Add an CXXBindReferenceExpr (not used just yet).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94791 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 02:39:32 +00:00
Ted Kremenek 4b220fae2f Yet another attempt to make the Linux buildbots happy. Apparently there are differences on how nested namespaces are handled...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94790 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 02:13:53 +00:00
Anders Carlsson d9f473c27e Update .xcodeproj file (Yes this is getting old and I should really switch to the cmake based project :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94789 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:56:42 +00:00
Fariborz Jahanian 0e1c99a1a9 Fixes rewriter bug rewriting byref related API where a struct
definition comes after where it is needed. Fixes radar 7589385.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94788 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:55:49 +00:00
Ted Kremenek 07d161f38e Alternate format string checking: check for excess data arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94787 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:50:07 +00:00
John McCall 80cd64a845 Do a little magic and a little greasework to make it much more efficient
to cast a DeclContext down to a specific implementation class.

There are still lots of calls to Decl::castFromDeclContext left, mostly
arising from DeclContext::getParent().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94786 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:45:37 +00:00
Ted Kremenek da51f0d136 Alternate format string checking: check if the number of format specifiers exceeds the number of arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94785 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:43:31 +00:00
Ted Kremenek d7a3f01a51 Move definition of FormatStringHandler::~FormatStringHandler() within namespace directives. Hopefully this will make the Linux buildbots happy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94784 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:37:52 +00:00
Ted Kremenek e82d804ee7 Alternate format string checking: warn of '%n' as being potentially insecure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94782 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:35:25 +00:00
Ted Kremenek 0d27735c51 Add precision/field width checking to AlternateCheckPrintfString().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94774 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:06:55 +00:00
Douglas Gregor 2b37c9e6ca Harden the CIndex implementation a bit, so that it does not assert
when given bad inputs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94769 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 00:47:48 +00:00
Douglas Gregor 51c6d38455 When printing diagnostics in c-index-test, also print source ranges
and fix-it information, so we can see everything in one place. Along
the way, fix a few bugs with deserialization and query of diagnostics
in CIndex.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 00:41:11 +00:00
Ted Kremenek e729acbba7 Fix off-by-one error in ParseFormatSpecifier() when reporting the location of a null character.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94762 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 23:56:52 +00:00
Ted Kremenek e0e5313c25 Start fleshing out Sema::AlternateCheckPrintfString():
- Add an anonymous class 'CheckPrintfHandler' which will do the
  checking of specific format specifiers
- Add checking for using the '@' conversion specifier outside
  an ObjC string literal
- Add checking for null characters within the string


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94761 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 23:39:18 +00:00