]> granicus.if.org Git - clang/log
clang
13 years agoTeach ASTUnit to save the specified target features, since
Douglas Gregor [Thu, 27 Jan 2011 18:02:58 +0000 (18:02 +0000)]
Teach ASTUnit to save the specified target features, since
TargetInfo::CreateTargetInfo() mangles the target options in a way
that is not idempotent. Fixes <rdar://problem/8807535>.

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

13 years agoAdd libclang functions to determine the const/volatile/restrict
Douglas Gregor [Thu, 27 Jan 2011 16:27:11 +0000 (16:27 +0000)]
Add libclang functions to determine the const/volatile/restrict
qualifiers on a CXType. Patch from Stefan Seefeld, test by me.

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

13 years ago[analyzer] Fix crash when handling dot syntax on 'super'.
Argyrios Kyrtzidis [Thu, 27 Jan 2011 16:17:11 +0000 (16:17 +0000)]
[analyzer] Fix crash when handling dot syntax on 'super'.

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

13 years agoTextDiagnosticPrinter.cpp: Show diagnostics as far as possible even with invalid...
Axel Naumann [Thu, 27 Jan 2011 10:55:51 +0000 (10:55 +0000)]
TextDiagnosticPrinter.cpp: Show diagnostics as far as possible even with invalid PresomedLoc, instead of just silencing it.

FileManager.cpp: Allow virtual files in nonexistent directories.
FileManager.cpp: Close FileDescriptor for virtual files that correspond to actual files.
FileManager.cpp: Enable virtual files to be created even for files that were flagged as NON_EXISTENT_FILE, e.g. by a prior (unsuccessful) addFile().

ASTReader.cpp: Read a PCH even if the original source files cannot be found.

Add a test for reading a PCH of a file that has been removed and diagnostics referencing that file.

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

13 years agoDo a proper recursive lookup when deciding whether a class's usual
John McCall [Thu, 27 Jan 2011 09:37:56 +0000 (09:37 +0000)]
Do a proper recursive lookup when deciding whether a class's usual
deallocation function has a two-argument form.  Store the result of this
check in new[] and delete[] nodes.

Fixes rdar://problem/8913519

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

13 years agoProvide Type::castAs<>, which is to getAs<> what cast<> is to dyn_cast<>.
John McCall [Thu, 27 Jan 2011 08:17:49 +0000 (08:17 +0000)]
Provide Type::castAs<>, which is to getAs<> what cast<> is to dyn_cast<>.
Also provide a method to grab the base element type of a type without
stressing out over qualifiers (but give it a nice scary name).

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

13 years agoFix whitespace.
NAKAMURA Takumi [Thu, 27 Jan 2011 07:10:08 +0000 (07:10 +0000)]
Fix whitespace.

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

13 years ago7bit-ize.
NAKAMURA Takumi [Thu, 27 Jan 2011 07:09:49 +0000 (07:09 +0000)]
7bit-ize.

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

13 years agoFix HTML highlighting and add missing line.
Ted Kremenek [Thu, 27 Jan 2011 07:02:03 +0000 (07:02 +0000)]
Fix HTML highlighting and add missing line.

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

13 years agoFix a few typos in HTML documentation.
Ted Kremenek [Thu, 27 Jan 2011 06:59:29 +0000 (06:59 +0000)]
Fix a few typos in HTML documentation.

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

13 years agoHook up attribute ns_consumes_self in the ObjC retain/release checker in the static...
Ted Kremenek [Thu, 27 Jan 2011 06:54:14 +0000 (06:54 +0000)]
Hook up attribute ns_consumes_self in the ObjC retain/release checker in the static analyzer.

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

13 years agoTweak -Wuninitialized fixit for '_Bool' types to be initialized to 0, and C++ 'bool...
Ted Kremenek [Thu, 27 Jan 2011 05:18:52 +0000 (05:18 +0000)]
Tweak -Wuninitialized fixit for '_Bool' types to be initialized to 0, and C++ 'bool' types to false.

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

13 years agoTeach -Wuninitialized to suggest "= false" for initializing bool variables.
Ted Kremenek [Thu, 27 Jan 2011 02:57:57 +0000 (02:57 +0000)]
Teach -Wuninitialized to suggest "= false" for initializing bool variables.

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

13 years agoNotes on dynamic array cookies in MSVC.
John McCall [Thu, 27 Jan 2011 02:46:02 +0000 (02:46 +0000)]
Notes on dynamic array cookies in MSVC.
My thanks to chapuni for his help in investigating this.

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

13 years agoImport three interesting bits that apply only to C++ methods.
John McCall [Thu, 27 Jan 2011 02:37:01 +0000 (02:37 +0000)]
Import three interesting bits that apply only to C++ methods.

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

13 years agoTeach -Wuninitialized not to assert when analyzing
Ted Kremenek [Thu, 27 Jan 2011 02:29:34 +0000 (02:29 +0000)]
Teach -Wuninitialized not to assert when analyzing
blocks that reference captured variables.

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

13 years agoTeach -Wuninitialized about ObjC fast enumeration loops.
Ted Kremenek [Thu, 27 Jan 2011 02:01:31 +0000 (02:01 +0000)]
Teach -Wuninitialized about ObjC fast enumeration loops.

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

13 years agoWhen we run into a template parameter that should have a default
Douglas Gregor [Thu, 27 Jan 2011 01:40:17 +0000 (01:40 +0000)]
When we run into a template parameter that should have a default
argument but doesn't (because previous template parameters had default
arguments), clear out all of the default arguments so that we maintain
the invariant that a template parameter has a default argument only if
subsequence template parameters also have default arguments.
Fixes a crash-on-invalid <rdar://problem/8913649>.

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

13 years agoCope with parenthesized function declarators when emitting a
Douglas Gregor [Thu, 27 Jan 2011 01:30:16 +0000 (01:30 +0000)]
Cope with parenthesized function declarators when emitting a
diagnostic about ref-qualifiers where they do not belong.

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

13 years agoFix a horrible bug in our handling of C-style casting, where a C-style
Douglas Gregor [Thu, 27 Jan 2011 00:58:17 +0000 (00:58 +0000)]
Fix a horrible bug in our handling of C-style casting, where a C-style
derived-to-base cast that also casts away constness (one of the cases
for static_cast followed by const_cast) would be treated as a bit-cast
rather than a derived-to-base class, causing miscompiles and
heartburn.

Fixes <rdar://problem/8913298>.

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

13 years agoFixes an IRgen bug where __block variable is
Fariborz Jahanian [Wed, 26 Jan 2011 23:08:27 +0000 (23:08 +0000)]
Fixes an IRgen bug where __block variable is
referenced in the block-literal initializer
of that variable. // rdar://8893785

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

13 years agoUpdate C++0x status web page
Douglas Gregor [Wed, 26 Jan 2011 21:35:14 +0000 (21:35 +0000)]
Update C++0x status web page

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

13 years agomake `make` work in examples/PrintFucntionNames on Mac. I checked that it still works...
Nico Weber [Wed, 26 Jan 2011 21:28:52 +0000 (21:28 +0000)]
make `make` work in examples/PrintFucntionNames on Mac. I checked that it still works on Linux.

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

13 years agoAdd __has_feature(cxx_reference_qualified_functions); update tests and
Douglas Gregor [Wed, 26 Jan 2011 21:25:54 +0000 (21:25 +0000)]
Add __has_feature(cxx_reference_qualified_functions); update tests and
documentation.

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

13 years agoImplement the restriction that a function with a ref-qualifier cannot
Douglas Gregor [Wed, 26 Jan 2011 21:20:37 +0000 (21:20 +0000)]
Implement the restriction that a function with a ref-qualifier cannot
overload a function without a ref-qualifier (C++0x
[over.load]p2). This, apparently, completes the implementation of
rvalue references for *this.

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

13 years agoHandle C-style casts to rvalue reference types that cast away constness.
Douglas Gregor [Wed, 26 Jan 2011 21:04:06 +0000 (21:04 +0000)]
Handle C-style casts to rvalue reference types that cast away constness.

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

13 years agoImprove the extension warning for the use of ref-qualifiers, to
Douglas Gregor [Wed, 26 Jan 2011 20:35:32 +0000 (20:35 +0000)]
Improve the extension warning for the use of ref-qualifiers, to
distinguish them from rvalue references. Using the rvalue-references
warning was weird when the ref-qualifier was '&'.

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

13 years agoWhen mangling a qualified array type, push the qualifiers down to the
John McCall [Wed, 26 Jan 2011 20:05:40 +0000 (20:05 +0000)]
When mangling a qualified array type, push the qualifiers down to the
element type.  Fixes rdar://problem/8913416.

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

13 years agoRvalue references for *this: explicitly keep track of whether a
Douglas Gregor [Wed, 26 Jan 2011 19:41:18 +0000 (19:41 +0000)]
Rvalue references for *this: explicitly keep track of whether a
reference binding is for the implicit object parameter of a member
function with a ref-qualifier. My previous comment, that we didn't
need to track this explicitly, was wrong: we do in fact get
rvalue-references-prefer-rvalues overloading with ref-qualifiers.

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

13 years agoRvalue references for *this: implement the implicit conversion rules
Douglas Gregor [Wed, 26 Jan 2011 19:30:28 +0000 (19:30 +0000)]
Rvalue references for *this: implement the implicit conversion rules
for the implicit object argument to a non-static member function with
a ref-qualifier (C++0x [over.match.funcs]p4).

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

13 years agoUn-nest the meat of this function.
John McCall [Wed, 26 Jan 2011 19:21:13 +0000 (19:21 +0000)]
Un-nest the meat of this function.

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

13 years agoFix some obvious bugs in the conditional-cleanup code and then make the
John McCall [Wed, 26 Jan 2011 19:15:39 +0000 (19:15 +0000)]
Fix some obvious bugs in the conditional-cleanup code and then make the
dtor cleanup use it.

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

13 years agoMove InheritableAttr::isInherited to Attr
Peter Collingbourne [Wed, 26 Jan 2011 18:07:13 +0000 (18:07 +0000)]
Move InheritableAttr::isInherited to Attr

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

13 years agoRemove Attr::isMerged; it is not used any more and redundant with
Peter Collingbourne [Wed, 26 Jan 2011 18:07:07 +0000 (18:07 +0000)]
Remove Attr::isMerged; it is not used any more and redundant with
InheritableAttr

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

13 years agoRvalue references for *this: allow functions to be overloaded based on
Douglas Gregor [Wed, 26 Jan 2011 17:47:49 +0000 (17:47 +0000)]
Rvalue references for *this: allow functions to be overloaded based on
the presence and form of a ref-qualifier. Note that we do *not* yet
implement the restriction in C++0x [over.load]p2 that requires either
all non-static functions with a given parameter-type-list to have a
ref-qualifier or none of them to have a ref-qualifier.

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

13 years agoRvalue references for *this: add name mangling for ref-qualifiers,
Douglas Gregor [Wed, 26 Jan 2011 17:36:28 +0000 (17:36 +0000)]
Rvalue references for *this: add name mangling for ref-qualifiers,
using rules that I just made up this morning. This encoding has now
been proposed to the Itanium C++ ABI group for inclusion, but of
course it's still possible that the mangling will change.

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

13 years agoRvalue references for *this: tentative parsing and template argument deduction.
Douglas Gregor [Wed, 26 Jan 2011 16:50:54 +0000 (16:50 +0000)]
Rvalue references for *this: tentative parsing and template argument deduction.

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

13 years agoReference qualifiers for *this: implement C++0x [expr.mptr.oper]p6,
Douglas Gregor [Wed, 26 Jan 2011 16:40:18 +0000 (16:40 +0000)]
Reference qualifiers for *this: implement C++0x [expr.mptr.oper]p6,
the restrictions on .* and ->* for ref-qualified pointer-to-member
functions.

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

13 years agoClean up the C++0x __has_feature tests. Specifically:
Douglas Gregor [Wed, 26 Jan 2011 15:36:03 +0000 (15:36 +0000)]
Clean up the C++0x __has_feature tests. Specifically:
  - Don't publicize a C++0x feature through __has_feature if we aren't
    in C++0x mode (even if the feature is available only with a
    warning).
  - "auto" is not implemented well enough for its __has_feature to be
    turned on.
  - Fix the test of C++0x __has_feature to actually test what we're
  trying to test. Searching for the substring "foo" when our options
  are "foo" and "no_foo" doesn't work :)

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

13 years agoReinstate r124236 (tweaking the rvalue-reference overload resolution
Douglas Gregor [Wed, 26 Jan 2011 14:52:12 +0000 (14:52 +0000)]
Reinstate r124236 (tweaking the rvalue-reference overload resolution
rules), now that we've actually have a clean build for me to sully.

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

13 years agoRvalue references for *this:
Douglas Gregor [Wed, 26 Jan 2011 05:01:58 +0000 (05:01 +0000)]
Rvalue references for *this:

  - Add ref-qualifiers to the type system; they are part of the
  canonical type. Print & profile ref-qualifiers
  - Translate the ref-qualifier from the Declarator chunk for
    functions to the function type.
  - Diagnose mis-uses of ref-qualifiers w.r.t. static member
  functions, free functions, constructors, destructors, etc.
  - Add serialization and deserialization of ref-qualifiers.

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

13 years agoTeach -Wreturn-type that destructors can appear
Ted Kremenek [Wed, 26 Jan 2011 04:49:52 +0000 (04:49 +0000)]
Teach -Wreturn-type that destructors can appear
after a 'return' in a CFGBlock.  This accidentally
was working before, but the false assumption that
'return' always appeared at the end of the block
was uncovered by a recent change.

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

13 years agoMerge -Wuninitialized-experimental into -Wuninitialized.
Ted Kremenek [Wed, 26 Jan 2011 04:49:48 +0000 (04:49 +0000)]
Merge -Wuninitialized-experimental into -Wuninitialized.

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

13 years agoTweak -Wuninitialized-experimental to not emit
Ted Kremenek [Wed, 26 Jan 2011 04:49:43 +0000 (04:49 +0000)]
Tweak -Wuninitialized-experimental to not emit
a warning for uses of an uninitialized variable
when the use is a void cast, e.g. (void) x.

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

13 years agoBetter framework for conditional cleanups; untested as yet.
John McCall [Wed, 26 Jan 2011 04:00:11 +0000 (04:00 +0000)]
Better framework for conditional cleanups;  untested as yet.
I'm separately committing this because it incidentally changes some
block orderings and minor IR issues, like using a phi instead of
an unnecessary alloca.

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

13 years agoRvalue references for *this: parse ref-qualifiers.
Douglas Gregor [Wed, 26 Jan 2011 03:43:54 +0000 (03:43 +0000)]
Rvalue references for *this: parse ref-qualifiers.

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

13 years agoUse RecordLayout::getBaseClassOffset() where CharUnits are needed instead of
Ken Dyck [Wed, 26 Jan 2011 02:17:08 +0000 (02:17 +0000)]
Use RecordLayout::getBaseClassOffset() where CharUnits are needed instead of
converting getBaseClassOffsetInBits() to CharUnits.

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

13 years ago[analyzer] Enable the self-init checker under command-line option '-analyzer-check...
Argyrios Kyrtzidis [Wed, 26 Jan 2011 01:26:50 +0000 (01:26 +0000)]
[analyzer] Enable the self-init checker under command-line option '-analyzer-check-objc-self-init' which by default
is enabled by the driver for '--analyze'.

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

13 years agoCorrect r124242 making sure function chunk that gets diagnosed is really about the...
Argyrios Kyrtzidis [Wed, 26 Jan 2011 01:26:44 +0000 (01:26 +0000)]
Correct r124242 making sure function chunk that gets diagnosed is really about the block.
Clairvoyance by John!

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

13 years ago[analyzer] Improve the diagnostic for the self-init checker. Suggestion by Ted!
Argyrios Kyrtzidis [Wed, 26 Jan 2011 01:26:41 +0000 (01:26 +0000)]
[analyzer] Improve the diagnostic for the self-init checker. Suggestion by Ted!

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

13 years agoTweak the rule for deciding if a provisional ivar is needed
Fariborz Jahanian [Wed, 26 Jan 2011 00:57:01 +0000 (00:57 +0000)]
Tweak the rule for deciding if a provisional ivar is needed
in default ivar synthesis.  Fixes // rdar://8913053.

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

13 years agoRemove CompilerInstance::getOutputFileList because it is unimplemented and unused.
Jeffrey Yasskin [Wed, 26 Jan 2011 00:18:08 +0000 (00:18 +0000)]
Remove CompilerInstance::getOutputFileList because it is unimplemented and unused.

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

13 years ago[analyzer] Do the self-init check only on NSObject subclasses. Patch by Jean-Daniel...
Argyrios Kyrtzidis [Tue, 25 Jan 2011 23:54:44 +0000 (23:54 +0000)]
[analyzer] Do the self-init check only on NSObject subclasses. Patch by Jean-Daniel Dupas!

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

13 years agoSpeculatively revert r124236
Douglas Gregor [Tue, 25 Jan 2011 23:49:36 +0000 (23:49 +0000)]
Speculatively revert r124236

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

13 years agoDiagnose calling convention attribute incompatibilities. Fixes rdar://8876096.
Argyrios Kyrtzidis [Tue, 25 Jan 2011 23:16:40 +0000 (23:16 +0000)]
Diagnose calling convention attribute incompatibilities. Fixes rdar://8876096.

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

13 years agoFix infinite loop during error diagnostics. Fixes rdar://8875304.
Argyrios Kyrtzidis [Tue, 25 Jan 2011 23:16:36 +0000 (23:16 +0000)]
Fix infinite loop during error diagnostics. Fixes rdar://8875304.

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

13 years agoChange error "function cannot return array type" -> "blocks cannot return array type...
Argyrios Kyrtzidis [Tue, 25 Jan 2011 23:16:33 +0000 (23:16 +0000)]
Change error "function cannot return array type" -> "blocks cannot return array type" when blocks are involved.
Addresses rdar://8876238.

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

13 years agoTweak return-noreturn.cpp test to have its original
Ted Kremenek [Tue, 25 Jan 2011 22:57:41 +0000 (22:57 +0000)]
Tweak return-noreturn.cpp test to have its original
contents, with the additional warning flag (and still marked XFAIL).

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

13 years agoFix regression in -Wreturn-type caused by not
Ted Kremenek [Tue, 25 Jan 2011 22:50:47 +0000 (22:50 +0000)]
Fix regression in -Wreturn-type caused by not
handling all CFGElement kinds.  While writing
the test case, it turned out that return-noreturn.cpp
wasn't actually testing anything since it has the wrong -W
flag.  That uncovered another regression with
the handling of destructors marked noreturn.  WIP.

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

13 years agoSpeculatively implement a tweak to the C++0x overload resolution rules
Douglas Gregor [Tue, 25 Jan 2011 22:19:32 +0000 (22:19 +0000)]
Speculatively implement a tweak to the C++0x overload resolution rules
for reference binding (C++ [over.rank.ics]p3b1sb4), so that we prefer
the binding of an lvalue reference to a function lvalue over the
binding of an rvalue reference. This change resolves the ambiguity
with std::forward and lvalue references to function types in a way
that seems consistent with the original rvalue references proposal.

My proposed wording for this change is shown in
isBetterReferenceBindingKind(); we'll try to get this change adopted
in the C++0x working paper as well.

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

13 years agoUnbreak CMake build.
Ted Kremenek [Tue, 25 Jan 2011 22:10:37 +0000 (22:10 +0000)]
Unbreak CMake build.

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

13 years agoDon't try and symbolicate unions; we don't reason
Ted Kremenek [Tue, 25 Jan 2011 21:08:47 +0000 (21:08 +0000)]
Don't try and symbolicate unions; we don't reason
about them yet.  Fixes crash reported in PR 9049.

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

13 years agoAdd -add-plugin flag, which runs plugins in addition to codegen.
Nico Weber [Tue, 25 Jan 2011 20:34:14 +0000 (20:34 +0000)]
Add -add-plugin flag, which runs plugins in addition to codegen.

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

13 years agoAdd an attribute to forbid temporary instances of a type. This allows class
Jeffrey Yasskin [Tue, 25 Jan 2011 20:08:12 +0000 (20:08 +0000)]
Add an attribute to forbid temporary instances of a type.  This allows class
authors to write

  class __attribute__((forbid_temporaries)) Name { ... };

when they want to force users to name all variables of the type. This protects
people from doing things like creating a scoped_lock that only lives for a
single statement instead of an entire scope.

The warning produced by this attribute can be disabled by
-Wno-forbid-temporaries.

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

13 years agoFix the ranking of reference bindings during overload resolution
Douglas Gregor [Tue, 25 Jan 2011 19:39:31 +0000 (19:39 +0000)]
Fix the ranking of reference bindings during overload resolution
(C++0x [over.ics.rank]p3) when one binding is an lvalue reference and
the other is an rvalue reference that binds to an rvalue. In
particular, we were using the predict "is an rvalue reference" rather
than "is an rvalue reference that binds to an rvalue", which was
incorrect in the one case where an rvalue reference can bind to an
lvalue: function references.

This particular issue cropped up with std::forward, where Clang was
picking an std::forward overload while forwarding an (lvalue)
reference to a function. However (and unfortunately!), the right
answer for this code is that the call to std::forward is
ambiguous. Clang now gets that right, but we need to revisit the
std::forward implementation in libc++.

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

13 years agoRecycle memory for GRStates that are never referenced
Ted Kremenek [Tue, 25 Jan 2011 19:13:54 +0000 (19:13 +0000)]
Recycle memory for GRStates that are never referenced
by ExplodedNodes.  This leads to about a 4-8%
reduction in memory footprint when analyzing
functions in sqlite3.

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

13 years agoTeach -Wuninitialized-experimental to also warn
Ted Kremenek [Tue, 25 Jan 2011 19:13:48 +0000 (19:13 +0000)]
Teach -Wuninitialized-experimental to also warn
about uninitialized variables captured by blocks.

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

13 years agoTweak wording of static analyzer diagnostic
Ted Kremenek [Tue, 25 Jan 2011 19:13:42 +0000 (19:13 +0000)]
Tweak wording of static analyzer diagnostic
for a block capturing the value of an uninitialized
variable.

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

13 years agoTeach TemplateSpecializationTypeLoc::initializeArgLocs() to actually
Douglas Gregor [Tue, 25 Jan 2011 19:13:18 +0000 (19:13 +0000)]
Teach TemplateSpecializationTypeLoc::initializeArgLocs() to actually
generate meaningful [*] template argument location information.

[*] Well, as meaningful as possible, given that this entire code path
is a hack for when we've lost type-source information.

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

13 years agoMove unnamed_addr after the function arguments on Sabre's request.
Rafael Espindola [Tue, 25 Jan 2011 19:10:24 +0000 (19:10 +0000)]
Move unnamed_addr after the function arguments on Sabre's request.

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

13 years agoAdd test for PR8629
Douglas Gregor [Tue, 25 Jan 2011 18:11:52 +0000 (18:11 +0000)]
Add test for PR8629

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

13 years agoDon't insert class templates into the DynamicClasses vector.
Anders Carlsson [Tue, 25 Jan 2011 18:08:22 +0000 (18:08 +0000)]
Don't insert class templates into the DynamicClasses vector.

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

13 years agoBe a bit more defensive about setting the temporary base location
Douglas Gregor [Tue, 25 Jan 2011 17:51:48 +0000 (17:51 +0000)]
Be a bit more defensive about setting the temporary base location
during template instantiation. This code needs to eventually die, but
this little tweak fixes PR8629, where bad location information slipped
through to the location of a class template instantiation.

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

13 years agoImplement the rvalue-reference deduction transformation (from T&& ->
Douglas Gregor [Tue, 25 Jan 2011 17:19:08 +0000 (17:19 +0000)]
Implement the rvalue-reference deduction transformation (from T&& ->
T) when taking the address of an overloaded function or matching a
specialization to a template (C++0x [temp.deduct.type]p10). Fixes
PR9044.

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

13 years agoWhen performing a glvalue-to-xvalue static_cast that involves a
Douglas Gregor [Tue, 25 Jan 2011 16:13:26 +0000 (16:13 +0000)]
When performing a glvalue-to-xvalue static_cast that involves a
derived-to-base conversion, set the cast kind and base path
appropriately.

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

13 years agoDocument the ns_returns_retained, ns_consumed, etc. attributes.
John McCall [Tue, 25 Jan 2011 04:26:21 +0000 (04:26 +0000)]
Document the ns_returns_retained, ns_consumed, etc. attributes.

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

13 years agoChange the wording of the bad-decl-for-attribute warning and error
John McCall [Tue, 25 Jan 2011 03:51:08 +0000 (03:51 +0000)]
Change the wording of the bad-decl-for-attribute warning and error
to make it clear that we're talking about the declarations and not the types.

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

13 years agoAdd the ns_consumes_self, ns_consumed, cf_consumed, and ns_returns_autoreleased
John McCall [Tue, 25 Jan 2011 03:31:58 +0000 (03:31 +0000)]
Add the ns_consumes_self, ns_consumed, cf_consumed, and ns_returns_autoreleased
attributes for the benefit of the static analyzer.

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

13 years agoDowngrade the error about rvalue references to an extension warning
Douglas Gregor [Tue, 25 Jan 2011 02:17:32 +0000 (02:17 +0000)]
Downgrade the error about rvalue references to an extension warning
and turn on __has_feature(cxx_rvalue_references). The core rvalue
references proposal seems to be fully implemented now, pending lots
more testing.

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

13 years ago[analyzer] Handle the dot syntax for properties in the ExprEngine.
Argyrios Kyrtzidis [Tue, 25 Jan 2011 00:04:03 +0000 (00:04 +0000)]
[analyzer] Handle the dot syntax for properties in the ExprEngine.

We translate property accesses to obj-c messages by simulating "loads" or "stores" to properties
using a pseudo-location SVal kind (ObjCPropRef).

Checkers can now reason about obj-c messages for both explicit message expressions and implicit
messages due to property accesses.

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

13 years ago[analyzer] Introduce ExprEngine::VisitObjCMessage for handling general ObjCMessages...
Argyrios Kyrtzidis [Tue, 25 Jan 2011 00:03:57 +0000 (00:03 +0000)]
[analyzer] Introduce ExprEngine::VisitObjCMessage for handling general ObjCMessages (both message expressions and property access)
and use it in ExprEngine::VisitObjCMessageExpr.

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

13 years ago[analyzer] Introduce ObjCMessage which represents both explicit ObjC message expressi...
Argyrios Kyrtzidis [Tue, 25 Jan 2011 00:03:53 +0000 (00:03 +0000)]
[analyzer] Introduce ObjCMessage which represents both explicit ObjC message expressions and implicit
messages that are sent for handling properties in dot syntax.

Replace all direct uses of ObjCMessageExpr in the checkers and checker interface with ObjCMessage.

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

13 years agoIn a ObjCMessageExpr with the super class as receiver, 'super' is actually a ObjCInte...
Argyrios Kyrtzidis [Tue, 25 Jan 2011 00:03:48 +0000 (00:03 +0000)]
In a ObjCMessageExpr with the super class as receiver, 'super' is actually a ObjCInterfaceType.

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

13 years ago[analyzer] Simplify GetReceiverType function in BasicObjCFoundationChecks.cpp; no...
Argyrios Kyrtzidis [Tue, 25 Jan 2011 00:03:45 +0000 (00:03 +0000)]
[analyzer] Simplify GetReceiverType function in BasicObjCFoundationChecks.cpp; no functionality change.

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

13 years agoRevert r124146 for now. It appears to be failing on a few platforms.
Eric Christopher [Mon, 24 Jan 2011 23:07:03 +0000 (23:07 +0000)]
Revert r124146 for now. It appears to be failing on a few platforms.

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

13 years agopre/post increase/decrease for AltiVec vectors
Anton Yartsev [Mon, 24 Jan 2011 20:55:22 +0000 (20:55 +0000)]
pre/post increase/decrease for AltiVec vectors

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

13 years agoEnhance the diagnostic for referring to a typedef with an elaborated name to be
Nick Lewycky [Mon, 24 Jan 2011 19:01:04 +0000 (19:01 +0000)]
Enhance the diagnostic for referring to a typedef with an elaborated name to be
as useful in a templated context as it is without templates. Fixes PR8755!

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

13 years agoDisallow function template partial specializations, from Hans
Douglas Gregor [Mon, 24 Jan 2011 18:54:39 +0000 (18:54 +0000)]
Disallow function template partial specializations, from Hans
Wennborg! Fixes PR8295.

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

13 years agoEliminate the use of getTypeForDecl from clang_getCursorType() and
Douglas Gregor [Mon, 24 Jan 2011 18:44:28 +0000 (18:44 +0000)]
Eliminate the use of getTypeForDecl from clang_getCursorType() and
clang_getDeclObjCTypeEncoding(); use ASTContext's methods instead,
which will (lazily) create the type as needed. Otherwise, we can end
up with null QualTypes.

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

13 years agoNote the need for --param=build_config=whatever in the Hacking Clang document, from...
Douglas Gregor [Mon, 24 Jan 2011 18:04:58 +0000 (18:04 +0000)]
Note the need for --param=build_config=whatever in the Hacking Clang document, from Yuri Gribov

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

13 years agoImprove the printing of C++ construction expressions, from Yuri Gribov!
Douglas Gregor [Mon, 24 Jan 2011 17:25:03 +0000 (17:25 +0000)]
Improve the printing of C++ construction expressions, from Yuri Gribov!

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

13 years agoUse attributes for all the override control specifiers.
Anders Carlsson [Mon, 24 Jan 2011 16:26:15 +0000 (16:26 +0000)]
Use attributes for all the override control specifiers.

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

13 years agoRe-instate r123977/r123978, my updates of the reference-binding
Douglas Gregor [Mon, 24 Jan 2011 16:14:37 +0000 (16:14 +0000)]
Re-instate r123977/r123978, my updates of the reference-binding
implementation used by overload resolution to support rvalue
references. The original commits caused PR9026 and some
hard-to-reproduce self-host breakage.

The only (crucial!) difference between this commit and the previous
commits is that we now properly check the SuppressUserConversions flag
before attempting to perform a second user-defined conversion in
reference binding, breaking the infinite recursion chain of
user-defined conversions.

Rvalue references should be working a bit better now.

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

13 years agoCheck whether DependentScopeDeclRefExpr's NestedNameSpecifier exists before accessing...
Axel Naumann [Mon, 24 Jan 2011 15:44:00 +0000 (15:44 +0000)]
Check whether DependentScopeDeclRefExpr's NestedNameSpecifier exists before accessing it, both for consistency (see StmtPrinter::VisitDeclRefExpr()) and for other use cases of dependent types.

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

13 years agoEliminate the last reference to concepts, from Jean-Daniel Dupas
Douglas Gregor [Mon, 24 Jan 2011 15:22:41 +0000 (15:22 +0000)]
Eliminate the last reference to concepts, from Jean-Daniel Dupas

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

13 years agoFix the __has_attribute example; we don't have an override attribute anymore.
Anders Carlsson [Mon, 24 Jan 2011 03:54:51 +0000 (03:54 +0000)]
Fix the __has_attribute example; we don't have an override attribute anymore.

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

13 years agofix some typos, patch by Jonathan Wakely!
Chris Lattner [Mon, 24 Jan 2011 03:47:59 +0000 (03:47 +0000)]
fix some typos, patch by Jonathan Wakely!

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

13 years agofix a broken example, PR9005, patch by Jonathan Wakely!
Chris Lattner [Mon, 24 Jan 2011 03:47:34 +0000 (03:47 +0000)]
fix a broken example, PR9005, patch by Jonathan Wakely!

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

13 years agoremove some crazy leftover thing.
Chris Lattner [Mon, 24 Jan 2011 02:53:58 +0000 (02:53 +0000)]
remove some crazy leftover thing.

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

13 years agoWhen building a type info struct for EH, we always want it to have linkonce_odr linkage.
Anders Carlsson [Mon, 24 Jan 2011 02:12:11 +0000 (02:12 +0000)]
When building a type info struct for EH, we always want it to have linkonce_odr linkage.

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