]> granicus.if.org Git - clang/log
clang
15 years agoCastToStructChecker: use 'isStructureType()' instead of 'isRecordType()' to determine...
Ted Kremenek [Wed, 11 Nov 2009 06:43:42 +0000 (06:43 +0000)]
CastToStructChecker: use 'isStructureType()' instead of 'isRecordType()' to determine if a pointer is casted to a struct pointer.  This fixes an observed false positive when a value is casted to a union.

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

15 years agoFix display of "ANALYZE" statements in AnalysisConsumer by correctly resetting the...
Ted Kremenek [Wed, 11 Nov 2009 06:28:42 +0000 (06:28 +0000)]
Fix display of "ANALYZE" statements in AnalysisConsumer by correctly resetting the flag indicating that the current Decl* has not yet been displayed.  Also move this out of AnalysisManager, since AnalysisManager should not handle text output to the user.

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

15 years agoclang-cc: Move InitializePreprocessorOptions to Options.cpp
Daniel Dunbar [Wed, 11 Nov 2009 06:10:03 +0000 (06:10 +0000)]
clang-cc: Move InitializePreprocessorOptions to Options.cpp

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

15 years agoRemove public headers for UndefinedArgChecker, AttrNonNullChecker, and BadCallChecker...
Ted Kremenek [Wed, 11 Nov 2009 05:50:44 +0000 (05:50 +0000)]
Remove public headers for UndefinedArgChecker, AttrNonNullChecker, and BadCallChecker, making their implementations completely private.

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

15 years agoclang-cc: Simplify this code, now that predefines handling is uniform in the
Daniel Dunbar [Wed, 11 Nov 2009 05:33:31 +0000 (05:33 +0000)]
clang-cc: Simplify this code, now that predefines handling is uniform in the
PCH/-E and PCH/not--E cases.

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

15 years agoRedo how PCH handles its implicit include. Instead of treating this specially in
Daniel Dunbar [Wed, 11 Nov 2009 05:29:04 +0000 (05:29 +0000)]
Redo how PCH handles its implicit include. Instead of treating this specially in
the front-end (as far as the preprocessor goes), follow the usual logic of
inserting the (original include path) name into the predefines buffer. This
pushes the responsibility for handling this to PCH instead of the front-end.  In
PCH this requires being a little more clever when we diff the predefines
buffers.

Neither of these solutions are particularly great, I think what we eventually
should do is something like gcc where we insert a special marker to indicate the
PCH file, but then run the preprocessor as usual. This would be clearer and
would allow us to drop the overly clever predefines handling.

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

15 years agoMore StringRef simplification to PCHValidator::ReadPredefinesBuffer.
Daniel Dunbar [Wed, 11 Nov 2009 05:26:28 +0000 (05:26 +0000)]
More StringRef simplification to PCHValidator::ReadPredefinesBuffer.

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

15 years agoAnd now a test fix in +Asserts mode, which I broke.
Daniel Dunbar [Wed, 11 Nov 2009 03:48:34 +0000 (03:48 +0000)]
And now a test fix in +Asserts mode, which I broke.

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

15 years agoFix some tests in -Asserts mode.
Daniel Dunbar [Wed, 11 Nov 2009 03:48:26 +0000 (03:48 +0000)]
Fix some tests in -Asserts mode.
 - FileCheck is a *huuuuge* improvement here.

 - Still feels like we could use a better tool for this though, either teach
   llvm-dis to spit out the FileCheck syntax, or provide another tool to turn a
   .ll into a "matchable" input.

 - Also on my Christmas list is better FileCheck diagnostics with missing
   variables or mismatches.

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

15 years agoRewrite splitLines using StringRef; this is much simpler, and also now avoids
Daniel Dunbar [Wed, 11 Nov 2009 03:45:59 +0000 (03:45 +0000)]
Rewrite splitLines using StringRef; this is much simpler, and also now avoids
tons of std::string trashing. I plan to move this and other fun string munging
utilities to a StringRefExtras.h at some point if no one beats me to it.

On a synthetic benchmark on x86_64, llvm-gcc actually generates code thats 10%
faster using the StringRef version. gcc miscompiles the synthetic benchmark,
which I'm crossing my fingers and hoping won't happen here. clang compiles the
sythetic benchmark correctly (wootness), but the StringRef version is
slower. Silly clang.

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

15 years agoRefactor DereferenceChecker to use only the new Checker API instead of
Ted Kremenek [Wed, 11 Nov 2009 03:26:34 +0000 (03:26 +0000)]
Refactor DereferenceChecker to use only the new Checker API instead of
the old builder API.  This percolated a bunch of changes up to the
Checker class (where CheckLocation has been renamed VisitLocation) and
GRExprEngine.  ProgramPoint now has the notion of a "LocationCheck"
point (with PreLoad and PreStore respectively), and a bunch of the old
ProgramPoints that are no longer used have been removed.

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

15 years agoPreserve source locations when building offsetof expressions featuring
John McCall [Wed, 11 Nov 2009 03:23:23 +0000 (03:23 +0000)]
Preserve source locations when building offsetof expressions featuring
anonymous members.  Partial fix for PR 5390.

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

15 years agoMore VTT work. We now track offsets and use the ctor vtable builder
Mike Stump [Wed, 11 Nov 2009 03:08:24 +0000 (03:08 +0000)]
More VTT work.  We now track offsets and use the ctor vtable builder
interface.  WIP.

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

15 years agoFixup spacing.
Mike Stump [Wed, 11 Nov 2009 02:49:00 +0000 (02:49 +0000)]
Fixup spacing.

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

15 years agoApparently the following idiom is specifically encouraged:
John McCall [Wed, 11 Nov 2009 02:41:58 +0000 (02:41 +0000)]
Apparently the following idiom is specifically encouraged:
  if (self = [super init])
Recognize it and only warn if -Wparentheses is explicitly enabled.

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

15 years agoAvoid generating additional destructor(s) for initialized constructed
Fariborz Jahanian [Wed, 11 Nov 2009 01:13:34 +0000 (01:13 +0000)]
Avoid generating additional destructor(s) for initialized constructed
objects.

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

15 years agoIntroduce a new representation for template template
Douglas Gregor [Wed, 11 Nov 2009 01:00:40 +0000 (01:00 +0000)]
Introduce a new representation for template template
parameters. Rather than storing them as either declarations (for the
non-dependent case) or expressions (for the dependent case), we now
(always) store them as TemplateNames.

The primary change here is to add a new kind of TemplateArgument,
which stores a TemplateName. However, making that change ripples to
every switch on a TemplateArgument's kind, also affecting
TemplateArgumentLocInfo/TemplateArgumentLoc, default template
arguments for template template parameters, type-checking of template
template arguments, etc.

This change is light on testing. It should fix several pre-existing
problems with template template parameters, such as:
  - the inability to use dependent template names as template template
  arguments
  - template template parameter default arguments cannot be
  instantiation

However, there are enough pieces missing that more implementation is
required before we can adequately test template template parameters.

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

15 years agoRecognize -fsyntax-only as a "consumer only" action.
Daniel Dunbar [Wed, 11 Nov 2009 00:54:56 +0000 (00:54 +0000)]
Recognize -fsyntax-only as a "consumer only" action.

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

15 years agoStringRefify some PCH interfaces.
Daniel Dunbar [Wed, 11 Nov 2009 00:52:11 +0000 (00:52 +0000)]
StringRefify some PCH interfaces.

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

15 years agoReplace startsWith functions with StringRef.
Daniel Dunbar [Wed, 11 Nov 2009 00:52:00 +0000 (00:52 +0000)]
Replace startsWith functions with StringRef.

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

15 years agoStub out most of the VTT building code. WIP.
Mike Stump [Wed, 11 Nov 2009 00:35:07 +0000 (00:35 +0000)]
Stub out most of the VTT building code.  WIP.

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

15 years agoCreate a new Scope when parsing a declaration with a C++ scope specifier.
John McCall [Wed, 11 Nov 2009 00:21:18 +0000 (00:21 +0000)]
Create a new Scope when parsing a declaration with a C++ scope specifier.

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

15 years agoAdd Diagnostic::Report method for reporting diagnostics without a location.
Daniel Dunbar [Tue, 10 Nov 2009 23:55:23 +0000 (23:55 +0000)]
Add Diagnostic::Report method for reporting diagnostics without a location.

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

15 years agoPreprocessorOptions: Get rid of unnecessary 'isPTH' flag for include entries.
Daniel Dunbar [Tue, 10 Nov 2009 23:53:43 +0000 (23:53 +0000)]
PreprocessorOptions: Get rid of unnecessary 'isPTH' flag for include entries.

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

15 years agoDiagnose illegally typed operator new/new[].
Fariborz Jahanian [Tue, 10 Nov 2009 23:47:18 +0000 (23:47 +0000)]
Diagnose illegally typed operator new/new[].

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

15 years agoAttach location info with llvm.dbg.declare.
Devang Patel [Tue, 10 Nov 2009 23:07:24 +0000 (23:07 +0000)]
Attach location info with llvm.dbg.declare.

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

15 years agoAdd FIXIT hint for -Wsemicolon-before-method-body
Ted Kremenek [Tue, 10 Nov 2009 22:55:49 +0000 (22:55 +0000)]
Add FIXIT hint for -Wsemicolon-before-method-body

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

15 years agoRevert r86741; it doesn't handle virtual bases correctly.
Eli Friedman [Tue, 10 Nov 2009 22:48:10 +0000 (22:48 +0000)]
Revert r86741; it doesn't handle virtual bases correctly.

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

15 years agoMinor optimization to skip null check in generated code where it isn't
Eli Friedman [Tue, 10 Nov 2009 22:42:26 +0000 (22:42 +0000)]
Minor optimization to skip null check in generated code where it isn't
necessary.

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

15 years agoFix for PR5454: make sure to use the right block as the predecessor in the
Eli Friedman [Tue, 10 Nov 2009 22:39:09 +0000 (22:39 +0000)]
Fix for PR5454: make sure to use the right block as the predecessor in the
generated PHI node for the null check of a new operator.

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

15 years agoShuffle order of warning declarations (alphabetize).
Ted Kremenek [Tue, 10 Nov 2009 22:22:50 +0000 (22:22 +0000)]
Shuffle order of warning declarations (alphabetize).

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

15 years agoMake -Wsemicolon-before-method-body opt-in (and part of -Wextra). Addresses <rdar...
Ted Kremenek [Tue, 10 Nov 2009 22:16:29 +0000 (22:16 +0000)]
Make -Wsemicolon-before-method-body opt-in (and part of -Wextra).  Addresses <rdar://problem/7381735>.

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

15 years agoDecouple more of clang-cc by moving ImplicitP[CT]H options into
Daniel Dunbar [Tue, 10 Nov 2009 22:09:38 +0000 (22:09 +0000)]
Decouple more of clang-cc by moving ImplicitP[CT]H options into
PreprocessorOptions.

Global variables used as [in] [out] parameters considered harmful.

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

15 years agoUpdate CMake file.
Ted Kremenek [Tue, 10 Nov 2009 21:38:41 +0000 (21:38 +0000)]
Update CMake file.

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

15 years agoAdd newline at EOF.
Benjamin Kramer [Tue, 10 Nov 2009 21:33:20 +0000 (21:33 +0000)]
Add newline at EOF.

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

15 years agoSilence warning.
Benjamin Kramer [Tue, 10 Nov 2009 21:29:56 +0000 (21:29 +0000)]
Silence warning.

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

15 years agoUse #include <stdio.h> when using fprintf and stderr.
Dan Gohman [Tue, 10 Nov 2009 21:21:27 +0000 (21:21 +0000)]
Use #include <stdio.h> when using fprintf and stderr.

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

15 years agoclang-cc: Start moving "pure" option handling to Options.cpp, to separate it
Daniel Dunbar [Tue, 10 Nov 2009 19:51:53 +0000 (19:51 +0000)]
clang-cc: Start moving "pure" option handling to Options.cpp, to separate it
from the logic part of clang-cc, and to enforce limited scoping.

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

15 years agoclang-cc: Sink more options inside codegenopts namespace.
Daniel Dunbar [Tue, 10 Nov 2009 19:51:46 +0000 (19:51 +0000)]
clang-cc: Sink more options inside codegenopts namespace.

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

15 years agoChange LangOpts initialization to directly test the code generation options,
Daniel Dunbar [Tue, 10 Nov 2009 19:51:33 +0000 (19:51 +0000)]
Change LangOpts initialization to directly test the code generation options,
instead of reproducing their logic.

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

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