]> granicus.if.org Git - clang/log
clang
14 years agoNote to self: don't leave debugging statements in the code for four hours.
John McCall [Thu, 12 Nov 2009 02:10:34 +0000 (02:10 +0000)]
Note to self:  don't leave debugging statements in the code for four hours.

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

14 years agoclang-cc: Move non-Consumer action handling to common location, to expose the massive...
Daniel Dunbar [Thu, 12 Nov 2009 01:36:27 +0000 (01:36 +0000)]
clang-cc: Move non-Consumer action handling to common location, to expose the massive amount of redundancy we have introduced through blind copy-and-paste.

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

14 years agoFix PCH/preprocess test to be more useful, and unbreak -E mode with implicit
Daniel Dunbar [Thu, 12 Nov 2009 01:36:20 +0000 (01:36 +0000)]
Fix PCH/preprocess test to be more useful, and unbreak -E mode with implicit
PCH, which I broke.

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

14 years agoDo not use StringRef while using DebugInfo interface.
Devang Patel [Thu, 12 Nov 2009 00:51:46 +0000 (00:51 +0000)]
Do not use StringRef while using DebugInfo interface.

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

14 years agoImprove recovery in a wonky case where one tries to specialize a
Douglas Gregor [Thu, 12 Nov 2009 00:46:20 +0000 (00:46 +0000)]
Improve recovery in a wonky case where one tries to specialize a
template template parameter.

When building a template-id type, check whether the template-name
itself is dependent (even if the template arguments are not!) and
handle it as a template-id type.

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

14 years agoFix Makefile dependency bug with out-of-dir builds.
Daniel Dunbar [Thu, 12 Nov 2009 00:41:49 +0000 (00:41 +0000)]
Fix Makefile dependency bug with out-of-dir builds.

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

14 years agoFix test portability.
Daniel Dunbar [Thu, 12 Nov 2009 00:41:41 +0000 (00:41 +0000)]
Fix test portability.

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

14 years agoTweak AnalyzerOptions for consistency, and make sure default constructed object
Daniel Dunbar [Thu, 12 Nov 2009 00:24:35 +0000 (00:24 +0000)]
Tweak AnalyzerOptions for consistency, and make sure default constructed object
is sane.

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

14 years agoTweak formatting.
Daniel Dunbar [Thu, 12 Nov 2009 00:24:28 +0000 (00:24 +0000)]
Tweak formatting.

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

14 years agoMove AnalyzerOptions into CompilerInvocation.
Daniel Dunbar [Thu, 12 Nov 2009 00:24:10 +0000 (00:24 +0000)]
Move AnalyzerOptions into CompilerInvocation.

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

14 years agoAdd <foo> = [<bar> nextObject] to the -Widiomatic-parentheses category,
John McCall [Thu, 12 Nov 2009 00:06:05 +0000 (00:06 +0000)]
Add <foo> = [<bar> nextObject] to the -Widiomatic-parentheses category,
and give that category an explicit test.  Generalize the internal diagnostic
name.

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

14 years agoRemove an overly-eager assertion when replacing tokens with an
Douglas Gregor [Thu, 12 Nov 2009 00:03:40 +0000 (00:03 +0000)]
Remove an overly-eager assertion when replacing tokens with an
annotation token, because some of the tokens we're annotating might
not be in the set of cached tokens (we could have consumed them
unconditionally).

Also, move the tentative parsing from ParseTemplateTemplateArgument
into the one caller that needs it, improving recovery.

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

14 years agoTweak PCH -include handling to make sure it matches the name as would be present
Daniel Dunbar [Wed, 11 Nov 2009 23:58:53 +0000 (23:58 +0000)]
Tweak PCH -include handling to make sure it matches the name as would be present
in the predefines buffer.

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

14 years agoFix clang executable path for Windows
John Thompson [Wed, 11 Nov 2009 23:11:14 +0000 (23:11 +0000)]
Fix clang executable path for Windows

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

14 years agoTemplate argument deduction for template template parameters. This
Douglas Gregor [Wed, 11 Nov 2009 23:06:43 +0000 (23:06 +0000)]
Template argument deduction for template template parameters. This
permits, among other things, ripping apart and reconstructing
templates via partial specialization:

  template<typename T>
  struct DeepRemoveConst { typedef T type; };

  template<typename T>
  struct DeepRemoveConst<const T> {
    typedef typename DeepRemoveConst<T>::type type;
  };

  template<template<typename> class TT, typename T>
  struct DeepRemoveConst<TT<T> > {
    typedef TT<typename DeepRemoveConst<T>::type> type;
  };

Also, fix a longstanding thinko in the code handling partial ordering
of class template partial specializations. We were performing the
second deduction without clearing out the results of the first
deduction. It's amazing we got through so much code with such a
horrendous error :(

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

14 years agoFix PR 5422: handle lvalue results when evaluating 'based' ptrtoints as part of
John McCall [Wed, 11 Nov 2009 22:52:37 +0000 (22:52 +0000)]
Fix PR 5422:  handle lvalue results when evaluating 'based' ptrtoints as part of
the -Wconversion check.

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

14 years agoMake test more platform independent.
Fariborz Jahanian [Wed, 11 Nov 2009 22:49:09 +0000 (22:49 +0000)]
Make test more platform independent.

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

14 years agoMake test more platform independent (per Sebastian's comment).
Fariborz Jahanian [Wed, 11 Nov 2009 22:45:41 +0000 (22:45 +0000)]
Make test more platform independent (per Sebastian's comment).

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

14 years agowritable atomic property's setter/getter must be in 'lock' step of
Fariborz Jahanian [Wed, 11 Nov 2009 22:40:11 +0000 (22:40 +0000)]
writable atomic property's setter/getter must be in 'lock' step of
either both synthesized or bith user defined.
Implements radar 6557233.

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

14 years agoImprove diagnostics when a default template argument does not match
Douglas Gregor [Wed, 11 Nov 2009 21:54:23 +0000 (21:54 +0000)]
Improve diagnostics when a default template argument does not match
with its corresponding template parameter. This can happen when we
performed some substitution into the default template argument and
what we had doesn't match any more, e.g.,

  template<int> struct A;
  template<typename T, template<T> class X = A> class B;

  B<long> b;

Previously, we'd emit a pretty but disembodied diagnostic showing how
the default argument didn't match the template parameter. The
diagnostic was good, but nothing tied it to the *use* of the default
argument in "B<long>". This commit fixes that.

Also, tweak the counting of active template instantiations to avoid
counting non-instantiation records, such as those we create for
(surprise!) checking default arguments, instantiating default
arguments, and performing substitutions as part of template argument
deduction.

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

14 years agoAlways initialize the header search object as part of InitializePreprocessor;
Daniel Dunbar [Wed, 11 Nov 2009 21:44:42 +0000 (21:44 +0000)]
Always initialize the header search object as part of InitializePreprocessor;
not doing this has little to no utility.

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

14 years agoAllow Preprocessor to take ownership of the HeaderSearch object. I think it should...
Daniel Dunbar [Wed, 11 Nov 2009 21:44:21 +0000 (21:44 +0000)]
Allow Preprocessor to take ownership of the HeaderSearch object. I think it should probably always own the header search object, but I'm not sure...

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

14 years agoSink AttachDependencyFileGen into CreatePreprocessor.
Daniel Dunbar [Wed, 11 Nov 2009 21:44:00 +0000 (21:44 +0000)]
Sink AttachDependencyFileGen into CreatePreprocessor.

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

14 years agoAdd DependencyOutputOptions to wrap -M... options, and propogate to
Daniel Dunbar [Wed, 11 Nov 2009 21:43:12 +0000 (21:43 +0000)]
Add DependencyOutputOptions to wrap -M... options, and propogate to
CompilerInvocation and clang-cc.

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

14 years agoFix ctor vtable name. WIP.
Mike Stump [Wed, 11 Nov 2009 20:32:03 +0000 (20:32 +0000)]
Fix ctor vtable name.  WIP.

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

14 years agoPush ctor vtable construction down further. WIP.
Mike Stump [Wed, 11 Nov 2009 20:26:26 +0000 (20:26 +0000)]
Push ctor vtable construction down further.  WIP.

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

14 years agoRemove some stale ErrorNodes variables in GRExprEngine and the old buffer overflow...
Ted Kremenek [Wed, 11 Nov 2009 20:16:36 +0000 (20:16 +0000)]
Remove some stale ErrorNodes variables in GRExprEngine and the old buffer overflow logic in GRExprEngineInternalChecks.cpp.

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

14 years agoAfter drinking caffeine, add the two files missing from the previous submit.
Chandler Carruth [Wed, 11 Nov 2009 19:43:37 +0000 (19:43 +0000)]
After drinking caffeine, add the two files missing from the previous submit.
Sorry about that.

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

14 years agoMove handling of template parameter packs out of the
Douglas Gregor [Wed, 11 Nov 2009 19:41:09 +0000 (19:41 +0000)]
Move handling of template parameter packs out of the
template-type-parameter specific template argument checking code and
up to the template argument checking loop. In theory, this should make
variadic templates work better; in practice, they don't well enough
for us to care anyway (YET!), so this is mostly a re-organization to
simplify CheckTemplateArgument.

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

14 years agoRefactoring of template-argument checking code to reduce nesting,
Douglas Gregor [Wed, 11 Nov 2009 19:31:23 +0000 (19:31 +0000)]
Refactoring of template-argument checking code to reduce nesting,
increase sanity. No intended functionality change.

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

14 years agoBefore checking a template template argument against its corresponding
Douglas Gregor [Wed, 11 Nov 2009 19:13:48 +0000 (19:13 +0000)]
Before checking a template template argument against its corresponding
template template parameter, substitute any prior template arguments
into the template template parameter. This, for example, allows us to
properly check the template template argument for a class such as:

  template<typename T, template<T Value> class X> struct Foo;

The actual implementation of this feature was trivial; most of the
change is dedicated to giving decent diagnostics when this
substitution goes horribly wrong. We now get a note like:

  note: while substituting prior template arguments into template
      template parameter 'X' [with T = float]

As part of this change, enabled some very pedantic checking when
comparing template template parameter lists, which shook out a bug in
our overly-eager checking of default arguments of template template
parameters. We now perform only minimal checking of such default
arguments when they are initially parsed.

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

14 years agoMove the ManagerRegistry to the Analysis library to resolve the layering violation.
Chandler Carruth [Wed, 11 Nov 2009 19:10:59 +0000 (19:10 +0000)]
Move the ManagerRegistry to the Analysis library to resolve the layering violation.

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

14 years agoDo not eagerly set stop point for arguments. This misleads the debugger in identifyin...
Devang Patel [Wed, 11 Nov 2009 19:10:19 +0000 (19:10 +0000)]
Do not eagerly set stop point for arguments. This misleads the debugger in identifying beginning of function body. Instead, create new location to attach with llvm.dbg.declare. This location is only used to find the context of the variable by the code generator, and it is not used to emit line number info.

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

14 years agoValue initialize non-class array members in ctor's
Fariborz Jahanian [Wed, 11 Nov 2009 17:55:25 +0000 (17:55 +0000)]
Value initialize non-class array members in ctor's
initializer list. Fixes PR5463.

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

14 years agoSplit buffer overflow test case into two test cases, removing out logic that was...
Ted Kremenek [Wed, 11 Nov 2009 17:17:06 +0000 (17:17 +0000)]
Split buffer overflow test case into two test cases, removing out logic that was commented out.

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

14 years agoInstantiation of template template parameters for nested templates, e.g.,
Douglas Gregor [Wed, 11 Nov 2009 16:58:32 +0000 (16:58 +0000)]
Instantiation of template template parameters for nested templates, e.g.,

  template<typename T>
  struct X {
    template<template<T Value> class Y> struct Inner;
  };

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

14 years agoFix speculative parsing of dependent template names in
Douglas Gregor [Wed, 11 Nov 2009 16:39:34 +0000 (16:39 +0000)]
Fix speculative parsing of dependent template names in
nested-name-specifiers so that they don't gobble the template name (or
operator-function-id) unless there is also a
template-argument-list. For example, given

  T::template apply

we would previously consume both "template" and "apply" as part of
parsing the nested-name-specifier, then error when we see that there
is no "<" starting a template argument list. Now, we parse such
constructs tentatively, and back off if the "<" is not present. This
allows us to parse dependent template names as one would use them for,
e.g., template template parameters:

  template<typename T, template<class> class X = T::template apply>
    struct MetaSomething;

Also, test default arguments for template template parameters.

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

14 years agoAdd undefined array subscript checker.
Zhongxing Xu [Wed, 11 Nov 2009 13:42:54 +0000 (13:42 +0000)]
Add undefined array subscript checker.

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

14 years agoRemove the old out-of-bound checking code.
Zhongxing Xu [Wed, 11 Nov 2009 12:52:39 +0000 (12:52 +0000)]
Remove the old out-of-bound checking code.

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

14 years agoReimplement out-of-bound array access checker with the new checker interface.
Zhongxing Xu [Wed, 11 Nov 2009 12:33:27 +0000 (12:33 +0000)]
Reimplement out-of-bound array access checker with the new checker interface.
Now only one test case is XFAIL'ed.

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

14 years agoReturnPointerRangeChecker: use StripCasts() instead of checking for zero index
Zhongxing Xu [Wed, 11 Nov 2009 11:55:54 +0000 (11:55 +0000)]
ReturnPointerRangeChecker: use StripCasts() instead of checking for zero index
explicitly.

Fix 80-col violations.

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

14 years agoSimplify.
Daniel Dunbar [Wed, 11 Nov 2009 10:22:48 +0000 (10:22 +0000)]
Simplify.

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

14 years agoFix unsafe use of StringRef I introduced.
Daniel Dunbar [Wed, 11 Nov 2009 10:10:25 +0000 (10:10 +0000)]
Fix unsafe use of StringRef I introduced.

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

14 years agoAdd PreprocessorOutputOptions to CompilerInvocation, and move initialization to
Daniel Dunbar [Wed, 11 Nov 2009 10:07:44 +0000 (10:07 +0000)]
Add PreprocessorOutputOptions to CompilerInvocation, and move initialization to
clang-cc/Options.cpp

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

14 years agoAdd PreprocessorOutputOptions, for things like -dM, -C, -CC which control -E
Daniel Dunbar [Wed, 11 Nov 2009 10:07:22 +0000 (10:07 +0000)]
Add PreprocessorOutputOptions, for things like -dM, -C, -CC which control -E
mode.

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

14 years agoSimplifiy target feature handling by coalescing all the logic into
Daniel Dunbar [Wed, 11 Nov 2009 09:38:56 +0000 (09:38 +0000)]
Simplifiy target feature handling by coalescing all the logic into
InitializeCompileOptions.

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

14 years agoMinor formatting tweaks.
Daniel Dunbar [Wed, 11 Nov 2009 09:38:42 +0000 (09:38 +0000)]
Minor formatting tweaks.

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

14 years agoclang-cc: Refactor some -fixit-at handling.
Daniel Dunbar [Wed, 11 Nov 2009 09:38:35 +0000 (09:38 +0000)]
clang-cc: Refactor some -fixit-at handling.

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

14 years agoAllow TextDiagnosticPrinter to have optional ownership of its output stream.
Daniel Dunbar [Wed, 11 Nov 2009 09:38:24 +0000 (09:38 +0000)]
Allow TextDiagnosticPrinter to have optional ownership of its output stream.

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

14 years agoUpdate CMake.
Daniel Dunbar [Wed, 11 Nov 2009 08:14:02 +0000 (08:14 +0000)]
Update CMake.

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

14 years agoclang-cc: Move InitializeAnalyzerOptions into Options.cpp
Daniel Dunbar [Wed, 11 Nov 2009 08:13:55 +0000 (08:13 +0000)]
clang-cc: Move InitializeAnalyzerOptions into Options.cpp

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

14 years agoclang-cc: Start coalescing "frontend" options.
Daniel Dunbar [Wed, 11 Nov 2009 08:13:47 +0000 (08:13 +0000)]
clang-cc: Start coalescing "frontend" options.

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

14 years agoclang-cc: Move InitializeDiagnosticOptions to Options.cpp
Daniel Dunbar [Wed, 11 Nov 2009 08:13:40 +0000 (08:13 +0000)]
clang-cc: Move InitializeDiagnosticOptions to Options.cpp

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

14 years agoclang-cc: Move HeaderSearchOptions to Options.cpp
Daniel Dunbar [Wed, 11 Nov 2009 08:13:32 +0000 (08:13 +0000)]
clang-cc: Move HeaderSearchOptions to Options.cpp

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

14 years agoTurn LoggingDiagnosticClient into a more general ChainedDiagnosticClient and
Daniel Dunbar [Wed, 11 Nov 2009 08:13:24 +0000 (08:13 +0000)]
Turn LoggingDiagnosticClient into a more general ChainedDiagnosticClient and
move to libFrontend.

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

14 years agoclang-cc: Move InitializeLangOptions to Options.cpp.
Daniel Dunbar [Wed, 11 Nov 2009 07:26:12 +0000 (07:26 +0000)]
clang-cc: Move InitializeLangOptions to Options.cpp.

Also, inline InitializeLanguageStandard into InitializeLangOptions; this code
needs to be refactored but the current division doesn't make any sense.

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

14 years agoInline some trivial functions.
Daniel Dunbar [Wed, 11 Nov 2009 07:26:02 +0000 (07:26 +0000)]
Inline some trivial functions.

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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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