Граф коммитов

6794 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner 6896a371e3 Fix #pragma GCC system_header by making it insert a virtual linemarker into
the file at the point of the pragma.  This allows clang to know that all
sourcelocations after the pragma are in a system header.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 05:02:34 +00:00
Chris Lattner d3555ae09f If PCH refers to a file that doesn't exist anymore, emit a nice error
like:
fatal error: could not find file '1.h' referenced by PCH file
instead of aborting with an assertion failure, PR4219



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73371 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:35:16 +00:00
Chris Lattner b1526f311f use the new Path::isAbsolute function, fixing a fixme. Patch by Gregory Curfman!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:25:18 +00:00
Chris Lattner ed2d7c4ffd no really, add the lines :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73367 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:08:28 +00:00
Chris Lattner 3ee211fd15 Fix PR2741 by making our newline tracking be aware of newlines that
can occur in the middle of comment tokens.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 01:25:23 +00:00
Chris Lattner 2a8e4e1d85 "GCC emits an __objc_class_name_{classname} symbol for every class, and a corresponding reference to this symbol for every compilation unit that references the class. This causes linker errors when you try linking a program which references some classes but doesn't define them. The attached patch implements this support in clang, so you can compile a class with clang, reference it in a file compiled with GCC, and have it all work correctly."
Patch by David Chisnall!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 01:09:11 +00:00
Eli Friedman 7df71ac778 PR4391: Tweak -ast-print output to generate valid output for edge cases
like "int x = + +3;".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73356 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 22:39:26 +00:00
Eli Friedman 4c4c527dc1 PR4390: Make sure to handle anonymous unions correctly while building
static intializers for structs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73349 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 21:41:37 +00:00
Douglas Gregor bb2604122f Introduce a SFINAE "trap" that keeps track of the number of errors
that were suppressed due to SFINAE. By checking whether any errors
occur at the end of template argument deduction, we avoid the
possibility of suppressing an error (due to SFINAE) and then
recovering so well that template argument deduction never detects that
there was a problem. Thanks to Eli for the push in this direction.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 08:02:22 +00:00
Douglas Gregor 5e9f35c7cb Update LLVM.
Implement support for C++ Substitution Failure Is Not An Error
(SFINAE), which says that errors that occur during template argument
deduction do *not* produce diagnostics and do not necessarily make a
program ill-formed. Instead, template argument deduction silently
fails. This is currently implemented for template argument deduction
during matching of class template partial specializations, although
the mechanism will also apply to template argument deduction for
function templates. The scheme is simple:

  - If we are in a template argument deduction context, any diagnostic
    that is considered a SFINAE error (or warning) will be
    suppressed. The error will be propagated up the call stack via the
    normal means.
  - By default, all warnings and errors are SFINAE errors. Add the
    NoSFINAE class to a diagnostic in the .td file to make it a hard
    error (e.g., for access-control violations).

Note that, to make this fully work, every place in Sema that emits an
error *and then immediately recovers* will need to check
Sema::isSFINAEContext() to determine whether it must immediately
return an error rather than recovering.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 07:33:30 +00:00
Eli Friedman 5bc8610376 PR4351: Add constant evaluation for constructs like "foo == NULL", where
foo has a constant address.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 02:17:33 +00:00
Chris Lattner 1b63e4f732 Sink the BuiltinInfo object from ASTContext into the
preprocessor and initialize it early in clang-cc.  This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73319 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 01:54:56 +00:00
Chris Lattner 6b15cdc131 move the various builtins stuff from libast to libbasic. This
fixes a layering violation in lib/Basic/Targets.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 01:05:48 +00:00
Chris Lattner f6c2a2a3ff prune #includes, Builtins.h/cpp no longer depends on libast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73317 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 00:52:07 +00:00
Chris Lattner 86df27bbdb move GetBuiltinType from Builtin::Context to ASTContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73316 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 00:45:47 +00:00
Chris Lattner 7b3684afff change ParseStatementOrDeclaration to emit the 'missing ;' with
ExpectAndConsume instead of custom diag logic.  This gets us an
insertion hint and positions the ; at the end of the line 
instead of on the next token.  Before:

t.c:5:1: error: expected ';' after return statement
}
^

after:

t.c:4:11: error: expected ';' after return statement
  return 4
          ^
          ;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73315 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 00:23:56 +00:00
Chris Lattner 6869d8ea1b improve localizability by not passing english phrases into
diagnostics in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73314 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 00:07:48 +00:00
Chris Lattner 783601d8c5 Simplify mangleFunctionDecl by unnesting a crazy condition. This fixes
the check for extern "c" system headers, which should prevent functiondecls
from being mangled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 23:34:16 +00:00
Eli Friedman a1e6de9171 Fix the calling convention for structs/unions containing SSE vectors on
x86-32.  This is slightly messy, but I think it's consistent with gcc.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73306 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 21:37:10 +00:00
Anders Carlsson 6360be748e Have CheckClassTemplatePartialSpecializationArgs take a TemplateArgumentListBuilder. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73297 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 18:20:51 +00:00
Eli Friedman 6b5374f837 Allow initializing a vector with a vector in addition to allowing a list
of the elements.  Issue reported on cfe-dev by Mattias Holm.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73292 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 10:38:46 +00:00
Chris Lattner 148772a841 implement and document a new __has_feature and __has_builtin magic
builtin preprocessor macro.  This appears to work with two caveats:
1) builtins are registered in -E mode, and 2) target-specific builtins
are unconditionally registered even if they aren't supported by the
target (e.g. SSE4 builtin when only SSE1 is enabled).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73289 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 07:13:28 +00:00
Eli Friedman 923f7534c5 Fix for PR4382: allow instantiating dependent nested name specifiers.
I'm not completely sure this is the right way to fix this issue, but it seems 
reasonable, and it's consistent with the non-template code for this 
construct.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73285 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 04:51:30 +00:00
Anders Carlsson 31a08752ed If a CXXRecordDecl is a class template, the 'this' type should be the injected class name type. Fixes pr4383.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73284 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 02:59:33 +00:00
Anders Carlsson 0ceffb51b2 More work on type parameter packs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73281 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 02:08:00 +00:00
Zhongxing Xu f0ec39a99b Stop tracking non-compound value for struct. It may be caused by imprecise cast
logic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73279 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 01:31:11 +00:00
Douglas Gregor c9e5d25ea3 Remove a bunch of unnecessary template argument deduction code that was
obviously written by someone who didn't read C++ [temp.class.spec].


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73276 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 00:59:32 +00:00
Anders Carlsson 436b156dc8 Move template type argument checking out into a separate function. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 00:33:33 +00:00
Douglas Gregor 031a5880e1 When some template parameters of a class template partial
specialization cannot be deduced, produce a warning noting that the
affected class template partial specialization will never be used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73274 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 00:26:55 +00:00
Chris Lattner 5db7ae59bb Fix PR4372, another case where non-prototyped functions can prevent
always_inline from working.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 00:26:38 +00:00
Anders Carlsson 67e332009c Improvements to TemplateArgumentListBuilder to make it work better with parameter packs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 00:08:58 +00:00
Anders Carlsson 49d2557add A parameter pack must always come last in a class template.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73269 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 23:20:15 +00:00
Anders Carlsson 94c1cdcb0a No need to mark the parameter as invalid, just ignore the default argument.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 23:13:22 +00:00
Anders Carlsson ce5635a100 Address more comments from Doug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73267 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 23:09:56 +00:00
Chris Lattner 989135901c add the location of the ')' in a do/while statement to DoStmt.
This fixes a source range problem reported by Olaf Krzikalla.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73266 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 23:04:47 +00:00
Anders Carlsson 9a917e4fac Address comments from Doug - Add a Sema::SemaRef.BuildBlockPointerType and use it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 22:56:54 +00:00
Douglas Gregor c1efb3faef It looks like we've finished off matching of class template partial specializations; add comments and update the C++ status page
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73263 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 22:31:52 +00:00
Anders Carlsson 9c4c5c8e17 Parameter packs can't have default arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73262 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 22:30:13 +00:00
Anders Carlsson 6d845ae1ba Keep track of whether a type parameter is actually a type parameter pack.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73261 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 22:23:22 +00:00
Douglas Gregor 16df850bb7 Finish implementing checking of class template partial specializations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73260 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 22:21:45 +00:00
Douglas Gregor 6aa75cfbdd Diagnose C++ [temp.class.spec]p9b3, where a class template partial
specialization's arguments are identical to the implicit template
arguments of the primary template. Typically, this is meant to be a
declaration/definition of the primary template, so we give that
advice.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 22:08:06 +00:00
Douglas Gregor e94866ffc1 Diagnose the incorrect use of non-type template arguments for class
template partial specializations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 21:21:02 +00:00
Anders Carlsson 941df7dac2 Parse support for C++0x type parameter packs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 19:58:00 +00:00
Douglas Gregor ba1ecb564c Verify that the template parameters of a class template partial
specialization do not have default arguments 
(C++ [temp.class.spec]p10). 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73245 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 19:43:02 +00:00
Anders Carlsson 1d79faf915 Fix PR4365.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73240 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 18:53:02 +00:00
Douglas Gregor f67875d5ad Improve template argument deduction to keep track of why template
argument deduction failed. For example, given

  template<typename T> struct is_same<T, T> { ... };

template argument deduction will fail for is_same<int, float>, and now
reports enough information

Right now, we don't do anything with this extra information, but it
can be used for informative diagnostics that say, e.g., "template
argument deduction failed because T was deduced to 'int' in one
context and 'float' in another".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73237 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 18:26:56 +00:00
Anders Carlsson 5e300d1a8e It's an error to use a function declared in a class definition as a default argument before the function has been declared.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73234 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 16:51:40 +00:00
Anders Carlsson 859ba504e7 Deducation and instantiation of block types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 16:23:10 +00:00
Zhongxing Xu 53454dc2c9 use getAsPointerType() method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73218 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 03:59:12 +00:00
Anders Carlsson 36674d2978 Don't assert when generating code with static_asserts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-11 21:22:55 +00:00