John McCall
d7be78a052
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
2009-11-10 07:01:13 +00:00
Anders Carlsson
b76cd3d0c1
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
2009-11-10 04:46:30 +00:00
Anders Carlsson
2f019aadc9
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
2009-11-10 04:36:33 +00:00
Zhongxing Xu
cbe091f8ee
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
2009-11-10 04:22:08 +00:00
Zhongxing Xu
52cb277a1f
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
2009-11-10 04:20:20 +00:00
Anders Carlsson
4881b99bc8
Use PP.getLocForEndOfToken as suggested by John.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86661 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 03:32:44 +00:00
Zhongxing Xu
572ea2697d
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
2009-11-10 03:27:00 +00:00
Anders Carlsson
ad26b7376b
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
2009-11-10 03:24:44 +00:00
Anders Carlsson
8ac5a40ce5
Update xode project.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86658 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 03:23:35 +00:00
Zhongxing Xu
79234ca446
Add test case for PointerSubChecker.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 02:45:49 +00:00
Zhongxing Xu
adca27102f
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
2009-11-10 02:37:53 +00:00
Mike Stump
fbfb52d4cf
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
2009-11-10 02:30:51 +00:00
Zhongxing Xu
479529e679
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
2009-11-10 02:17:20 +00:00
Mike Stump
82d75b01f2
Finish off mangling for the VTT.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86647 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 01:58:37 +00:00
Mike Stump
ab3f7e9f5b
Add mangling for the construction vtable.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86643 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 01:41:59 +00:00
Jeffrey Yasskin
3958b50240
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
2009-11-10 01:17:45 +00:00
Daniel Dunbar
89f8c1d40e
Simplify, following MemoryBuffer::getSTDIN API fix.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:46:25 +00:00
Daniel Dunbar
731ad8f948
Switch to getFileOrSTDIN().
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86632 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:46:19 +00:00
Daniel Dunbar
9253e49492
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
2009-11-10 00:46:12 +00:00
Douglas Gregor
fee8a3c003
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
2009-11-10 00:39:07 +00:00
Daniel Dunbar
5fc7d344ae
Add PreprocessorOptions to CompilerInvocation.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86623 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 23:12:31 +00:00
Daniel Dunbar
2cdafa8001
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
2009-11-09 23:02:47 +00:00
Daniel Dunbar
26a0cac165
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
2009-11-09 22:46:17 +00:00
Daniel Dunbar
638c901ae3
Switch Target* to Target&.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86611 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:46:09 +00:00
Daniel Dunbar
0f25ae8baf
Add default initializer for Sysroot ivar.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:46:04 +00:00
Daniel Dunbar
227b2380f6
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
2009-11-09 22:45:57 +00:00
Daniel Dunbar
094a84cc06
(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
2009-11-09 22:45:47 +00:00
Mike Stump
3ada2df426
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
2009-11-09 22:40:09 +00:00
Fariborz Jahanian
d288bafe2d
Further change in a comment.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86599 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:28:08 +00:00
Fariborz Jahanian
9aea0ce248
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
2009-11-09 22:25:11 +00:00
Fariborz Jahanian
3451e9282a
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
2009-11-09 22:16:37 +00:00
Douglas Gregor
89c49f09b0
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
2009-11-09 22:08:55 +00:00
Ted Kremenek
99ef53a71b
Remove stale FIXME.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86595 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 21:56:44 +00:00
Douglas Gregor
ff4393c1ce
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
2009-11-09 21:35:27 +00:00
Fariborz Jahanian
d411b3f746
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
2009-11-09 21:02:05 +00:00
Daniel Dunbar
e29709f32e
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
2009-11-09 20:55:08 +00:00
Eli Friedman
c19aa99b57
Stub out a few more warning groups.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 20:19:49 +00:00
Benjamin Kramer
3f17a37357
Fix build after r86579.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 20:14:44 +00:00
Douglas Gregor
d47c47d65e
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
2009-11-09 19:27:57 +00:00
Eli Friedman
80c30dad6c
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
2009-11-09 19:20:36 +00:00
Douglas Gregor
0f8716b7bb
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
2009-11-09 19:17:50 +00:00
Benjamin Kramer
62cf322cf1
Factor CXString creation into a helper method.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 19:13:48 +00:00
Eli Friedman
d49c7b61d9
Add code generation test for r86500.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86574 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 18:49:09 +00:00
Fariborz Jahanian
8875334f78
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
2009-11-09 18:48:53 +00:00
Eli Friedman
8f4c59e912
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
2009-11-09 18:38:53 +00:00
Douglas Gregor
11a82401ea
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
2009-11-09 18:29:00 +00:00
Benjamin Kramer
858e5de143
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
2009-11-09 18:24:53 +00:00
Douglas Gregor
88d23952ea
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
2009-11-09 18:19:57 +00:00
Anders Carlsson
a23dcce1d0
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
2009-11-09 17:54:53 +00:00
Steve Naroff
ef0cef6cec
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
2009-11-09 17:45:52 +00:00