]> granicus.if.org Git - clang/log
clang
14 years agoImplement PR6180, substantially improving the diagnostics we get from
Chris Lattner [Tue, 2 Feb 2010 01:23:29 +0000 (01:23 +0000)]
Implement PR6180, substantially improving the diagnostics we get from
forgetting a ';' at the end of a struct.  For something like:

class c {
}
void foo() {}

we now produce:

t.cc:3:2: error: expected ';' after class
}
 ^
 ;

instead of:

t.cc:4:1: error: cannot combine with previous 'class' declaration specifier
void foo() {}
^
t.cc:2:7: error: 'class c' can not be defined in the result type of a function
class c {
      ^

GCC produces:

t.cc:4: error: new types may not be defined in a return type
t.cc:4: note: (perhaps a semicolon is missing after the definition of ‘c’)
t.cc:4: error: two or more data types in declaration of ‘foo’

I *think* I got the follow set right, but if I forgot anything, we'll start
getting spurious "expected ';' after class" errors, let me know if you see
any.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95042 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoimprove diagnostics for C++ struct ; issues. Before:
Chris Lattner [Tue, 2 Feb 2010 00:43:15 +0000 (00:43 +0000)]
improve diagnostics for C++ struct ; issues.  Before:

t.cc:4:3: error: expected ';' at end of declaration list
  int y;
  ^
t.cc:6:1: error: expected ';' at end of declaration list
};
^

After:

t.cc:3:8: error: expected ';' at end of declaration list
  int x
       ^
       ;
t.cc:5:8: error: expected ';' at end of declaration list
  int z
       ^
       ;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95039 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoimprove diagnostics on missing ; in a struct. Before:
Chris Lattner [Tue, 2 Feb 2010 00:37:27 +0000 (00:37 +0000)]
improve diagnostics on missing ; in a struct.  Before:

t.c:4:3: error: expected ';' at end of declaration list
  int y;
  ^
t.c:4:8: warning: extra ';' inside a struct or union
  int y;
       ^
t.c:6:1: warning: expected ';' at end of declaration list
};
^

After:

t.c:3:8: error: expected ';' at end of declaration list
  int x  // expected-error {{expected ';' at end of declaration list}}
       ^
       ;
t.c:5:8: warning: expected ';' at end of declaration list
  int z
       ^
       ;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95038 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoHoist diagnostic generation in ReturnStackAddressChecker into a separate method....
Ted Kremenek [Tue, 2 Feb 2010 00:13:41 +0000 (00:13 +0000)]
Hoist diagnostic generation in ReturnStackAddressChecker into a separate method.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95037 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake this fix-it test case actually fail when there is a problem; add
Douglas Gregor [Mon, 1 Feb 2010 23:46:27 +0000 (23:46 +0000)]
Make this fix-it test case actually fail when there is a problem; add
a test for access declarations and remove a (broken) test for removal
of default arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95032 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove handling of enumerator values for C and C++, including:
Douglas Gregor [Mon, 1 Feb 2010 23:36:03 +0000 (23:36 +0000)]
Improve handling of enumerator values for C and C++, including:

  - In C++, prior to the closing '}', set the type of enumerators
    based on the type of their initializer. Don't perform unary
    conversions on the enumerator values.
  - In C++, handle overflow when an enumerator has no initializer and
    its value cannot be represented in the type of the previous
    enumerator.
  - In C, handle overflow more gracefully, by complaining and then
    falling back to the C++ rules.
  - In C, if the enumerator value is representable in an int, convert the
    expression to the type 'int'.

Fixes PR5854 and PR4515.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95031 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoARM/APCS: Fix classification of small complex integer types as "integer like".
Daniel Dunbar [Mon, 1 Feb 2010 23:31:26 +0000 (23:31 +0000)]
ARM/APCS: Fix classification of small complex integer types as "integer like".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95030 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoARM/APCS: Pass Complex types following llvm-gcc.
Daniel Dunbar [Mon, 1 Feb 2010 23:31:19 +0000 (23:31 +0000)]
ARM/APCS: Pass Complex types following llvm-gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95029 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd format string type checking support for 'long double'.
Ted Kremenek [Mon, 1 Feb 2010 23:23:50 +0000 (23:23 +0000)]
Add format string type checking support for 'long double'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95026 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix FIXME and surrounding comment.
Devang Patel [Mon, 1 Feb 2010 22:51:29 +0000 (22:51 +0000)]
Fix FIXME and surrounding comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95023 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse appropriate context descriptor in RecordDecl's debug info.
Devang Patel [Mon, 1 Feb 2010 22:40:08 +0000 (22:40 +0000)]
Use appropriate context descriptor in RecordDecl's debug info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95016 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDo not use clang type name to name a local variable, e.g. Decl.
Devang Patel [Mon, 1 Feb 2010 21:52:22 +0000 (21:52 +0000)]
Do not use clang type name to name a local variable, e.g. Decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95010 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDo not use clang type name to name a local variable, e.g. Decl.
Devang Patel [Mon, 1 Feb 2010 21:39:52 +0000 (21:39 +0000)]
Do not use clang type name to name a local variable, e.g. Decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95009 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse DeclContext as getContextDescriptor() argument.
Devang Patel [Mon, 1 Feb 2010 21:34:11 +0000 (21:34 +0000)]
Use DeclContext as getContextDescriptor() argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95008 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver/Darwin: Darwin uses -fobjc-legacy-dispatch on ARM.
Daniel Dunbar [Mon, 1 Feb 2010 21:07:43 +0000 (21:07 +0000)]
Driver/Darwin: Darwin uses -fobjc-legacy-dispatch on ARM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95006 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoNeXT: Add support for -fobjc-legacy-dispatch.
Daniel Dunbar [Mon, 1 Feb 2010 21:07:33 +0000 (21:07 +0000)]
NeXT: Add support for -fobjc-legacy-dispatch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95005 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver/Frontend: Add support for -fobjc-legacy-dispatch, not yet used.
Daniel Dunbar [Mon, 1 Feb 2010 21:07:25 +0000 (21:07 +0000)]
Driver/Frontend: Add support for -fobjc-legacy-dispatch, not yet used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95004 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't explicitly force utf strings into the __TEXT,__ustring
Chris Lattner [Mon, 1 Feb 2010 20:59:08 +0000 (20:59 +0000)]
Don't explicitly force utf strings into the __TEXT,__ustring
by setting the section of the generated global.  This is an
optimization done by the code generator, and the code being
removed didn't handle the case when the string contained an
embedded nul (which the code generator does correctly
handle).  This is rdar://7589850

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95003 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIn C++, an initializer on a variable doesn't necessarily mean it's the definition...
Sebastian Redl [Mon, 1 Feb 2010 20:16:42 +0000 (20:16 +0000)]
In C++, an initializer on a variable doesn't necessarily mean it's the definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94999 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofix PR6187: various load functions in xmmintrin.h were missing 'const'.
Chris Lattner [Mon, 1 Feb 2010 20:14:14 +0000 (20:14 +0000)]
fix PR6187: various load functions in xmmintrin.h were missing 'const'.
emmintrin looks ok.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94998 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse early return as suggested by Cristian Draghici.
Ted Kremenek [Mon, 1 Feb 2010 19:38:10 +0000 (19:38 +0000)]
Use early return as suggested by Cristian Draghici.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94994 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFormat string checking: selectively ignore implicit casts to 'int'
Ted Kremenek [Mon, 1 Feb 2010 19:28:15 +0000 (19:28 +0000)]
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

14 years agoEmit debug info for namespaces.
Devang Patel [Mon, 1 Feb 2010 19:16:32 +0000 (19:16 +0000)]
Emit debug info for namespaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94991 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoNote that an overload candidate was non-viable because template argument
John McCall [Mon, 1 Feb 2010 18:53:26 +0000 (18:53 +0000)]
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

14 years agoFix for PR5185. C99 [*] VLA notation should be disallowed in function definitions.
Sam Weinig [Mon, 1 Feb 2010 05:02:49 +0000 (05:02 +0000)]
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

14 years agoAccess checking for implicit user-defined conversions.
John McCall [Mon, 1 Feb 2010 03:16:54 +0000 (03:16 +0000)]
Access checking for implicit user-defined conversions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94971 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd VarDecl::isThisDeclarationADefinition(), which properly encapsulates the logic...
Sebastian Redl [Sun, 31 Jan 2010 22:27:38 +0000 (22:27 +0000)]
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

14 years agoSwitch expressions like T() and T(1,2) over to new-style initialization. I'm
Eli Friedman [Sun, 31 Jan 2010 20:58:15 +0000 (20:58 +0000)]
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

14 years agoSimplify EmitMemberInitializer; no intended functionality change.
Eli Friedman [Sun, 31 Jan 2010 19:07:50 +0000 (19:07 +0000)]
Simplify EmitMemberInitializer; no intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94965 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoStart creating CXXBindReferenceExpr nodes when binding complex types to references.
Anders Carlsson [Sun, 31 Jan 2010 18:34:51 +0000 (18:34 +0000)]
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

14 years agoDiagnose binding a non-const reference to a vector element.
Anders Carlsson [Sun, 31 Jan 2010 17:18:49 +0000 (17:18 +0000)]
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

14 years agoFix my dyslexia.
Chandler Carruth [Sun, 31 Jan 2010 11:52:52 +0000 (11:52 +0000)]
Fix my dyslexia.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94958 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a test case for a fixed PR just to ensure we don't regress.
Chandler Carruth [Sun, 31 Jan 2010 11:51:51 +0000 (11:51 +0000)]
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

14 years agoReturn early, reduce indentation, and simplify line breaks. No functionality
Chandler Carruth [Sun, 31 Jan 2010 11:44:02 +0000 (11:44 +0000)]
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

14 years agoReally trivial patch to accept pointer to const void in indirect goto. Despite
Chandler Carruth [Sun, 31 Jan 2010 10:26:25 +0000 (10:26 +0000)]
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

14 years agoFix PR6159 and several other problems with value-dependent non-type template
Chandler Carruth [Sun, 31 Jan 2010 10:01:20 +0000 (10:01 +0000)]
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

14 years agoRework base and member initialization in constructors, with several
Douglas Gregor [Sun, 31 Jan 2010 09:12:51 +0000 (09:12 +0000)]
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

14 years agoTry to unbreak MSVC build.
Benjamin Kramer [Sun, 31 Jan 2010 09:01:55 +0000 (09:01 +0000)]
Try to unbreak MSVC build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94951 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix PR6156 and test several of the basic aspects of non-type template arguments
Chandler Carruth [Sun, 31 Jan 2010 07:24:03 +0000 (07:24 +0000)]
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

14 years agoHandle instantiation of templates with non-type arguments expressed with an
Chandler Carruth [Sun, 31 Jan 2010 07:09:11 +0000 (07:09 +0000)]
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

14 years agoWhen performing a derived-to-base cast that we know will not change the offset, we...
Anders Carlsson [Sun, 31 Jan 2010 02:39:02 +0000 (02:39 +0000)]
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

14 years agoWhen doing a base-to-derived cast we don't need to null check the derived value if...
Anders Carlsson [Sun, 31 Jan 2010 01:43:37 +0000 (01:43 +0000)]
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

14 years agoSome class related cleanup.
Anders Carlsson [Sun, 31 Jan 2010 01:36:53 +0000 (01:36 +0000)]
Some class related cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94938 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agocindex/Python: Turn off showing IDs by default, they are really slow to compute
Daniel Dunbar [Sun, 31 Jan 2010 00:41:15 +0000 (00:41 +0000)]
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

14 years agoCIndex/USRs: Disable a bogus assert, we don't want CIndex to crash liberally. I
Daniel Dunbar [Sun, 31 Jan 2010 00:41:05 +0000 (00:41 +0000)]
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

14 years agocindex/Python: Add a simple example which dumps assorted information about a translat...
Daniel Dunbar [Sat, 30 Jan 2010 23:59:14 +0000 (23:59 +0000)]
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

14 years agocindex/Python: Add full support for Diagnostic and FixIt objects, available via Trans...
Daniel Dunbar [Sat, 30 Jan 2010 23:59:02 +0000 (23:59 +0000)]
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

14 years agocindex/Python: Update SourceLocation and SourceRange structures to match API changes.
Daniel Dunbar [Sat, 30 Jan 2010 23:58:50 +0000 (23:58 +0000)]
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

14 years agocindex/Python: Update Index.create for removal of displayDiagnostics.
Daniel Dunbar [Sat, 30 Jan 2010 23:58:39 +0000 (23:58 +0000)]
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

14 years agoCIndex: Fix clang_equalLocations for change to ptr_data field.
Daniel Dunbar [Sat, 30 Jan 2010 23:58:27 +0000 (23:58 +0000)]
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

14 years agoSimplify.
Daniel Dunbar [Sat, 30 Jan 2010 23:31:57 +0000 (23:31 +0000)]
Simplify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94929 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCIndex: Fix diagnostic callback to not return SourceLocations with a reference to...
Daniel Dunbar [Sat, 30 Jan 2010 23:31:49 +0000 (23:31 +0000)]
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

14 years agoCIndex: Fix ReportSerializedDiagnostics to honor the DiagnosticClient contract
Daniel Dunbar [Sat, 30 Jan 2010 23:31:40 +0000 (23:31 +0000)]
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

14 years agoRemove the SmallVectors from AsmStmt. Fixes PR6105.
Anders Carlsson [Sat, 30 Jan 2010 23:19:41 +0000 (23:19 +0000)]
Remove the SmallVectors from AsmStmt. Fixes PR6105.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94926 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse IdentifierInfo * instead of std::string for the AsmStmt names.
Anders Carlsson [Sat, 30 Jan 2010 22:25:16 +0000 (22:25 +0000)]
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

14 years agoASTUnit: Ensure the CompilerInvocation object used in LoadFromCommandLine is
Daniel Dunbar [Sat, 30 Jan 2010 21:47:16 +0000 (21:47 +0000)]
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

14 years agoCompilerInstance: Change to not contain the CompilerInvocation object.
Daniel Dunbar [Sat, 30 Jan 2010 21:47:07 +0000 (21:47 +0000)]
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

14 years agoFix thinko.
Anders Carlsson [Sat, 30 Jan 2010 20:48:08 +0000 (20:48 +0000)]
Fix thinko.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94922 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoEven more AsmStmt cleanup.
Anders Carlsson [Sat, 30 Jan 2010 20:38:10 +0000 (20:38 +0000)]
Even more AsmStmt cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94921 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMore asm cleanup.
Anders Carlsson [Sat, 30 Jan 2010 20:05:21 +0000 (20:05 +0000)]
More asm cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94920 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSimplify FreeBSD version parsing.
Benjamin Kramer [Sat, 30 Jan 2010 19:55:01 +0000 (19:55 +0000)]
Simplify FreeBSD version parsing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94919 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCombine AsmStmt::setOutputsAndInputs and AsmStmt::setClobbers.
Anders Carlsson [Sat, 30 Jan 2010 19:34:25 +0000 (19:34 +0000)]
Combine AsmStmt::setOutputsAndInputs and AsmStmt::setClobbers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94918 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoYay for more StringRefs.
Anders Carlsson [Sat, 30 Jan 2010 19:12:25 +0000 (19:12 +0000)]
Yay for more StringRefs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94917 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoStringRef-ize the TargetInfo::ConstraintInfo constructor.
Anders Carlsson [Sat, 30 Jan 2010 18:33:31 +0000 (18:33 +0000)]
StringRef-ize the TargetInfo::ConstraintInfo constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94916 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd an assert to make sure that we don't try to mess with overridden methods for...
Anders Carlsson [Sat, 30 Jan 2010 17:42:34 +0000 (17:42 +0000)]
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

14 years agoPCHReader doesn't implement classof so dyn_casting it will do really weird stuff...
Benjamin Kramer [Sat, 30 Jan 2010 16:23:25 +0000 (16:23 +0000)]
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

14 years agoRecognize 'q' as a format length modifier (from BSD).
Daniel Dunbar [Sat, 30 Jan 2010 15:49:20 +0000 (15:49 +0000)]
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

14 years agoUse StringRef instead of returning a temporary std::string.
Benjamin Kramer [Sat, 30 Jan 2010 15:01:47 +0000 (15:01 +0000)]
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

14 years agoWe don't need to place 0 in the URL string now that we return a StringRef.
Benjamin Kramer [Sat, 30 Jan 2010 14:01:39 +0000 (14:01 +0000)]
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

14 years agoFix alignment for msp430 integer types.
Anton Korobeynikov [Sat, 30 Jan 2010 12:55:11 +0000 (12:55 +0000)]
Fix alignment for msp430 integer types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94879 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSilence clang++ warning.
Benjamin Kramer [Sat, 30 Jan 2010 12:15:41 +0000 (12:15 +0000)]
Silence clang++ warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94878 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoEliminate yet another old-school PerformCopyInitialization.
Anders Carlsson [Sat, 30 Jan 2010 01:56:32 +0000 (01:56 +0000)]
Eliminate yet another old-school PerformCopyInitialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94874 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd format string checking of 'double' arguments. Fixes <rdar://problem/6931734>.
Ted Kremenek [Sat, 30 Jan 2010 01:02:18 +0000 (01:02 +0000)]
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

14 years agoAdd test case for <rdar://problem/7068334> (which was fixed by r94864).
Ted Kremenek [Sat, 30 Jan 2010 00:56:00 +0000 (00:56 +0000)]
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

14 years agoAdd basic type checking of format string conversion specifiers and their arguments...
Ted Kremenek [Sat, 30 Jan 2010 00:49:51 +0000 (00:49 +0000)]
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

14 years agoBe a little more permissive than C99: allow 'unsigned' to be used for
Ted Kremenek [Fri, 29 Jan 2010 23:32:22 +0000 (23:32 +0000)]
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

14 years agoFix spacing.
Ted Kremenek [Fri, 29 Jan 2010 23:00:35 +0000 (23:00 +0000)]
Fix spacing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94852 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPer a suggestion from Cristian Draghici, add a method to FormatSpecifier that returns...
Ted Kremenek [Fri, 29 Jan 2010 22:59:32 +0000 (22:59 +0000)]
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

14 years agoUse appropriate context for typedefs.
Devang Patel [Fri, 29 Jan 2010 22:29:31 +0000 (22:29 +0000)]
Use appropriate context for typedefs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94849 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Don't honor -std-default for C++, this makes it hard to run the gdb test
Daniel Dunbar [Fri, 29 Jan 2010 21:03:02 +0000 (21:03 +0000)]
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

14 years agoSwitch Sema over to using the new implementation of format string
Ted Kremenek [Fri, 29 Jan 2010 20:55:36 +0000 (20:55 +0000)]
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

14 years agoEnhancements to the alternate (WIP) format string checking:
Ted Kremenek [Fri, 29 Jan 2010 20:29:53 +0000 (20:29 +0000)]
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

14 years agoPR5909 had a test case for binding of const, non-volatile references
Douglas Gregor [Fri, 29 Jan 2010 19:42:41 +0000 (19:42 +0000)]
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

14 years agoFix reference-binding when we have a reference to const volatile type;
Douglas Gregor [Fri, 29 Jan 2010 19:39:15 +0000 (19:39 +0000)]
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

14 years agoFix subtle bug in Preprocessor::AdvanceToTokenCharacter(): use '+=' instead of '='.
Ted Kremenek [Fri, 29 Jan 2010 19:38:24 +0000 (19:38 +0000)]
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

14 years agoFix reference binding of const lvalue references to bit-fields, which
Douglas Gregor [Fri, 29 Jan 2010 19:14:02 +0000 (19:14 +0000)]
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

14 years agoAnd yet another call.
Anders Carlsson [Fri, 29 Jan 2010 18:43:53 +0000 (18:43 +0000)]
And yet another call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94824 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAnother PerformCopyInitialization call bites the dust.
Anders Carlsson [Fri, 29 Jan 2010 18:37:50 +0000 (18:37 +0000)]
Another PerformCopyInitialization call bites the dust.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94823 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoNew test case.
Devang Patel [Fri, 29 Jan 2010 18:32:33 +0000 (18:32 +0000)]
New test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94821 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoGet rid of another old PerformCopyInitialization call.
Anders Carlsson [Fri, 29 Jan 2010 18:30:20 +0000 (18:30 +0000)]
Get rid of another old PerformCopyInitialization call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94819 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMaintain a map of regions (lexical scopes) and use it to find context for a global...
Devang Patel [Fri, 29 Jan 2010 18:11:03 +0000 (18:11 +0000)]
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

14 years agoAdd comment to test linking it back to the original Bugzilla PR.
Ted Kremenek [Fri, 29 Jan 2010 18:07:41 +0000 (18:07 +0000)]
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

14 years agoWhen naming a function template via a qualified-id (or any other way
Douglas Gregor [Fri, 29 Jan 2010 17:15:43 +0000 (17:15 +0000)]
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

14 years agocindex/Python: Update to support _getInstantiationLocation's new offset value.
Daniel Dunbar [Fri, 29 Jan 2010 17:02:32 +0000 (17:02 +0000)]
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

14 years agoDriver/Darwin: Fix a crash when diagnosing conflicting deployment targets.
Daniel Dunbar [Fri, 29 Jan 2010 17:02:25 +0000 (17:02 +0000)]
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

14 years agoName mangling for cast expressions, from Matthias Schiffer! Fixes PR5876.
Douglas Gregor [Fri, 29 Jan 2010 16:37:09 +0000 (16:37 +0000)]
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

14 years agoFix typo found by clang++. Yay for -Wuninitialized.
Benjamin Kramer [Fri, 29 Jan 2010 15:58:21 +0000 (15:58 +0000)]
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

14 years agoBring driver link order in CMake into alignment with the order in the Makefile.
Chandler Carruth [Fri, 29 Jan 2010 10:03:42 +0000 (10:03 +0000)]
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

14 years agoAdd getters.
Anders Carlsson [Fri, 29 Jan 2010 06:34:33 +0000 (06:34 +0000)]
Add getters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94803 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse EmitLValueForFieldInitialization when synthesizing the copy ctor as well.
Anders Carlsson [Fri, 29 Jan 2010 05:41:25 +0000 (05:41 +0000)]
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