]> granicus.if.org Git - clang/log
clang
15 years agoImprove parsing of template arguments to lay the foundation for
Douglas Gregor [Tue, 10 Nov 2009 19:49:08 +0000 (19:49 +0000)]
Improve parsing of template arguments to lay the foundation for
handling template template parameters properly. This refactoring:

  - Parses template template arguments as id-expressions, representing
    the result of the parse as a template name (Action::TemplateTy)
    rather than as an expression (lame!).

  - Represents all parsed template arguments via a new parser-specific
    type, ParsedTemplateArgument, which stores the kind of template
    argument (type, non-type, template) along with all of the source
    information about the template argument. This replaces an ad hoc
    set of 3 vectors (one for a void*, which was either a type or an
    expression; one for a bit telling whether the first was a type or
    an expression; and one for a single source location pointing at
    the template argument).

  - Moves TemplateIdAnnotation into the new Parse/Template.h. It never
    belonged in the Basic library anyway.

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

15 years agoChanged a variable name to match what it represents
Fariborz Jahanian [Tue, 10 Nov 2009 19:31:09 +0000 (19:31 +0000)]
Changed a variable name to match what it represents
(Ted's feedback).

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

15 years agoThis patch implements Code gen. for destruction of
Fariborz Jahanian [Tue, 10 Nov 2009 19:24:06 +0000 (19:24 +0000)]
This patch implements Code gen. for destruction of
global array of objects.

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

15 years agoCIndex: Only display diagnostics to llvm::errs() when the client has set the 'display...
Ted Kremenek [Tue, 10 Nov 2009 19:18:52 +0000 (19:18 +0000)]
CIndex: Only display diagnostics to llvm::errs() when the client has set the 'displayDiagnostics' option to 1 in clang_createIndex().  This fixes <rdar://problem/7370691>.

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

15 years agoOnly generate a VTT for classes that need a VTT.
Mike Stump [Tue, 10 Nov 2009 19:13:04 +0000 (19:13 +0000)]
Only generate a VTT for classes that need a VTT.

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

15 years agoDriver: Run 'clang' in C++ mode based on the name it was invoked by. We match
Daniel Dunbar [Tue, 10 Nov 2009 18:47:41 +0000 (18:47 +0000)]
Driver: Run 'clang' in C++ mode based on the name it was invoked by. We match
anything that ends with ++ or ++-FOO (e.g., c++, clang++, clang++-1.1) as being
a "C++ compiler".

This allows easy testing of the C++ compiler by 'ln -s clang clang++', or by 'cp
clang clang++'.

Based on patch by Roman Divacky.

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

15 years agoFactor out parts of InitializeCompileOptions that depend on the LangOptions.
Daniel Dunbar [Tue, 10 Nov 2009 18:47:35 +0000 (18:47 +0000)]
Factor out parts of InitializeCompileOptions that depend on the LangOptions.

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

15 years agoLocalize -disable-llvm-optzns handling to BackendConsumer::CreatePasses.
Daniel Dunbar [Tue, 10 Nov 2009 17:50:53 +0000 (17:50 +0000)]
Localize -disable-llvm-optzns handling to BackendConsumer::CreatePasses.
 - This is conceptually better since the only thing we want this option to do is
   preserve the internal module as constructed by IRgen, before running any
   passes.

 - This also fixes bugs in -disable-llvm-optzns handling with regards to debug
   info.

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

15 years agoclang-cc: Start sinking (CodeGen) options into namespaces to limit their scope.
Daniel Dunbar [Tue, 10 Nov 2009 17:50:42 +0000 (17:50 +0000)]
clang-cc: Start sinking (CodeGen) options into namespaces to limit their scope.

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

15 years agoCleanup some clang-cc FIXMEs
Daniel Dunbar [Tue, 10 Nov 2009 16:23:44 +0000 (16:23 +0000)]
Cleanup some clang-cc FIXMEs

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

15 years agoAdd CompileOptions to CompilerInvocation.
Daniel Dunbar [Tue, 10 Nov 2009 16:19:45 +0000 (16:19 +0000)]
Add CompileOptions to CompilerInvocation.

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

15 years agoFix a similar problem with qualified lookup through using directives,
John McCall [Tue, 10 Nov 2009 09:25:37 +0000 (09:25 +0000)]
Fix a similar problem with qualified lookup through using directives,
although in this case we probably just run a risk of duplicating work;
I can't think of how this could cause a bug.

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

15 years agoMake a somewhat more convincing test case for unqualified lookup through
John McCall [Tue, 10 Nov 2009 09:20:04 +0000 (09:20 +0000)]
Make a somewhat more convincing test case for unqualified lookup through
using directives, and fix a bug thereby exposed:  since we're playing
tricks with pointers, we need to make certain we're always using the same
pointers for things.
Also tweak an existing error message.

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

15 years agoIgnore parentheses when check the type of the expr.
Zhongxing Xu [Tue, 10 Nov 2009 08:33:44 +0000 (08:33 +0000)]
Ignore parentheses when check the type of the expr.

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

15 years agoSimple test case for [basic.lookup.udir].
John McCall [Tue, 10 Nov 2009 07:56:40 +0000 (07:56 +0000)]
Simple test case for [basic.lookup.udir].

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

15 years agoSizeofPointerChecker: Many false positives have the form 'sizeof *p'.
Zhongxing Xu [Tue, 10 Nov 2009 07:52:53 +0000 (07:52 +0000)]
SizeofPointerChecker: Many false positives have the form 'sizeof *p'.
This is reasonable because people know what they are doing when they
intentionally dereference the pointer.
So now we only emit warning when a pointer variable is use literally.

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

15 years agoAdd vtable caching to prevent multiple vtables for the same class from
Mike Stump [Tue, 10 Nov 2009 07:44:33 +0000 (07:44 +0000)]
Add vtable caching to prevent multiple vtables for the same class from
being generated.

Add the most derived vtable pointer to the VTT.

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

15 years agoFix unqualified lookup through using directives.
John McCall [Tue, 10 Nov 2009 07:01:13 +0000 (07:01 +0000)]
Fix unqualified lookup through using directives.

This is a pretty minimal test case;  I'll make a better one later.

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

15 years agoWhen trying to assign a regular string literal to an Objective-C 'id' type or a point...
Anders Carlsson [Tue, 10 Nov 2009 04:46:30 +0000 (04:46 +0000)]
When trying to assign a regular string literal to an Objective-C 'id' type or a pointer to an NSString, emit a code insertion hint that turns it into an Objective-C string. For example:

@class NSString;

@interface Test
+ (void)test:(NSString *)string;
@end

void g(NSString *a);

void f() {
  NSString *a = "Foo";
  g("Foo");
  [Test test:"Foo"];
}

will produce

t.m:10:17: warning: incompatible pointer types initializing 'char [4]', expected 'NSString *'
  NSString *a = "Foo";
                ^~~~~
                @
t.m:11:5: warning: incompatible pointer types passing 'char [4]', expected 'NSString *'
  g("Foo");
    ^~~~~
    @
t.m:12:14: warning: incompatible pointer types sending 'char [4]', expected 'NSString *'
  [Test test:"Foo"];
             ^~~~~
             @
3 diagnostics generated.

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

15 years agoDon't try to emit null fixit hints.
Anders Carlsson [Tue, 10 Nov 2009 04:36:33 +0000 (04:36 +0000)]
Don't try to emit null fixit hints.

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

15 years agoNow we can safely use the argument expression's source range.
Zhongxing Xu [Tue, 10 Nov 2009 04:22:08 +0000 (04:22 +0000)]
Now we can safely use the argument expression's source range.

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

15 years agoSizeofPointerChecker: If an explicit type specifier is used, do not issue warnings.
Zhongxing Xu [Tue, 10 Nov 2009 04:20:20 +0000 (04:20 +0000)]
SizeofPointerChecker: If an explicit type specifier is used, do not issue warnings.

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

15 years agoUse PP.getLocForEndOfToken as suggested by John.
Anders Carlsson [Tue, 10 Nov 2009 03:32:44 +0000 (03:32 +0000)]
Use PP.getLocForEndOfToken as suggested by John.

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

15 years agoUse the source range of the whole sizeof expression, otherwise it crashes when
Zhongxing Xu [Tue, 10 Nov 2009 03:27:00 +0000 (03:27 +0000)]
Use the source range of the whole sizeof expression, otherwise it crashes when
the argument is not an expression.

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

15 years agoIf a function with a default argument is redefined and the new function also has...
Anders Carlsson [Tue, 10 Nov 2009 03:24:44 +0000 (03:24 +0000)]
If a function with a default argument is redefined and the new function also has a defualt argument then add a fixit hint that removes the default argument. Fixes PR5444.

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

15 years agoUpdate xode project.
Anders Carlsson [Tue, 10 Nov 2009 03:23:35 +0000 (03:23 +0000)]
Update xode project.

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

15 years agoAdd test case for PointerSubChecker.
Zhongxing Xu [Tue, 10 Nov 2009 02:45:49 +0000 (02:45 +0000)]
Add test case for PointerSubChecker.

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

15 years agoRefine PointerSubChecker: compare the base region instead of the original
Zhongxing Xu [Tue, 10 Nov 2009 02:37:53 +0000 (02:37 +0000)]
Refine PointerSubChecker: compare the base region instead of the original
region, so that arithmetic within a memory chunk is allowed.

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

15 years agoBe sure to clear out VCall when we clear out VCalls.
Mike Stump [Tue, 10 Nov 2009 02:30:51 +0000 (02:30 +0000)]
Be sure to clear out VCall when we clear out VCalls.

Start implementing VTTs.  WIP.

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

15 years agoRename: StripCasts describes what it does better.
Zhongxing Xu [Tue, 10 Nov 2009 02:17:20 +0000 (02:17 +0000)]
Rename: StripCasts describes what it does better.
getBaseRegion will be used in another method.

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

15 years agoFinish off mangling for the VTT.
Mike Stump [Tue, 10 Nov 2009 01:58:37 +0000 (01:58 +0000)]
Finish off mangling for the VTT.

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

15 years agoAdd mangling for the construction vtable.
Mike Stump [Tue, 10 Nov 2009 01:41:59 +0000 (01:41 +0000)]
Add mangling for the construction vtable.

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

15 years agoFix clang's use of DenseMap iterators after r86636 fixed their constness.
Jeffrey Yasskin [Tue, 10 Nov 2009 01:17:45 +0000 (01:17 +0000)]
Fix clang's use of DenseMap iterators after r86636 fixed their constness.
Patch by Victor Zverovich!

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

15 years agoSimplify, following MemoryBuffer::getSTDIN API fix.
Daniel Dunbar [Tue, 10 Nov 2009 00:46:25 +0000 (00:46 +0000)]
Simplify, following MemoryBuffer::getSTDIN API fix.

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

15 years agoSwitch to getFileOrSTDIN().
Daniel Dunbar [Tue, 10 Nov 2009 00:46:19 +0000 (00:46 +0000)]
Switch to getFileOrSTDIN().

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

15 years agoRemove some if-0'd code, we can resurrect this if we ever decide to support
Daniel Dunbar [Tue, 10 Nov 2009 00:46:12 +0000 (00:46 +0000)]
Remove some if-0'd code, we can resurrect this if we ever decide to support
continuing after invalid PCH loads.

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

15 years agoMove all of the type-printing logic to its own C++ source file
Douglas Gregor [Tue, 10 Nov 2009 00:39:07 +0000 (00:39 +0000)]
Move all of the type-printing logic to its own C++ source file

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

15 years agoAdd PreprocessorOptions to CompilerInvocation.
Daniel Dunbar [Mon, 9 Nov 2009 23:12:31 +0000 (23:12 +0000)]
Add PreprocessorOptions to CompilerInvocation.

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

15 years agoPrivatize InitHeaderSearch, this functionality is only exposed via
Daniel Dunbar [Mon, 9 Nov 2009 23:02:47 +0000 (23:02 +0000)]
Privatize InitHeaderSearch, this functionality is only exposed via
ApplyHeaderSearchOptions now.

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

15 years agoMove LangOptions, HeaderSearchOptions, and the target feature map into
Daniel Dunbar [Mon, 9 Nov 2009 22:46:17 +0000 (22:46 +0000)]
Move LangOptions, HeaderSearchOptions, and the target feature map into
CompilerInvocation.

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

15 years agoSwitch Target* to Target&.
Daniel Dunbar [Mon, 9 Nov 2009 22:46:09 +0000 (22:46 +0000)]
Switch Target* to Target&.

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

15 years agoAdd default initializer for Sysroot ivar.
Daniel Dunbar [Mon, 9 Nov 2009 22:46:04 +0000 (22:46 +0000)]
Add default initializer for Sysroot ivar.

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

15 years agoChange clang-cc to expect that all inputs have the same language (so we can only...
Daniel Dunbar [Mon, 9 Nov 2009 22:45:57 +0000 (22:45 +0000)]
Change clang-cc to expect that all inputs have the same language (so we can only construct a single LangInfo). This matches how it is used in practice (since the compiler only it invokes it for one file at a time).

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

15 years ago(llvm up) Convert clang-cc.cpp:GetLanguage to StringSwitch.
Daniel Dunbar [Mon, 9 Nov 2009 22:45:47 +0000 (22:45 +0000)]
(llvm up) Convert clang-cc.cpp:GetLanguage to StringSwitch.

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

15 years agoEnable the use of the new llvm objectsize intrinsic.
Mike Stump [Mon, 9 Nov 2009 22:40:09 +0000 (22:40 +0000)]
Enable the use of the new llvm objectsize intrinsic.

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

15 years agoFurther change in a comment.
Fariborz Jahanian [Mon, 9 Nov 2009 22:28:08 +0000 (22:28 +0000)]
Further change in a comment.

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

15 years agoRemoved a FIXME on nested type specifier warning.
Fariborz Jahanian [Mon, 9 Nov 2009 22:25:11 +0000 (22:25 +0000)]
Removed a FIXME on nested type specifier warning.

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

15 years agoChanged error for nested type qualifier mismatch to
Fariborz Jahanian [Mon, 9 Nov 2009 22:16:37 +0000 (22:16 +0000)]
Changed error for nested type qualifier mismatch to
warning, to match gcc. It used to be warning, so
better keep it a warning (it broke a certain project).

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

15 years agoMake sure that Type::getAs<ArrayType>() (or Type::getAs<subclass of
Douglas Gregor [Mon, 9 Nov 2009 22:08:55 +0000 (22:08 +0000)]
Make sure that Type::getAs<ArrayType>() (or Type::getAs<subclass of
ArrayType>()) does not instantiate. Update all callers that used this
unsafe feature to use the appropriate ASTContext::getAs*ArrayType method.

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

15 years agoRemove stale FIXME.
Ted Kremenek [Mon, 9 Nov 2009 21:56:44 +0000 (21:56 +0000)]
Remove stale FIXME.

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

15 years agoMake sure that we look into nested, transparent declaration contexts
Douglas Gregor [Mon, 9 Nov 2009 21:35:27 +0000 (21:35 +0000)]
Make sure that we look into nested, transparent declaration contexts
when looking for a name within a given DeclContext. Now enumerators
will show up in code-completion results.

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

15 years agoFor array pointee type, get its cvr qualifier from
Fariborz Jahanian [Mon, 9 Nov 2009 21:02:05 +0000 (21:02 +0000)]
For array pointee type, get its cvr qualifier from
its element type. Fixes pr5432.

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

15 years agoAdd CompilerInvocation object, to capture all the options one needs to invoke
Daniel Dunbar [Mon, 9 Nov 2009 20:55:08 +0000 (20:55 +0000)]
Add CompilerInvocation object, to capture all the options one needs to invoke
the compiler, and start flood filling it into clang-cc.

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

15 years agoStub out a few more warning groups.
Eli Friedman [Mon, 9 Nov 2009 20:19:49 +0000 (20:19 +0000)]
Stub out a few more warning groups.

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

15 years agoFix build after r86579.
Benjamin Kramer [Mon, 9 Nov 2009 20:14:44 +0000 (20:14 +0000)]
Fix build after r86579.

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

15 years agoMake sure that we instantiate default function arguments for an
Douglas Gregor [Mon, 9 Nov 2009 19:27:57 +0000 (19:27 +0000)]
Make sure that we instantiate default function arguments for an
overloaded operator().

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

15 years agoAdd additional note to mark the cause of synthesized constructors. Mark
Eli Friedman [Mon, 9 Nov 2009 19:20:36 +0000 (19:20 +0000)]
Add additional note to mark the cause of synthesized constructors.  Mark
declaration invalid if the constructor can't be properly built.  Addresses
remaining review comments from Fariborz for r86500.

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

15 years agoImprove instantiation of default template arguments for nested
Douglas Gregor [Mon, 9 Nov 2009 19:17:50 +0000 (19:17 +0000)]
Improve instantiation of default template arguments for nested
templates. The instantiation of these default arguments must be (and
now, is) delayed until the template argument is actually used, at
which point we substitute all levels of template arguments
concurrently.

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

15 years agoFactor CXString creation into a helper method.
Benjamin Kramer [Mon, 9 Nov 2009 19:13:48 +0000 (19:13 +0000)]
Factor CXString creation into a helper method.

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

15 years agoAdd code generation test for r86500.
Eli Friedman [Mon, 9 Nov 2009 18:49:09 +0000 (18:49 +0000)]
Add code generation test for r86500.

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

15 years agoTest case for Sean Hunt's patch which I left out.
Fariborz Jahanian [Mon, 9 Nov 2009 18:48:53 +0000 (18:48 +0000)]
Test case for Sean Hunt's patch which I left out.

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

15 years agoAdd support for cdecl attribute. (As far as I know, it doesn't affect CodeGen
Eli Friedman [Mon, 9 Nov 2009 18:38:53 +0000 (18:38 +0000)]
Add support for cdecl attribute.  (As far as I know, it doesn't affect CodeGen
unless we start implementing command-line switches which override the default
calling convention, so the effect is mostly to silence unknown attribute
warnings.)

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

15 years agoSlightly more testing for instantiation of non-type template parameters in nested...
Douglas Gregor [Mon, 9 Nov 2009 18:29:00 +0000 (18:29 +0000)]
Slightly more testing for instantiation of non-type template parameters in nested templates, for my own sanity's sake

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

15 years agoWriting to a struct passed by value is pointless. Remove dead code.
Benjamin Kramer [Mon, 9 Nov 2009 18:24:53 +0000 (18:24 +0000)]
Writing to a struct passed by value is pointless. Remove dead code.

- free(NULL) is a nop anyway.
- if someone thinks calling clang_disposeString twice should be legal
  please change the method to take a pointer.

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

15 years agoImprove c-index-test's parsing of the -code-completion-at=file:line:column argument
Douglas Gregor [Mon, 9 Nov 2009 18:19:57 +0000 (18:19 +0000)]
Improve c-index-test's parsing of the -code-completion-at=file:line:column argument

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

15 years agoAdd a triple to try to fix the buildbot error.
Anders Carlsson [Mon, 9 Nov 2009 17:54:53 +0000 (17:54 +0000)]
Add a triple to try to fix the buildbot error.

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

15 years agoIntroduce CXString type and associated functions clang_getCString() and clang_dispose...
Steve Naroff [Mon, 9 Nov 2009 17:45:52 +0000 (17:45 +0000)]
Introduce CXString type and associated functions clang_getCString() and clang_disposeString().

This abstraction will help us manage string memory for complex names that cross the C++/C boundary (e.g. ObjC methods, selectors). This patch also uses it in clang_getTranslationUnitSpelling (which I'm not sure is necessary). Will investigate later...since the extra malloc() can't hurt (for now).

Patch by John Thompson.

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

15 years ago__uint128_t is indeed an unsigned integer type. Fixes PR5435.
Anders Carlsson [Mon, 9 Nov 2009 17:34:18 +0000 (17:34 +0000)]
__uint128_t is indeed an unsigned integer type. Fixes PR5435.

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

15 years agoWhen transforming an InitListExpr, if we already computed a non-dependent type for...
Douglas Gregor [Mon, 9 Nov 2009 17:16:50 +0000 (17:16 +0000)]
When transforming an InitListExpr, if we already computed a non-dependent type for the InitListExpr, keep it

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

15 years agoC doesn't allow mixing declarations and statements, silly
Douglas Gregor [Mon, 9 Nov 2009 17:05:28 +0000 (17:05 +0000)]
C doesn't allow mixing declarations and statements, silly

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

15 years agoSimplify test to deal with type-based ordering variations
Douglas Gregor [Mon, 9 Nov 2009 16:22:45 +0000 (16:22 +0000)]
Simplify test to deal with type-based ordering variations

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

15 years agoVerify that code-completion is at least a little bit robust against inclusion of...
Douglas Gregor [Mon, 9 Nov 2009 16:06:30 +0000 (16:06 +0000)]
Verify that code-completion is at least a little bit robust against inclusion of missing headers

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

15 years agoMinor cleanup for CIndex-based code-completion:
Douglas Gregor [Mon, 9 Nov 2009 16:04:45 +0000 (16:04 +0000)]
Minor cleanup for CIndex-based code-completion:
  - Provide an actual test for code-completion via CIndex.
  - Actually print optional strings in c-index-test
  - Export clang_getCompletionChunkCompletionString from CIndex

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

15 years agoFix a broken link
Douglas Gregor [Mon, 9 Nov 2009 15:15:41 +0000 (15:15 +0000)]
Fix a broken link

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

15 years agoupdate test case.
Zhongxing Xu [Mon, 9 Nov 2009 13:56:44 +0000 (13:56 +0000)]
update test case.

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

15 years agoAdd check for pointer arithmetic on non-array variables.
Zhongxing Xu [Mon, 9 Nov 2009 13:23:31 +0000 (13:23 +0000)]
Add check for pointer arithmetic on non-array variables.

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

15 years agoAdd check for obsolete function call of getpw().
Zhongxing Xu [Mon, 9 Nov 2009 12:19:26 +0000 (12:19 +0000)]
Add check for obsolete function call of getpw().

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

15 years agoremove redundant file name in CMakeLists.txt.
Zhongxing Xu [Mon, 9 Nov 2009 09:35:41 +0000 (09:35 +0000)]
remove redundant file name in CMakeLists.txt.

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

15 years agoupdate CMakeList.txt
Zhongxing Xu [Mon, 9 Nov 2009 09:32:38 +0000 (09:32 +0000)]
update CMakeList.txt

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

15 years agoUpdate CMake
Daniel Dunbar [Mon, 9 Nov 2009 08:13:45 +0000 (08:13 +0000)]
Update CMake

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

15 years agoAdd comments.
Zhongxing Xu [Mon, 9 Nov 2009 08:13:04 +0000 (08:13 +0000)]
Add comments.

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

15 years agoAdd checker for CWE-588: Attempt to Access Child of a Non-structure Pointer.
Zhongxing Xu [Mon, 9 Nov 2009 08:07:38 +0000 (08:07 +0000)]
Add checker for CWE-588: Attempt to Access Child of a Non-structure Pointer.

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

15 years agoUpdate CMake
Daniel Dunbar [Mon, 9 Nov 2009 08:04:31 +0000 (08:04 +0000)]
Update CMake

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

15 years agoPut all long strings in 80-col.
Zhongxing Xu [Mon, 9 Nov 2009 07:29:39 +0000 (07:29 +0000)]
Put all long strings in 80-col.

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

15 years agoAdd checker for CWE-587: Assignment of a Fixed Address to a Pointer.
Zhongxing Xu [Mon, 9 Nov 2009 06:52:44 +0000 (06:52 +0000)]
Add checker for CWE-587: Assignment of a Fixed Address to a Pointer.

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

15 years agoAdd checker for CWE-469: Use of Pointer Subtraction to Determine Size. This
Zhongxing Xu [Mon, 9 Nov 2009 05:34:10 +0000 (05:34 +0000)]
Add checker for CWE-469: Use of Pointer Subtraction to Determine Size. This
checker does not build sink nodes. Because svaluator computes an unknown value
for the subtraction now.

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

15 years agoRearrange function to avoid recursive use-after-free.
Eli Friedman [Mon, 9 Nov 2009 05:07:37 +0000 (05:07 +0000)]
Rearrange function to avoid recursive use-after-free.

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

15 years agoExplicitly note that pre-inc/dec lvalues are not supported yet, so that it
Eli Friedman [Mon, 9 Nov 2009 04:20:47 +0000 (04:20 +0000)]
Explicitly note that pre-inc/dec lvalues are not supported yet, so that it
doesn't crash.  (Such expressions are valid in C++, but not in C.)

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

15 years agoRemove dead code.
Zhongxing Xu [Mon, 9 Nov 2009 04:19:30 +0000 (04:19 +0000)]
Remove dead code.

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

15 years agofix thinko
Chris Lattner [Mon, 9 Nov 2009 04:04:07 +0000 (04:04 +0000)]
fix thinko

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

15 years agoAdd hack to make the given testcase work. As far as I can tell, this change is
Eli Friedman [Mon, 9 Nov 2009 03:59:26 +0000 (03:59 +0000)]
Add hack to make the given testcase work.  As far as I can tell, this change is
reasonably safe, but it doesn't seem like the right solution.

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

15 years agomention that clang defaults to C99 mode, PR5388
Chris Lattner [Mon, 9 Nov 2009 03:21:02 +0000 (03:21 +0000)]
mention that clang defaults to C99 mode, PR5388

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

15 years agoremove a mostly obsolete "word of warning"
Chris Lattner [Mon, 9 Nov 2009 03:18:18 +0000 (03:18 +0000)]
remove a mostly obsolete "word of warning"

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

15 years agoAdd a test case for CWE-467, and simplify the wording of the warning.
Zhongxing Xu [Mon, 9 Nov 2009 02:28:12 +0000 (02:28 +0000)]
Add a test case for CWE-467, and simplify the wording of the warning.

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

15 years agoRename areAllFields32Or64BitBasicType to canExpandIndirectArgument to closer match...
Daniel Dunbar [Mon, 9 Nov 2009 01:33:53 +0000 (01:33 +0000)]
Rename areAllFields32Or64BitBasicType to canExpandIndirectArgument to closer match what it is semantically used for.

Also, fix a major bug where fields from a C++ struct might be dropped -- the expand action doesn't handle them correctly yet.

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

15 years agoRemove a useless variable that got left behind.
Eli Friedman [Mon, 9 Nov 2009 01:11:03 +0000 (01:11 +0000)]
Remove a useless variable that got left behind.

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

15 years agoUnify the codepaths used to verify base and member initializers for explicitly
Eli Friedman [Mon, 9 Nov 2009 01:05:47 +0000 (01:05 +0000)]
Unify the codepaths used to verify base and member initializers for explicitly
and implicitly defined constructors.  This has a number of benefits:

1. Less code.

2. Explicit and implicit constructors get the same diagnostics.

3. The AST explicitly contains constructor calls from implicit default
constructors.  This allows handing some cases that previously weren't handled
correctly in IRGen without any additional code. Specifically, implicit default
constructors containing calls to constructors with default arguments are now
handled correctly.

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

15 years agoFix use-after-free bug.
Eli Friedman [Sun, 8 Nov 2009 22:15:39 +0000 (22:15 +0000)]
Fix use-after-free bug.

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

15 years agoUpdate CMake file.
Benjamin Kramer [Sun, 8 Nov 2009 18:30:42 +0000 (18:30 +0000)]
Update CMake file.

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

15 years agoSpecial-case default argument expression in instantiation. This should fix PR4301...
Sebastian Redl [Sun, 8 Nov 2009 13:56:19 +0000 (13:56 +0000)]
Special-case default argument expression in instantiation. This should fix PR4301. Doug, please double-check my assumptions. Read the PR for more details.

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