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

19054 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 180f2840d1 Format string checking: selectively ignore implicit casts to 'int'
when checking if the format specifier matches the type of the data
argument and the length modifier indicates the data type is 'char' or
'short'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94992 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 19:28:15 +00:00
Devang Patel abb485f0b5 Emit debug info for namespaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94991 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 19:16:32 +00:00
John McCall 342fec43c5 Note that an overload candidate was non-viable because template argument
deduction failed.  Right now there's a very vague diagnostic for most cases
and a good diagnostic for incomplete deduction.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94988 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 18:53:26 +00:00
Sam Weinig d17e340e2d Fix for PR5185. C99 [*] VLA notation should be disallowed in function definitions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94972 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 05:02:49 +00:00
John McCall b13b737a24 Access checking for implicit user-defined conversions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 03:16:54 +00:00
Sebastian Redl e9d12b6c50 Add VarDecl::isThisDeclarationADefinition(), which properly encapsulates the logic for when a variable declaration is a (possibly tentativ) definition. Add a few functions building on this, and shift C tentative definition handling over to this new functionality. This shift also kills the Sema::TentativeDefinitions map and instead simply stores all declarations in the renamed list. The correct handling for multiple tentative definitions is instead shifted to the final walk of the list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94968 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 22:27:38 +00:00
Eli Friedman 6997aae428 Switch expressions like T() and T(1,2) over to new-style initialization. I'm
not quite sure what we want to do about the AST representation; comments
welcome.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94967 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 20:58:15 +00:00
Eli Friedman 3bb9412788 Simplify EmitMemberInitializer; no intended functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 19:07:50 +00:00
Anders Carlsson 3aba09376c Start creating CXXBindReferenceExpr nodes when binding complex types to references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94964 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 18:34:51 +00:00
Anders Carlsson 093802675b Diagnose binding a non-const reference to a vector element.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94963 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 17:18:49 +00:00
Chandler Carruth e1cd3374a8 Fix my dyslexia.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 11:52:52 +00:00
Chandler Carruth c099d9bc48 Add a test case for a fixed PR just to ensure we don't regress.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 11:51:51 +00:00
Chandler Carruth aaa1a89572 Return early, reduce indentation, and simplify line breaks. No functionality
change.

PS: I'm under the impression formatting-only patches don't need pre-commit
review, but feel free to yell at me if I should post these first! =D


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94956 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 11:44:02 +00:00
Chandler Carruth 2877998bd8 Really trivial patch to accept pointer to const void in indirect goto. Despite
the lack of documentation, this matches the behavior of GCC.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94954 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 10:26:25 +00:00
Chandler Carruth 038cc39994 Fix PR6159 and several other problems with value-dependent non-type template
arguments. This both prevents meaningless checks on these arguments and ensures
that they are represented as an expression by the instantiation.

Cleaned up and added standard text to the relevant test case. Also started
adding tests for *rejected* cases. At least one FIXME here where (I think) we
allow something we shouldn't. More to come in the area of rejecting crazy
arguments with decent diagnostics. Suggestions welcome for still better
diagnostics on these errors!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94953 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 10:01:20 +00:00
Douglas Gregor 9db7dbb918 Rework base and member initialization in constructors, with several
(necessarily simultaneous) changes:

  - CXXBaseOrMemberInitializer now contains only a single initializer
    rather than a set of initialiation arguments + a constructor. The
    single initializer covers all aspects of initialization, including
    constructor calls as necessary but also cleanup of temporaries
    created by the initializer (which we never handled
    before!).

  - Rework + simplify code generation for CXXBaseOrMemberInitializers,
    since we can now just emit the initializer as an initializer.

  - Switched base and member initialization over to the new
    initialization code (InitializationSequence), so that it

  - Improved diagnostics for the new initialization code when
    initializing bases and members, to match the diagnostics produced
    by the previous (special-purpose) code.

  - Simplify the representation of type-checked constructor initializers in
    templates; instead of keeping the fully-type-checked AST, which is
    rather hard to undo at template instantiation time, throw away the
    type-checked AST and store the raw expressions in the AST. This
    simplifies instantiation, but loses a little but of information in
    the AST.

  - When type-checking implicit base or member initializers within a
    dependent context, don't add the generated initializers into the
    AST, because they'll look like they were explicit.

  - Record in CXXConstructExpr when the constructor call is to
  initialize a base class, so that CodeGen does not have to infer it
  from context. This ensures that we call the right kind of
  constructor.

There are also a few "opportunity" fixes here that were needed to not
regress, for example:

  - Diagnose default-initialization of a const-qualified class that
    does not have a user-declared default constructor. We had this
    diagnostic specifically for bases and members, but missed it for
    variables. That's fixed now.

  - When defining the implicit constructors, destructor, and
    copy-assignment operator, set the CurContext to that constructor
    when we're defining the body.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 09:12:51 +00:00
Benjamin Kramer a053154367 Try to unbreak MSVC build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94951 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 09:01:55 +00:00
Chandler Carruth b7de181d91 Fix PR6156 and test several of the basic aspects of non-type template arguments
when implicitly supplied to the injected class name.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94948 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 07:24:03 +00:00
Chandler Carruth 548028b3ca Handle instantiation of templates with non-type arguments expressed with an
explicit '&' by introducing an address-of operator prior to checking the
argument's type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 07:09:11 +00:00
Anders Carlsson 905a100f3d When performing a derived-to-base cast that we know will not change the offset, we don't need to null check the input pointer. Fixes PR5965.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94942 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 02:39:02 +00:00
Anders Carlsson a552ea76b0 When doing a base-to-derived cast we don't need to null check the derived value if the class offset is 0.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 01:43:37 +00:00
Anders Carlsson bb7e17b52f Some class related cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94938 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 01:36:53 +00:00
Daniel Dunbar 8958dc9bf3 cindex/Python: Turn off showing IDs by default, they are really slow to compute
pending a hash function. Also added a --max-depth argument, handy for timing and
limiting the volume of output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94936 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 00:41:15 +00:00
Daniel Dunbar a9f696da69 CIndex/USRs: Disable a bogus assert, we don't want CIndex to crash liberally. I
have sent Ted a test case for this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94935 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 00:41:05 +00:00
Daniel Dunbar 6d32cb85ee cindex/Python: Add a simple example which dumps assorted information about a translation unit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94934 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:59:14 +00:00
Daniel Dunbar 532fc63b51 cindex/Python: Add full support for Diagnostic and FixIt objects, available via TranslationUnit.diagnostics.
Several important FIXMEs remain:
  - We aren't getting all the notes?
  - There is still no way to get diagnostics for invalid inputs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:59:02 +00:00
Daniel Dunbar e32af4213e cindex/Python: Update SourceLocation and SourceRange structures to match API changes.
Hurray for exposing implementation details!!!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94932 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:58:50 +00:00
Daniel Dunbar 2791dfc0fc cindex/Python: Update Index.create for removal of displayDiagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:58:39 +00:00
Daniel Dunbar 90a6b9e1e4 CIndex: Fix clang_equalLocations for change to ptr_data field.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:58:27 +00:00
Daniel Dunbar 74f20838ca Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94929 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:31:57 +00:00
Daniel Dunbar 4914612675 CIndex: Fix diagnostic callback to not return SourceLocations with a reference to a temporary LangOptions object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94928 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:31:49 +00:00
Daniel Dunbar 35b8440f61 CIndex: Fix ReportSerializedDiagnostics to honor the DiagnosticClient contract
that diagnostics with a source location should occur inside
{Begin,End}SourceFile.

Note that code completion is currently passing in an invalid LangOptions object
due to its implementation, I need to sort this out with Doug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:31:40 +00:00
Anders Carlsson 966146e891 Remove the SmallVectors from AsmStmt. Fixes PR6105.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94926 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:19:41 +00:00
Anders Carlsson ff93dbd887 Use IdentifierInfo * instead of std::string for the AsmStmt names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 22:25:16 +00:00
Daniel Dunbar 807b06157a ASTUnit: Ensure the CompilerInvocation object used in LoadFromCommandLine is
live as long as the ASTUnit. This is useful for clients which want to maintain
pointers to the LangOptions object which ultimately lives in the
CompilerInvocation, although it would be nice to make all of this ownership
stuff more explicit and obvious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94924 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 21:47:16 +00:00
Daniel Dunbar 6228ca0012 CompilerInstance: Change to not contain the CompilerInvocation object.
This allows clients to install their own CompilerInvocation object, which is
important for clients that may wish to create references to things like
LangOptions whose lifetime will extend past that of the CompilerInstance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94923 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 21:47:07 +00:00
Anders Carlsson 95c9ce952d Fix thinko.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94922 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 20:48:08 +00:00
Anders Carlsson acb6bcb442 Even more AsmStmt cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94921 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 20:38:10 +00:00
Anders Carlsson a5a79f7d16 More asm cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94920 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 20:05:21 +00:00
Benjamin Kramer 3bb6530019 Simplify FreeBSD version parsing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94919 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 19:55:01 +00:00
Anders Carlsson fdba9c0690 Combine AsmStmt::setOutputsAndInputs and AsmStmt::setClobbers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94918 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 19:34:25 +00:00
Anders Carlsson 83c021c6d3 Yay for more StringRefs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 19:12:25 +00:00
Anders Carlsson f959fb5fb8 StringRef-ize the TargetInfo::ConstraintInfo constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94916 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 18:33:31 +00:00
Anders Carlsson c076c450e4 Add an assert to make sure that we don't try to mess with overridden methods for class templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94907 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 17:42:34 +00:00
Benjamin Kramer 7297c18c84 PCHReader doesn't implement classof so dyn_casting it will do really weird stuff. Use a static_cast instead.
I don't know if this hack is the right fix. Doug, please take a look.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94895 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 16:23:25 +00:00
Daniel Dunbar 01aefc6d20 Recognize 'q' as a format length modifier (from BSD).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94894 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 15:49:20 +00:00
Benjamin Kramer f22d1fd96d Use StringRef instead of returning a temporary std::string.
This fixes a really nasty bug in Darwin::getDarwinArchName where we were going
StringRef -> temporary std::string -> StringRef (and return the dead StringRef).
The StringRefs from Triple live as long as the Triple itself, that should be
long enough.

Hopefully 2 of 4 MSVC buildbot failures are gone now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94892 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 15:01:47 +00:00
Benjamin Kramer e242d5f5fa We don't need to place 0 in the URL string now that we return a StringRef.
- URL can go into read only memory now.
- Compilers will fold away all the strstr calls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94887 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 14:01:39 +00:00
Anton Korobeynikov 09f52a696e Fix alignment for msp430 integer types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94879 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 12:55:11 +00:00
Benjamin Kramer 500f189081 Silence clang++ warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94878 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 12:15:41 +00:00