Commit Graph

29330 Commits

Author SHA1 Message Date
Oscar Fuentes 73963b67c1 Fix some issues with include directories: remove a duplicate and put
Clang binary and source directories first (on that order).

llvm-svn: 127822
2011-03-17 19:03:04 +00:00
Daniel Dunbar 033a4bc49e Driver/Darwin: These are command line options, not target features.
llvm-svn: 127820
2011-03-17 18:29:04 +00:00
Daniel Dunbar 1d733e2d7e Driver/Darwin: Suppress spurious warning about -force_cpusubtype_ALL.
llvm-svn: 127819
2011-03-17 17:37:29 +00:00
Daniel Dunbar c9388c11f1 Driver/Darwin/ARM: Kernel/kext code has more strict alignment requirements.
llvm-svn: 127815
2011-03-17 17:10:06 +00:00
Richard Smith 9647d3ca02 Fix PR9488: 'auto' type substitution can fail (for instance, if it creates a reference-to-void type). Don't crash if it does.
Also fix an issue where type source information for the resulting type was being lost.

llvm-svn: 127811
2011-03-17 16:11:59 +00:00
David Chisnall a9e5460f03 Remove code that was intentionally generating bad code on the GNU runtime for no reason (failing to emit .cxx_constructor / .cxx_destructor methods).
llvm-svn: 127806
2011-03-17 14:19:08 +00:00
Ted Kremenek 65ccd1d9b0 Fix test to test the right thing.
llvm-svn: 127803
2011-03-17 05:34:58 +00:00
Ted Kremenek 2551fbe928 Don't construct two CFGs just to run -Wuninitialized. While this causes new warnings to be flagged under -Wconditional-uninitialized, this is something we
can improve over time.

llvm-svn: 127802
2011-03-17 05:29:57 +00:00
Ted Kremenek 97d8d03855 Make test more portable.
llvm-svn: 127799
2011-03-17 04:16:45 +00:00
Ted Kremenek 70727343cf Teach VariadicMethodTypeChecker about pointers attributed as 'NSObject'.
llvm-svn: 127798
2011-03-17 04:10:25 +00:00
Ted Kremenek 6fa1daede5 Teach VariadicMethodTypeChecker that CF references are valid arguments to variadic Objective-C methods.
llvm-svn: 127797
2011-03-17 04:01:35 +00:00
Ted Kremenek 3e5ad5932e Tweak RegionStore's handling of lazy compound values to use the 'Default' versus 'Direct' binding key, thus allowing specific elements of an array/struct to be overwritten without
invalidating the entire binding.  Fixes PR 9455.

llvm-svn: 127796
2011-03-17 03:51:51 +00:00
Ted Kremenek c15a4e4b37 Extend -Wuninitialized to support vector types.
llvm-svn: 127794
2011-03-17 03:06:11 +00:00
Ted Kremenek 61c74a1423 Rename -Wuninitialized-maybe to -Wconditional-uninitialized.
llvm-svn: 127793
2011-03-17 03:06:07 +00:00
Ken Dyck db205d1828 Convert NextOffsetInBytes to CharUnits and rename to NextOffsetInChars. No
change in functionality intended.

llvm-svn: 127787
2011-03-17 01:33:18 +00:00
Matt Beaumont-Gay 145e2eb0e3 Politely inform GCC that we will never fall off the end of that switch.
llvm-svn: 127783
2011-03-17 00:46:34 +00:00
Daniel Dunbar b1db4b69cc Driver/ARM: Match GCC behavior in that -msoft-float disables NEON, despite this
not being consistent at all with other parts of the GCC implementation.

llvm-svn: 127777
2011-03-17 00:07:34 +00:00
Douglas Gregor c2b97994ea When libclang visits a translation unit via clang_visitChildren(),
walk the preprocessing record *before* walking the declarations, so
they we pretend that we actually respect the phases of translation.

We still walk the preprocessing record after the declarations when
performing token annotation or finding the cursor at a location, since
those routines depend on those semantics.

Fixes <rdar://problem/9137195>.

llvm-svn: 127776
2011-03-16 23:23:30 +00:00
Joerg Sonnenberger bdbdf70334 Use C as fallback type if in C preprocessor mode.
llvm-svn: 127769
2011-03-16 22:45:02 +00:00
Eli Friedman b6069255da PR9494: Get rid of bitcast which was both unnecessary and written incorrectly.
llvm-svn: 127768
2011-03-16 22:34:09 +00:00
Ted Kremenek d4bcb4ffc1 Compress argument processing in ccc-analyzer. No functionality change.
llvm-svn: 127758
2011-03-16 21:10:42 +00:00
Abramo Bagnara 9875a3ce70 Use ElaboratedType also for C.
llvm-svn: 127755
2011-03-16 20:16:18 +00:00
Joerg Sonnenberger f6ce2fb1b3 Refactor program name logic. Extend it to infer the target triple from
the program name, if it includes it as proper prefix. This makes calling
clang with -ccc-host-triple x86_64-linux the same as calling it with the
name x86_64-linux-clang.

llvm-svn: 127753
2011-03-16 20:15:43 +00:00
Douglas Gregor 63fab34469 Detect attempts to provide a specialization of a function within a
dependent scope and produce an error (rather than crashing). Fixes PR8979.

llvm-svn: 127749
2011-03-16 19:27:09 +00:00
Argyrios Kyrtzidis d6278e3252 Having FileManager::getFile always open the file, brought much consternation and leaking of file descriptors.
Add 'openFile' bool to FileManager::getFile to specify whether we want to have the file opened or not, have it
false by default, and enable it only in HeaderSearch.cpp where the open+fstat optimization matters.

Fixes rdar://9139899.

llvm-svn: 127748
2011-03-16 19:17:25 +00:00
Douglas Gregor 89f3cd5c15 Clean up our handling of template-ids that resolve down to a single
overload, so that we actually do the resolution for full expressions
and emit more consistent, useful diagnostics. Also fixes an IRGen
crasher, where Sema wouldn't diagnose a resolvable bound member
function template-id used in a full-expression (<rdar://problem/9108698>).

llvm-svn: 127747
2011-03-16 19:16:25 +00:00
Sandeep Patel 5a4a0f75d4 Fix duplicate argument processing
llvm-svn: 127746
2011-03-16 19:14:34 +00:00
Peter Collingbourne 7d8a0b52d4 Support for printing/dumping static asserts
llvm-svn: 127744
2011-03-16 18:37:27 +00:00
Peter Collingbourne 4828368dc8 Remove a duplicate language feature
llvm-svn: 127743
2011-03-16 18:35:34 +00:00
Chandler Carruth 3cc331a160 Add a 'RawPath' parameter to the PPCallbacks interface. This allows
clients to observe the exact path through which an #included file was
located. This is very useful when trying to record and replay inclusion
operations without it beind influenced by the aggressive caching done
inside the FileManager to avoid redundant system calls and filesystem
operations.

The work to compute and return this is only done in the presence of
callbacks, so it should have no effect on normal compilation.

Patch by Manuel Klimek.

llvm-svn: 127742
2011-03-16 18:34:36 +00:00
Douglas Gregor ce0bc31469 Don't indescriminately print overload candidates when we have invalid
operands to a binary expression; it doesn't make sense in all
contexts. The right answer would be to see if the user forgot at ().

Fixes <rdar://problem/9136502>.

llvm-svn: 127740
2011-03-16 18:21:05 +00:00
Douglas Gregor 6341ceedc5 Allow function calls to dereferenced member pointers of
pointer-to-function type. Fixes <rdar://problem/9065289>.

llvm-svn: 127739
2011-03-16 17:42:23 +00:00
Douglas Gregor a0ff0c34a7 Make sure that we always pop a function's scope *before* we call
ActOnFinishFunctionBody/ActOnBlockStmtExpr. This way, we ensure that
we diagnose undefined labels before the jump-scope checker gets run,
since the jump-scope checker requires (as its invariant) that all of
the GotoStmts be wired up correctly.

Fixes PR9495.

llvm-svn: 127738
2011-03-16 17:05:57 +00:00
Douglas Gregor 46c04e74fb When we're inserting a synthesized label declaration for a
forward-looking "goto" statement, make sure to insert it *after* the
last declaration in the identifier resolver's declaration chain that
is either outside of the function/block/method's scope or that is
declared in that function/block/method's specific scope. Previously,
we could end up inserting the label ahead of declarations in inner
scopes, confusing C++ name lookup.

Fixes PR9491/<rdar://problem/9140426> and <rdar://problem/9135994>.

Note that the crash-on-invalid PR9495 is *not* fixed. That's a
separate issue.

llvm-svn: 127737
2011-03-16 16:39:03 +00:00
David Chisnall 803adc1bcf Fix foreign exception handling (GNU runtime).
llvm-svn: 127736
2011-03-16 15:44:28 +00:00
Abramo Bagnara 22f8cd7117 Added missing methods to get Designators source range.
llvm-svn: 127735
2011-03-16 15:08:46 +00:00
NAKAMURA Takumi c9998aa1f4 test/Driver/hello.c: Tweak for cygming.
- Driver's name may be "clang(-\d.\d).exe".
  - Emitted executable file is named as "%t.exe". It must be harmless on other OS.

llvm-svn: 127729
2011-03-16 13:51:46 +00:00
Ted Kremenek 35c70f64db Teach CFGBuilder that the 'default' branch of a switch statement is dead if all enum values in a switch conditioned are handled.
llvm-svn: 127727
2011-03-16 04:32:01 +00:00
John McCall e99e5dcbd3 Don't emit read barriers for reading __weak __block variables
in non-GC mode.

llvm-svn: 127725
2011-03-16 02:53:38 +00:00
Ted Kremenek 4ceebbf54d VariadicMethodTypeChecker: don't warn for null pointer constants passed to variadic Objective-C methods.
llvm-svn: 127719
2011-03-16 00:22:51 +00:00
Ted Kremenek 6f7008dcb6 c-index-test shouldn't crash when a goto has no matching label. Fixes <rdar://problem/9123493>.
llvm-svn: 127711
2011-03-15 23:47:49 +00:00
Ted Kremenek 6cd0187718 Remove warning for null characters in CFString literals. Clang handles them just fine, and GCC 4.2 doesn't warn here either.
We added this warning back in 2007 when we were comparing against GCC 4.0.

llvm-svn: 127704
2011-03-15 21:18:52 +00:00
Ted Kremenek 0d5b9ef564 Don't warn about null characters in Objective-C format string literals.
llvm-svn: 127703
2011-03-15 21:18:48 +00:00
John McCall 2de87f67e5 Reorganize the emission of (unfoldable) constant casts a bit, and
make sure that upcasts of member pointer types are covered as constants.
Fixed rdar://problem/9130221

llvm-svn: 127702
2011-03-15 21:17:48 +00:00
Sebastian Redl c17003c66b Create __has_feature(cxx_noexcept) and mark it as working.
Find out that our C++0x status has only one field for noexcept expression and specification together, and that it was accidentally already marked as fully implemented.
This completes noexcept specification work.

llvm-svn: 127701
2011-03-15 21:17:12 +00:00
Sebastian Redl e800838170 Fix test case.
llvm-svn: 127699
2011-03-15 21:15:06 +00:00
Sebastian Redl 52ddca23a7 Extend the noexcept expression test to test noexcept specification functions.
llvm-svn: 127693
2011-03-15 20:45:42 +00:00
Sebastian Redl c34c29f661 More robust check for the special C++0x operator new workaround.
llvm-svn: 127692
2011-03-15 20:41:09 +00:00
Sebastian Redl cb5dd00796 Implement a hack to work around the changing exception specification of operator new in C++0x.
llvm-svn: 127688
2011-03-15 19:52:30 +00:00
Ted Kremenek cdb2ae587a Remove bogus assertion in IdempotentOperationsChecker.
llvm-svn: 127687
2011-03-15 19:27:57 +00:00
Sebastian Redl 0b94c9fb69 Reintroduce r127617: "Code generation for noexcept." with fixes.
llvm-svn: 127685
2011-03-15 18:42:48 +00:00
Fariborz Jahanian b03a4c23c2 Don't poke into redefined 'id' type looking for a property
declaration as this results in a confusing error message,
instead of message related to missing property declaration.
// rdar://9106929

llvm-svn: 127682
2011-03-15 17:27:48 +00:00
Ted Kremenek e3ae0a4c47 Appease GCC. I'm surprised Clang accepted this.
llvm-svn: 127672
2011-03-15 05:30:12 +00:00
Ted Kremenek 7c607e66f4 Remove duplicate group definition that snuck in due to a merge conflict.
llvm-svn: 127671
2011-03-15 05:25:02 +00:00
Ted Kremenek ea6c20adaf Take 2: merge -Wuninitialized-experimental into -Wuninitialized. Only *must-be-uninitialized* warnings are reported, with *maybe-uninitialized* under a separate flag. I await any fallout/comments/feedback, although hopefully this will produce no noise for users.
llvm-svn: 127670
2011-03-15 05:22:33 +00:00
Ted Kremenek 1a47f366b7 Split warnings from -Wuninitialized-experimental into "must-be-initialized" and "may-be-initialized" warnings, each controlled by different flags.
llvm-svn: 127669
2011-03-15 05:22:28 +00:00
Ted Kremenek c8c4e5f371 Split warnings from -Wuninitialized-experimental into "must-be-initialized" and "may-be-initialized" warnings, each controlled by different flags.
llvm-svn: 127666
2011-03-15 04:57:38 +00:00
Ted Kremenek 9b15c962a9 UninitializedValues: introduce ValueVector:reference class to forward to llvm::BitVector. No real functionality change, but this is a stepping stone to moving to tri-state logic.
llvm-svn: 127665
2011-03-15 04:57:32 +00:00
Ted Kremenek d3def3841f UninitializedValues: wrap BitVector references in a new class ValueVector. No functionality change. This defines the minimum interface that ValueVector needs to support when we no longer base it strictly on a direct interpretation of BitVector.
llvm-svn: 127664
2011-03-15 04:57:29 +00:00
Ted Kremenek a895fe999d Substitue term "BitVector" with "ValueVector" to prep for further revisions. No functionality change.
llvm-svn: 127663
2011-03-15 04:57:27 +00:00
Ted Kremenek a0a5ca14d0 Rename UninitializedValuesV2 to UninitializedValues.
llvm-svn: 127657
2011-03-15 03:17:07 +00:00
Ted Kremenek 792798549f Remove old UninitializedValues analysis.
llvm-svn: 127656
2011-03-15 03:17:01 +00:00
NAKAMURA Takumi b2beb018b8 lib/Basic/Targets.cpp: __declspec(attr) should be provided on mingw as macro, alias of __attribute__.
On mingw without -fms-extensions, we can provide "as-is" __declspec.

llvm-svn: 127655
2011-03-15 02:32:50 +00:00
NAKAMURA Takumi 1a780ee8a9 lib/Headers/mm_malloc.h: On Windows, we can expect _mm_malloc would be provided as macro by <malloc.h>.
llvm-svn: 127654
2011-03-15 02:32:43 +00:00
NAKAMURA Takumi 63b4b456be lib/Frontend/InitHeaderSearch.cpp: Introduce AddMinGW64CXXPaths(Base) for x86_64-w64-mingw32.
llvm-svn: 127652
2011-03-15 02:32:36 +00:00
Ken Dyck 1c80fd1346 Introduce a CharUnits FieldOffsetInChars variable in AppendField() to
replace some uses of FieldOffsetInBytes. The remaining uses of
FieldOffsetInBytes will be replaced once NextFieldOffsetInBytes is converted
to CharUnits. No change in functionality intended.

llvm-svn: 127641
2011-03-15 01:09:02 +00:00
Argyrios Kyrtzidis 669b0b1521 Stop leaking file descriptors.
After the open+fstat optimization, files were already opened for FileManager::getBufferForFile() and we closed them after reading them.
The problem was that when -working-directory was passed, the code path that actually reuses & closes the already opened file descriptor
was not followed.

llvm-svn: 127639
2011-03-15 00:47:44 +00:00
Jakob Stoklund Olesen fcaa2e1ba4 Revert r127617: "Code generation for noexcept."
The tests fail in a -Asserts build.

llvm-svn: 127635
2011-03-15 00:18:21 +00:00
Douglas Gregor 1e98986160 Disable 'auto' type deduction in Objective-C. It likes 'id' a bit too
much to be useful.

llvm-svn: 127625
2011-03-14 21:43:30 +00:00
Joerg Sonnenberger 161f9a3829 Sort
llvm-svn: 127624
2011-03-14 21:20:46 +00:00
Douglas Gregor 88764cf822 When synthesizing a label declaration based on a goto statement that
cannot yet be resolved, be sure to push the new label declaration into
the right place within the identifier chain. Otherwise, name lookup in
C++ gets confused when searching for names that are lexically closer
than the label. Fixes PR9463.

llvm-svn: 127623
2011-03-14 21:19:51 +00:00
Rafael Espindola 0c1f098284 Switch from internal to linker_private linkage, it is sufficient to please the new linker.
llvm-svn: 127622
2011-03-14 21:08:19 +00:00
Sebastian Redl 97022fd325 Code generation for noexcept.
llvm-svn: 127617
2011-03-14 20:33:20 +00:00
Eric Christopher cf5e83b471 __clear_cache() is varargs and people will occasionally write it without
arguments. Process only the arguments that people write, but process
all of them.

Fixes rdar://8900346

llvm-svn: 127616
2011-03-14 20:30:34 +00:00
Ted Kremenek 066b226daa Tweak VariadicMethodTypeChecker to only create one ExplodedNode when issuing multiple warnings for the same message expression.
Also add a test case showing that we correctly report multiple warnings for the same message expression.

llvm-svn: 127605
2011-03-14 19:50:37 +00:00
Ted Kremenek 7b635daf6e Incorporate source ranges for RangeBugReport when coelescing reports into equivalence classes.
llvm-svn: 127604
2011-03-14 19:50:34 +00:00
Sebastian Redl 771f57de1c Implement instantiation of noexcept spec and add a test case.
llvm-svn: 127603
2011-03-14 18:51:50 +00:00
Sebastian Redl 849385bf76 Add another, pretty trivial, exception spec test case.
llvm-svn: 127602
2011-03-14 18:51:44 +00:00
Sebastian Redl 37588097af Make deallocation functions implicitly noexcept in C++0x.
llvm-svn: 127596
2011-03-14 18:08:30 +00:00
Rafael Espindola 7a6cf01895 Fix link of libxul with LTO and the linker in xcode4. It is not clear if this
is working around a bug in ld or if the new linker has a reasonable reason
for wanting the string constant to be linker visible.

llvm-svn: 127594
2011-03-14 17:55:00 +00:00
Douglas Gregor e981bb0e5c -fwritable-strings should silence warnings about the deprecated string
-literal to char* conversion. Make it so.

llvm-svn: 127586
2011-03-14 16:13:32 +00:00
Fariborz Jahanian 90186f8a3e Block return type of the initialized must be
be more speciaclized than that of the initializer,
when matching protocol qualifier list.
// rdar:// 9118343.

llvm-svn: 127585
2011-03-14 16:07:00 +00:00
Douglas Gregor 0a36f4d654 Support Ubuntu hardy and intrepid, from Thomas Gamper!
llvm-svn: 127583
2011-03-14 15:39:50 +00:00
Douglas Gregor 7ee23a8698 Add include paths for Gentoo Linux, from Marcin Mirosław!
llvm-svn: 127582
2011-03-14 15:33:44 +00:00
David Chisnall f836b5bc3f Fix incorrect linkage specifiers for selectors.
llvm-svn: 127580
2011-03-14 15:01:16 +00:00
Oscar Fuentes a29f7b2591 Fix LIBCLANG_LINK_FLAGS for Darwin.
The previous syntax created a list with the usual semicolon as
separator, which breaks the link command.

llvm-svn: 127579
2011-03-14 14:32:16 +00:00
Anders Carlsson 9ba8fb1e48 Get rid of the static FileManager::FixupRelativePath.
llvm-svn: 127573
2011-03-14 01:13:54 +00:00
Anders Carlsson d91d5f162f Add an Objective-C checker that checks that arguments passed to some variadic Objective-C methods are of Objective-C pointer types.
Ted or Argiris, I'd appreciate a review!

llvm-svn: 127572
2011-03-13 20:35:21 +00:00
Anders Carlsson 7e056d106b Change GetNullarySelector and GetUnarySelector to take a StringRef.
llvm-svn: 127571
2011-03-13 20:32:45 +00:00
Sebastian Redl 31ad754c96 Instead of storing an ASTContext* in FunctionProtoTypes with computed noexcept specifiers, unique FunctionProtoTypes with a ContextualFoldingSet, as suggested by John McCall.
llvm-svn: 127568
2011-03-13 17:09:40 +00:00
Oscar Fuentes 7221610543 Build libclang as a static library too. Now tested on Windows!
On Windows only the shared library is created. The reason for this is
that clang.lib the static library would clash with clang.lib the
export library of the dll.

llvm-svn: 127566
2011-03-13 15:10:24 +00:00
Oscar Fuentes 89b17a43e7 Reverting "Build libclang as a static library too."
This reverts commit r127556. It breaks the build for MSVC.

llvm-svn: 127564
2011-03-13 04:28:29 +00:00
Ted Kremenek 53e6538fa8 Fix CFG assertion failure reported in PR 9467. This was due to recent changes in optimizing CFGs for switch statements.
llvm-svn: 127563
2011-03-13 03:48:04 +00:00
Jakob Stoklund Olesen 609e814a4a XFAIL this on windows where <vector> contains surprises.
llvm-svn: 127559
2011-03-13 00:55:43 +00:00
Oscar Fuentes 89374ea270 Build libclang as a static library too.
llvm-svn: 127556
2011-03-12 22:01:58 +00:00
Fariborz Jahanian c677f69397 Place duplicate argument declaration in in
method prototypes under the -Wduplicate-method-arg and
turn it off by default.

llvm-svn: 127552
2011-03-12 18:54:30 +00:00
Sebastian Redl 9cb4be2466 Revert "Disable delegating constructors for 2.9"
It is only meant for the release branch.

llvm-svn: 127544
2011-03-12 13:53:51 +00:00
Sebastian Redl a2cb77f54e Disable delegating constructors for 2.9
llvm-svn: 127543
2011-03-12 13:53:47 +00:00
Sebastian Redl c1f8e493da Revert "Disable inherited constructors for 2.9."
It is only meant for the release branch.

llvm-svn: 127542
2011-03-12 13:44:32 +00:00
Sebastian Redl 1dc2c1d27f Disable inherited constructors for 2.9.
llvm-svn: 127541
2011-03-12 13:44:23 +00:00
Ken Dyck a862d95054 Use CharUnits for argument passed to AppendPadding() from AppendBitField().
No change in functionality intended.

llvm-svn: 127538
2011-03-12 12:03:11 +00:00
Sebastian Redl fa453cfdc3 Propagate the new exception information to FunctionProtoType.
Change the interface to expose the new information and deal with the enormous fallout.
Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications.
Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support.

llvm-svn: 127537
2011-03-12 11:50:43 +00:00
Abramo Bagnara f2a79d94e4 Forgotten part of previous commit.
llvm-svn: 127536
2011-03-12 11:17:06 +00:00
Abramo Bagnara 5e152ce3fe Fixed type and declaration source range in presence of typeQuals.
llvm-svn: 127535
2011-03-12 11:02:00 +00:00
Abramo Bagnara 6b6f051e5e Renamed OffsetOfNode::getRange to getSourceRange for uniformity.
llvm-svn: 127534
2011-03-12 09:45:03 +00:00
Ted Kremenek cd628393bb Tweak test to hopefully appease FreeBSD buildbot.
llvm-svn: 127533
2011-03-12 08:19:43 +00:00
Ted Kremenek 9997656600 Remove stray output file.
llvm-svn: 127532
2011-03-12 06:15:01 +00:00
Ted Kremenek a4a57c10da Re-enable the IdempotentOperations checker for --analyze, and put it and the DeadStores checker into the "deadcode" group.
llvm-svn: 127531
2011-03-12 06:14:28 +00:00
Ted Kremenek e5a89ac52a Don't have side-effects (or rather non-trivial computation) in StringSwitch "cases."
llvm-svn: 127528
2011-03-12 04:08:07 +00:00
Ted Kremenek f89710b936 Add initial version of "IteratorsChecker", a checker to find misues uses of C++ iterators.
This checker was created by Jim Goodnow II, and I migrated it to the
new Checker interface (recent changes by Argiris).

llvm-svn: 127525
2011-03-12 02:49:15 +00:00
Ted Kremenek 52d264cda5 Fix comments, and force auto progagation in VisitAggExpr.
llvm-svn: 127524
2011-03-12 02:49:11 +00:00
Ted Kremenek 97474f7414 static analyzer: Handle 'ExprWithCleanups' in ExprEngine by essentially ignoring them.
llvm-svn: 127523
2011-03-12 02:49:09 +00:00
Douglas Gregor 1beec45a61 Fixes for some more expressions containing function templateids that
should be resolvable, from Faisal Vali!

llvm-svn: 127521
2011-03-12 01:48:56 +00:00
Douglas Gregor 364f7db063 When we're determining whether to complain about a conversion from one
enumeration type to another in C, classify enumeration constants as if
they had the type of their enclosing enumeration. Fixes
<rdar://problem/9116337>.

llvm-svn: 127514
2011-03-12 00:14:31 +00:00
Ken Dyck 30a87e38d9 Change parameter to AppendPadding from bytes to CharUnits. No change in
functionality intended.

llvm-svn: 127513
2011-03-11 23:42:54 +00:00
Douglas Gregor 5ecbb1bc24 Don't ask if a depenendent CXXRecordDecl has any dependent bases
unless we already know that it has a definition. Fixes
PR9449/<rdar://problem/9115785>.

llvm-svn: 127512
2011-03-11 23:27:41 +00:00
Douglas Gregor e9e27d95db Implement a hack intended to allow Clang to parse libstdc++ 4.5's
headers, which use C++0x generalized initializer lists. Per PR7069, it
appears that the only use is as the return type of a function, so this
commit enables this extension just in that narrow case. If it's enough
for libstdc++ 4.5, or if it can be trivially extended to work with
libstdc++ 4.5, we'll keep it. Otherwise, or if this breaks anything,
we'll revert and wait for the real feature.

llvm-svn: 127507
2011-03-11 23:10:44 +00:00
John McCall 32ea969415 Use a slightly more semantic interface for emitting call arguments.
llvm-svn: 127494
2011-03-11 20:59:21 +00:00
Peter Collingbourne c77f85b4b0 OpenCL: if double precision floating point constant encountered
without cl_khr_fp64, warn and cast to single precision

llvm-svn: 127476
2011-03-11 19:24:59 +00:00
Peter Collingbourne e190dee7a5 Add support for the OpenCL vec_step operator, by generalising and
extending the existing support for sizeof and alignof.  Original
patch by Guy Benyei.

llvm-svn: 127475
2011-03-11 19:24:49 +00:00
Rafael Espindola 6b7e3bc992 Fix PR9453 by not trying to print a warning about ignored qualifiers
in conversion functions.

llvm-svn: 127460
2011-03-11 04:56:58 +00:00
John McCall 7684ddee7c When comparing a null pointer and something else, always cast the null
pointer instead of the other operand.

llvm-svn: 127458
2011-03-11 04:25:25 +00:00
Ken Dyck 327b77a442 Convert the RecordSize parameter of AppendTailPadding() to CharUnits to
avoid converting to bits and back again. No change in functionality
intended.

llvm-svn: 127455
2011-03-11 02:17:05 +00:00
Ken Dyck dbc0191181 Overload IntExprEvaluator::Success() with a function that takes a CharUnits
parameter to tidy up the places where the expression is a size.

llvm-svn: 127454
2011-03-11 02:13:43 +00:00
Ted Kremenek 339f7c3c58 Tweak ccc-analyzer's 'Analyze' function to not mutate the original arguments list.
llvm-svn: 127428
2011-03-10 21:10:08 +00:00
Ted Kremenek 4c0826c236 Profiling showed that 'CheckImplicitConversions' was very slow because of the call to getSpellingLoc(). On 'aes.c'
in the LLVM test suite, this function was consuming 7.4% of -fsyntax-only time.  This change fixes this issue
by delaying the check that the warning would be issued within a system macro by as long as possible.  The
main negative of this change is now the logic for this check is done in multiple places in this function instead
of just in one place up front.

llvm-svn: 127425
2011-03-10 20:03:42 +00:00
NAKAMURA Takumi dd63436808 lib/CodeGen/CGCall.cpp: Don't invoke multiple Builder.CreateBitCast() on Builder.CreateMemCpy. Or we would see sideeffect incompatibility among gcc and clang.
llvm-svn: 127405
2011-03-10 14:02:21 +00:00
Abramo Bagnara 0adf29a5bd Avoid do drop outer template parameter lists on the floor.
llvm-svn: 127404
2011-03-10 13:28:31 +00:00
Abramo Bagnara 19fd03e277 Fixed class type generation for MemberPointerType.
llvm-svn: 127401
2011-03-10 10:18:27 +00:00
Ted Kremenek a099c595bf When doing reachability analysis for warnings issued under DiagRuntimeBehavior, don't construct a ParentMap or CFGStmtMap.
Instead, create a small set of Stmt* -> CFGBlock* mappings during CFG construction for only the statements we care about
relating to the diagnostics we want to check for reachability.

llvm-svn: 127396
2011-03-10 03:50:34 +00:00
Ken Dyck a1a2e8decb Instead of round up sizes to '8', round them up to the alignment of the char
type.

llvm-svn: 127391
2011-03-10 02:00:35 +00:00
Ken Dyck e73807538a Round up the non-virtual size to the next char instead of rounding down.
llvm-svn: 127390
2011-03-10 01:53:59 +00:00
Ted Kremenek 7c58d35240 Require AddStmtChoice::alwaysAdd() to take a CFGBuilder& and Stmt*. Prep for functionality changes.
llvm-svn: 127387
2011-03-10 01:14:11 +00:00
Ted Kremenek 2866bab5fa Remove unused 'AddStmtChoice' argument to CFGBuilder::appendStmt().
llvm-svn: 127386
2011-03-10 01:14:08 +00:00
Ted Kremenek f9d8290af1 Rework interaction between AnalysisContext and CFG::BuildOptions to keep a BuildOptions object around instead of keeping a copy of the flags.
Moreover, change AnalysisContext to use an OwningPtr for created analysis objects instead
of directly managing them.

Finally, add a 'forcedBlkExprs' entry to CFG::BuildOptions that will be used by the
CFGBuilder to force specific expressions to be block-level expressions.

llvm-svn: 127385
2011-03-10 01:14:05 +00:00
Daniel Dunbar 334b2136f6 Revert r127206 "Detect attempts to provide a specialization of a function within
a...", it appears to cause us to reject various valid codes.

llvm-svn: 127373
2011-03-09 23:24:34 +00:00
Argyrios Kyrtzidis 4b8093ab5e Silence gcc warnings.
llvm-svn: 127370
2011-03-09 23:15:22 +00:00
Fariborz Jahanian b296e330a3 Property setter/getter must be looked up in property type's
list of protocols as well. // rdar://9078584

llvm-svn: 127367
2011-03-09 22:17:12 +00:00
Argyrios Kyrtzidis 4dfe569d93 Fix CMake build.
llvm-svn: 127360
2011-03-09 21:12:34 +00:00
Fariborz Jahanian 3dc11ad796 Lookup selector in protocol list of qualified objc type
to avoid a bogus warning. // rdar:// 9072298

llvm-svn: 127355
2011-03-09 20:18:06 +00:00
Argyrios Kyrtzidis 35dcda7922 Introduce '-chain-include' option to specify headers that will be converted to chained PCHs in memory
without having to use multiple runs and intermediate files.

Intended for testing & debugging of chained PCH.

llvm-svn: 127339
2011-03-09 17:21:42 +00:00
Douglas Gregor 20cbd059d4 Mention an XML printer on the Open Projects page
llvm-svn: 127336
2011-03-09 16:27:48 +00:00
Abramo Bagnara 29c2d46786 Fixed InnerLocStart.
llvm-svn: 127330
2011-03-09 14:09:51 +00:00
NAKAMURA Takumi 4e8c365e9a include/clang/Basic/BuiltinsX86.def: __builtin_ia32_crc32**() should be defined to take unsigned args and to return unsigned value.
mingw-w64's intrin.h declares __builtin_ia32_crc32**() as external.

llvm-svn: 127329
2011-03-09 12:00:19 +00:00
Chandler Carruth 1b7cc20fd8 FileCheckize this test.
llvm-svn: 127327
2011-03-09 10:56:54 +00:00
NAKAMURA Takumi e56d8cf846 include/clang/Makefile: [PR2928] "make install" may install include files along explicit pattern, not to install CMake's building stuff.
llvm-svn: 127326
2011-03-09 09:12:20 +00:00
John McCall 85915250c0 Remove a rather egregious use of getFunctionInfo.
llvm-svn: 127324
2011-03-09 08:39:33 +00:00
John McCall 46288eff24 Fix three of the four places where I left breadcrumbs to avoid unnecessary
recomputation.

llvm-svn: 127322
2011-03-09 08:12:35 +00:00
John McCall 5fe009660d Tame this assert, hopefully fixing self-host.
llvm-svn: 127319
2011-03-09 07:12:35 +00:00
Anders Carlsson 1f13bb5f00 When deserializing CXXBaseSpecifiers (and offsets), make sure to walk the chain in the correct order.
llvm-svn: 127315
2011-03-09 05:09:32 +00:00
John McCall a738c25f5e Use the "undergoes default argument promotion" bit on parameters to
simplify the logic of initializing function parameters so that we don't need
both a variable declaration and a type in FunctionArgList.  This also means
that we need to propagate the CGFunctionInfo down in a lot of places rather
than recalculating it from the FAL.  There's more we can do to eliminate
redundancy here, and I've left FIXMEs behind to do it.

llvm-svn: 127314
2011-03-09 04:27:21 +00:00
John McCall 6a014d5c30 Add a bit to ParmVarDecl indicating whether the parameter undergoes
K&R-style default argument promotion.

llvm-svn: 127313
2011-03-09 04:22:44 +00:00
NAKAMURA Takumi d3cc220d97 c-index-test.c: Fix cygwin warning not to pass signed char to islower(c).
Cygwin's ctype.h says;
/* These macros are intentionally written in a manner that will trigger
   a gcc -Wall warning if the user mistakenly passes a 'char' instead
   of an int containing an 'unsigned char'.
   (snip) */

llvm-svn: 127308
2011-03-09 03:02:28 +00:00
Ted Kremenek 2f1f023283 #include Store.h into BasicValueFactory.cpp to provide definitions of StoreRef constructor.
llvm-svn: 127291
2011-03-08 23:39:37 +00:00
Argyrios Kyrtzidis 97d3a38c3e Add 'OverridenFilesKeepOriginalName' field in SourceManager which if true the SourceManager
should report the original file name for contents of files that were overriden by other files,
otherwise it should report the name of the new file. Default is true.

Also add similar field in PreprocessorOptions and pass similar parameter in ASTUnit::LoadFromCommandLine.

llvm-svn: 127289
2011-03-08 23:35:24 +00:00
Ted Kremenek 4bb6c6b37e static analyzer: Fix use-after-free bug in RegionStore involving LazyCompoundValueData not reference counting Store objects.
llvm-svn: 127288
2011-03-08 23:18:00 +00:00
Abramo Bagnara 6111db9e9c Fixed isEmbeddedInDeclarator flag loading.
llvm-svn: 127285
2011-03-08 22:33:38 +00:00
NAKAMURA Takumi 2201582115 test/Makefile: Reapply r127079, use $(ECHOPATH) to make lit.site.cfg(s).
llvm-svn: 127284
2011-03-08 22:17:40 +00:00
NAKAMURA Takumi d24228afeb libclang/CIndexer.cpp: Apply a new API for Cygwin-1.7, instead of deprecated one.
llvm-svn: 127283
2011-03-08 22:17:33 +00:00
Anders Carlsson 3c50aea73f Make the Objective-C checker look for subclasses of NSString instead of just NSString and NSMutableString.
llvm-svn: 127268
2011-03-08 20:05:26 +00:00
Douglas Gregor 95d3e370f4 Clarify the context in which an Objective-C type name is being parsed
by using an enumeration rather than a boolean value. No functionality
change.

llvm-svn: 127259
2011-03-08 19:17:54 +00:00
Fariborz Jahanian 08891f5249 Warn on usage of unavailable objc 'class' in
varienty of cases. // rdar://9092208

llvm-svn: 127257
2011-03-08 19:12:46 +00:00
Douglas Gregor f2f0806f71 Teach libclang's token-annotation logic about context-sensitive
keywords for Objective-C+ and C++0x. 

llvm-svn: 127253
2011-03-08 17:10:18 +00:00
Abramo Bagnara ea94788cf4 Fixed source range for StaticAssertDecl and LinkageSpecDecl. Fixed source range for declarations using postfix types.
llvm-svn: 127251
2011-03-08 16:41:52 +00:00
Anders Carlsson a426705cc6 When writing file references in a pch, make sure to ask the file manager for the absolute path.
llvm-svn: 127248
2011-03-08 16:04:35 +00:00
Abramo Bagnara b5545be14b Fixed NamespaceDecl source range.
llvm-svn: 127242
2011-03-08 12:38:20 +00:00
NAKAMURA Takumi 2b7eeb2b4b lib/Basic/Targets.cpp: mingw-w64 should define __MINGW32__, too.
llvm-svn: 127238
2011-03-08 12:06:46 +00:00
Abramo Bagnara 20c9e24241 Fixed bitfields source range.
llvm-svn: 127237
2011-03-08 11:07:11 +00:00
John McCall 5c8f6c47c4 Emit block capture initializers as if they were normal initializers for a local
variable that just happens to be stored in a wierd place.

llvm-svn: 127235
2011-03-08 09:38:48 +00:00
John McCall 91ca10fe64 Extract a function to emit an arbitrary expression as if it were the initializer
for a local variable.

llvm-svn: 127227
2011-03-08 09:11:50 +00:00
Abramo Bagnara dff1930bf7 Fixed source range for all DeclaratorDecl's.
llvm-svn: 127225
2011-03-08 08:55:46 +00:00
John Wiegley b4a9e51342 Removed trailing whitespace as a test commit
llvm-svn: 127223
2011-03-08 08:13:22 +00:00
John McCall 462c055d85 Fix my earlier commit to work with escaped newlines and leave breadcrumbs
in case we want to make a world where we can check intermediate instantiations
for this kind of breadcrumb.

llvm-svn: 127221
2011-03-08 07:59:04 +00:00
John McCall ed14ad24e0 objc_gc wants a pointer type, not a function type; give it a more appropriate
diagnostic.  Also, these attributes are commonly written with macros which we
actually pre-define, so instead of expanding the macro location, refer to the
instantiation location and name it using the macro loc.

llvm-svn: 127219
2011-03-08 04:17:03 +00:00
John McCall 97c250405b Update the check for a NULL macro to use Preprocessor::getSpelling().
llvm-svn: 127217
2011-03-08 04:07:54 +00:00
John McCall cff9bcfbd3 Add an API call to retrieve the spelling data of a token from its SourceLocation.
llvm-svn: 127216
2011-03-08 04:06:57 +00:00
Douglas Gregor 6203d49b0e Detect attempts to provide a specialization of a function within a
dependent scope and produce an error (rather than crashing). Fixes PR8979.

llvm-svn: 127206
2011-03-08 02:04:14 +00:00
Carl Norum 58d489fc6e Fix tests to account for new warning "expected ';' at end of declaration list". Sorry, folks!
llvm-svn: 127188
2011-03-07 22:57:45 +00:00
Bill Wendling ec9d2633f1 When we adjust the inline ASM type, we need to take into account an early
clobber with the 'y' constraint. Otherwise, we get the wrong return type and an
assert, because it created a '<1 x i64>' vector type instead of the x86_mmx
type.

llvm-svn: 127185
2011-03-07 22:47:14 +00:00
Argyrios Kyrtzidis bc1f48f654 Allow passing '-###' to ASTUnit::LoadFromCommandLine to print out the cc1 options.
llvm-svn: 127183
2011-03-07 22:45:01 +00:00
Carl Norum a367d80763 Change diagnostic message from "Extension" to "ExtWarn" to find more problems with missing semicolons.
llvm-svn: 127177
2011-03-07 22:19:06 +00:00
Ted Kremenek 897947434e Fix null dereference in CFGBlock::FilterEdge that was reported in PR 9412.
llvm-svn: 127176
2011-03-07 22:04:39 +00:00
Devang Patel 6e40c61596 CodeGenFunction::GenerateBlockFunction() should initialize DebugInfo just like CodeGenFunction::GenerateCode()
llvm-svn: 127174
2011-03-07 21:53:18 +00:00
Argyrios Kyrtzidis 7e25a95600 g++ is more permissive regarding flexible arrays.
It will accept flexible array in union and also as the sole element of a struct/class.

Fixes rdar://9065507.

llvm-svn: 127171
2011-03-07 20:04:04 +00:00
Devang Patel d6ffebb077 DebugInfo can be enabled or disabled at function level (e.g. using an attribute). However, at module level it is determined by command line option and the state of command line option does not change during compilation. Make this layering explicit and fix accidental cases where the code generator was checking whether module has debug info enabled instead of checking whether debug info is enabled for this function or not.
llvm-svn: 127165
2011-03-07 18:45:56 +00:00
Devang Patel e65982c8c8 Do not emit stop point for CXXDefaultArgExpr. It results in suboptimial user experience.
21 int main() {
22  A a;

For example, here user would expect to stop at line 22, even if A's constructor leads to a call through CXXDefaultArgExpr.

This fixes ostream-defined.exp regression from gdb testsuite.

llvm-svn: 127164
2011-03-07 18:29:53 +00:00
Douglas Gregor db44611f2e Support explicit template specialization and instantiation for members
of a C++0x inline namespace within enclosing namespaces, as noted in
C++0x [namespace.def]p8.

Fixes <rdar://problem/9006349>, a libc++ failure where Clang was
rejected an explicit specialization of std::swap (since libc++ puts it
into an inline, versioned namespace std::__1).

llvm-svn: 127162
2011-03-07 16:54:27 +00:00
Douglas Gregor 11ddf1361d When rebuilding a dependent template specialization type to another
dependent template specialization type, make sure to set the keyword
location. Fixes some valgrind issues introduced in r127150.

llvm-svn: 127159
2011-03-07 15:13:34 +00:00
John McCall 75f9498a7c The conditional needs to be pushed before the branch. Make the test less
trivial to check this.  Adjust for style.

llvm-svn: 127151
2011-03-07 03:12:35 +00:00
Douglas Gregor 43f788f16c When transforming a dependent template specialization type, make sure
to set the source-location information for the template arguments to
the *transformed* source-location information, not the original
source-location information. Fixes <rdar://problem/8986308> (a libc++
SFINAE issue) and the Boost.Polygon failure.

llvm-svn: 127150
2011-03-07 02:33:33 +00:00
Douglas Gregor 0ec210bc88 Produce a diagnostic for unused overloaded expressions, from Faisal Vali!
llvm-svn: 127148
2011-03-07 02:05:23 +00:00
John McCall f7dcf320a7 An operator new with an empty exception specifier returns null on a bad
allocation and therefore requires a null-check.  We were doing that, but
we weren't treating the new-initializer as being conditionally executed,
which means it was possible to get ill-formed IR as in PR9298.

llvm-svn: 127147
2011-03-07 01:52:56 +00:00
Anders Carlsson 878b3e2b98 Check in the implementation as well...
llvm-svn: 127144
2011-03-07 01:28:33 +00:00
Anders Carlsson 793aff18ef Add a non-static FixupRelativePath to FileManager.
llvm-svn: 127143
2011-03-07 01:27:37 +00:00
Joerg Sonnenberger f496164ceb Redo part of r127137:
Pass down the correct C->getArgs, but keep it with the original
DerivedArgList type. Slightly adjust the MakeIndex call for the
different base type. This unbreaks the handling of --no-mangle on Darwin.

llvm-svn: 127142
2011-03-07 01:15:29 +00:00
Douglas Gregor cfee35b845 Remove the AST printer (-ast-print-xml), which is too incomplete and
too low-level to actually be useful but is just interesting enough for
people to try to use it (which won't actually work beyond toy examples).

To bring back the AST printer, it needs to be:
  - Complete, covering all of C/C++/Objective-C
  - Documented, with appropriate Schema against which we can validate
  the output
  - Designed for C/C++/Objective-C, not Clang's specific ASTs
  - Stable across Clang versions
  - Well-tested

llvm-svn: 127141
2011-03-07 01:03:30 +00:00
Joerg Sonnenberger 9c8ad5fe02 Explicitly initialize CCCIsCPP
llvm-svn: 127139
2011-03-07 00:09:32 +00:00
Joerg Sonnenberger b86f5f4106 If called as *cpp or *cpp-[^-]*, run only the preprocessor. If no
input is specified, use stdin implicitly. Based on a patch from
Roman Divacky.

llvm-svn: 127137
2011-03-06 23:31:01 +00:00
Douglas Gregor 19da4e4397 Revert r126422 "Use private linkage to avoid symbol conflicts in
corner cases like the one in PR9301." which caused PR9416. 

llvm-svn: 127136
2011-03-06 23:28:21 +00:00
Abramo Bagnara 8ec9e07ed6 Used a nicer cast.
llvm-svn: 127134
2011-03-06 22:48:24 +00:00
Anders Carlsson b5c356a4d5 Convert FileManager::FixupRelativePath over to using PathV2.
llvm-svn: 127133
2011-03-06 22:25:35 +00:00
Abramo Bagnara ead67d9b88 Improved type source location for long long type.
llvm-svn: 127132
2011-03-06 22:21:56 +00:00
NAKAMURA Takumi 3b78ef47fe test/PCH/headersearch.cpp: Tweak for Windows hosts especially cygming.
This test requires shell feature, to change working directory.
On Windows, current directory cannot be moved nor removed.

llvm-svn: 127130
2011-03-06 20:44:33 +00:00
Douglas Gregor 528ad93924 We may fail to map a declaration in a template to its instantiated
declaration because of interesting ordering dependencies while
instantiating a class template or member class thereof. Complain,
rather than asserting (+Asserts) or silently rejecting the code
(-Asserts).

Fixes the crash-on-invalid in PR8965. 

llvm-svn: 127129
2011-03-06 20:12:45 +00:00
Douglas Gregor d9bb152821 Fix driver for thumb-capable ARM hosts, from Mikko Lehtonen!
llvm-svn: 127128
2011-03-06 19:11:49 +00:00
Douglas Gregor c81a7a2591 Rename the type argument for the iboutletcollection attribute to not
conflict with MinGW headers, from Kirk Beitz!

llvm-svn: 127127
2011-03-06 18:55:32 +00:00
Anders Carlsson 9bb83e85b8 Write CXX base specifier offsets for chained ASTs.
llvm-svn: 127126
2011-03-06 18:41:18 +00:00
Anders Carlsson 80756f6240 When serializing a DeclRefExpr, always store the number of explicit template
arguments at the same offset, since it's needed when creating the empty
DeclRefExpr when deserializing. Fixes a memory corruption issue that would lead
to random bugs and crashes.

llvm-svn: 127125
2011-03-06 18:19:42 +00:00
Douglas Gregor 189c0e8923 Add MinGW GCC 4.5.2 include paths, from Matthieu Monrocq
llvm-svn: 127124
2011-03-06 18:00:59 +00:00
Douglas Gregor 69735112d0 Fix copy-and-paste typo in the transformation of Microsoft __uuidof expressions, from Eric Niebler via John Wiegley
llvm-svn: 127123
2011-03-06 17:40:41 +00:00
Douglas Gregor 71a2f72f1f xpose HeaderSearch::SearchDirs to tools,s, from Paul Holden
llvm-svn: 127122
2011-03-06 17:33:53 +00:00
Anders Carlsson 829c4134b8 Correctly unwrap 'auto' types. Fixes PR9414.
llvm-svn: 127121
2011-03-06 16:43:04 +00:00
Abramo Bagnara 5022863fd8 Completed source ranges fixes for all classes inheriting from TypeDecl.
llvm-svn: 127120
2011-03-06 16:09:14 +00:00
Abramo Bagnara b3185b00c5 Fixed TypedefDecl and TemplateTypeParameter source range.
llvm-svn: 127119
2011-03-06 15:48:19 +00:00
Sebastian Redl 7c6c9e971c Reinstate r127112, "Propagate new-style exception spec information to ExtProtoInfo.", this time with the missing header.
llvm-svn: 127118
2011-03-06 10:52:04 +00:00
Douglas Gregor d99609ae48 When performing template argument deduction for a non-reference
conversion function when we're binding the result to a reference, drop
cv-qualifiers on the type we're referring to, since we should be
deducing a type that can be adjusted (via cv-qualification) to the
requested type. Fixes PR9336, and the remaining Boost.Assign failure.

llvm-svn: 127117
2011-03-06 09:03:20 +00:00
NAKAMURA Takumi c92335a87c Revert r127112, "Propagate new-style exception spec information to ExtProtoInfo."
It seems missing "clang/Basic/ExceptionSpecificationType.h".

llvm-svn: 127115
2011-03-06 00:17:36 +00:00
Sebastian Redl 69d37125a9 Propagate new-style exception spec information to ExtProtoInfo.
llvm-svn: 127112
2011-03-05 22:42:26 +00:00
Sebastian Redl 802a45332a Propagate new-style exception spec information to Declarator.
llvm-svn: 127111
2011-03-05 22:42:13 +00:00
Benjamin Kramer 01afbf57dc Revert r127079: "test/Makefile: Use $(ECHOPATH) to make lit.site.cfg(s)."
It depends on LLVM r127073 that was reverted and is now blocking "make test"

llvm-svn: 127109
2011-03-05 20:57:36 +00:00
Douglas Gregor 9d9f8db4bc When substituting in for a template name, do not produce a qualified
template name as the result of substitution. The qualifier is handled
separately by the tree transformer, so we would end up in an
inconsistent state.

This is actually the last bit of PR9016, and possibly also fixes
PR8965. It takes Boost.Icl from "epic fail" down to a single failure.

llvm-svn: 127108
2011-03-05 20:06:51 +00:00
Abramo Bagnara 1c3af96724 Fixed LabelDecl source range and cleaned creation code.
llvm-svn: 127094
2011-03-05 18:21:20 +00:00
Douglas Gregor 43669f84ed When determining template instantiation arguments within a function
template (not a specialization!), use the "injected" function template
arguments, which correspond to the template parameters of the function
template. This is required when substituting into the default template
parameters of template template parameters within a function template.

Fixes PR9016.

llvm-svn: 127092
2011-03-05 17:54:25 +00:00
Douglas Gregor 20bf98b5f8 When transforming a substituted template type parameter, try to
transform the type that replaces the template type parameter. In the
vast majority of cases, there's nothing to do, because most template
type parameters are replaced with something non-dependent that doesn't
need further transformation. However, when we're dealing with the
default template arguments of template template parameters, we might
end up replacing a template parameter (of the template template
parameter) with a template parameter of the enclosing template. 
 
This addresses part of PR9016, but not within function
templates. That's a separate issue.

llvm-svn: 127091
2011-03-05 17:19:27 +00:00
Anton Korobeynikov a9ff8576fb Normalize target triple passed out of driver. Basically this means
that at cc1 level we will always have normalized triple and thus can
provide necessary default based on e.g. environment value (e.g. for
"arm-eabi" triple, etc.)

llvm-svn: 127087
2011-03-05 16:05:17 +00:00
Sebastian Redl 965b0e3106 Parser support for noexcept specifications.
llvm-svn: 127086
2011-03-05 14:45:16 +00:00
Abramo Bagnara 5093578471 Improved MemberPointerType source locations.
llvm-svn: 127085
2011-03-05 14:42:21 +00:00
Benjamin Kramer 0cd19fbfdf StringRefify.
llvm-svn: 127082
2011-03-05 13:45:23 +00:00
NAKAMURA Takumi 70f5be634a test/lit.cfg: bash is available on MSYS.
llvm-svn: 127080
2011-03-05 11:16:06 +00:00
NAKAMURA Takumi 7249bbcbc9 test/Makefile: Use $(ECHOPATH) to make lit.site.cfg(s).
llvm-svn: 127079
2011-03-05 11:16:01 +00:00
NAKAMURA Takumi 98835748e3 test/CodeGen/2008-07-17-no-emit-on-error.c: Use LLVM's opt instead of "test(1)" for Mingw MSYS.
Mingw MSYS does not have test.exe (only shell built-in test), and is not capable to invoke test(1) from utils/not.

llvm-svn: 127078
2011-03-05 11:15:55 +00:00
NAKAMURA Takumi fb7133249c test: Mark 3 tests as XFAIL:cygwin,mingw.
llvm-svn: 127077
2011-03-05 11:15:48 +00:00
NAKAMURA Takumi 7362afad29 test: Mark two tests as XFAIL:mingw.
llvm-svn: 127076
2011-03-05 11:15:38 +00:00
Matt Beaumont-Gay f8bb45f14d Much to my surprise, OverloadExprs can also point to function template decls.
llvm-svn: 127061
2011-03-05 02:42:30 +00:00
Douglas Gregor 250ffb1fcb When we're deserializing a template parameter declaration, temporarily
use the translation unit as its declaration context, then deserialize
the actual lexical and semantic DeclContexts after the template
parameter is complete. This avoids problems when the DeclContext
itself (e.g., a class template) is dependent on the template parameter
(e.g., for the injected-class-name).

llvm-svn: 127056
2011-03-05 01:35:54 +00:00
Argyrios Kyrtzidis 11e6f0a6c3 Currently we can only remap a file by creating a MemoryBuffer and replacing the file contents with it.
Allow remapping a file by specifying another filename whose contents should be loaded if the original
file gets loaded. This allows to override files without having to create & load buffers in advance.

llvm-svn: 127052
2011-03-05 01:03:53 +00:00
Argyrios Kyrtzidis 4954bc1d9d Introduce OwnsRemappedFileBuffers field in ASTUnit, indicating whether the ASTUnit should delete the remapped buffers.
llvm-svn: 127051
2011-03-05 01:03:48 +00:00
Nick Lewycky 6cee6ff3f0 Give warnings about static initializers of non-integral type their own warning
flag so it can be individually controlled. The new flag is
  -Wc++0x-static-nonintegral-init.

llvm-svn: 127050
2011-03-05 00:32:47 +00:00
Douglas Gregor 550b98b1c5 When diagnostics are suppressed (e.g., because of code completion), don't trigger the ExprTemplates.empty() check at the end of a function body
llvm-svn: 127046
2011-03-04 23:08:02 +00:00
Douglas Gregor 93ded32026 Diagnose destructor templates. Fixes PR7904.
llvm-svn: 127042
2011-03-04 22:45:55 +00:00
Douglas Gregor 4cf85a725a When clearing a LookupResult structure, clear out the naming class,
too. Fixes PR7900.

While I'm in this area, improve the diagnostic when the type being
destroyed doesn't match either of the types we found.

llvm-svn: 127041
2011-03-04 22:32:08 +00:00
Bill Wendling 6c9540e92b Initialize variable.
llvm-svn: 127039
2011-03-04 21:46:03 +00:00
Douglas Gregor 8b6070bb9d Teach Sema::ActOnCXXNestedNameSpecifier and Sema::CheckTemplateIdType
to cope with non-type templates by providing appropriate
errors. Previously, we would either assert, crash, or silently build a
dependent type when we shouldn't. Fixes PR9226.

llvm-svn: 127037
2011-03-04 21:37:14 +00:00
Douglas Gregor 8c2d3f4248 After an error of any kind has occurred, don't assert when attempting
to find the instantiated declaration within a template instantiation
fails to do so. It's likely that the original instantiation got
dropped due to instantiation failures, which doesn't actually break
the invariants of the AST. This eliminates a number of
crash-on-invalid failures, e.g., PR9300.

llvm-svn: 127030
2011-03-04 20:42:52 +00:00
Douglas Gregor 55e6b31511 Patch up several Sema::FindInstantiatedDecl() callers, so that they'll
properly cope with NULL return values.

llvm-svn: 127024
2011-03-04 19:46:35 +00:00
Devang Patel d3a6b0f184 Emit a stop point before a call expression so that debugger has some chance of getting some footing when user wants to stop at 2nd bar() in following expression when all function calls are inlined.
= bar() + ... + bar() + ...

clang keeps track of column numbers, so we could put location entries for all subexpressions but that will significantly bloat debug info in general, but a location for call expression is helpful here.

llvm-svn: 127018
2011-03-04 18:54:42 +00:00
Douglas Gregor 23648d7e3b When constructing source-location information for a
DependentTemplateSpecializationType during tree transformation, retain
the NestedNameSpecifierLoc as it was used to translate the template
name, rather than reconstructing it from the template name.

Fixes PR9401.

llvm-svn: 127015
2011-03-04 18:53:13 +00:00
Douglas Gregor 3c41bf740f *Recursively* set the context of a template parameter, so that we also
capture the template parameters of template template parameters.

llvm-svn: 127012
2011-03-04 18:32:38 +00:00
Douglas Gregor fd7c225530 Make sure to put template parameters into their owning template's
DeclContext once we've created it. This mirrors what we do for
function parameters, where the parameters start out with
translation-unit context and then are adopted by the appropriate
DeclContext when it is created. Also give template parameters public
access and make sure that they don't show up for the purposes of name
lookup.

Fixes PR9400, a regression introduced by r126920, which implemented
substitution of default template arguments provided in template
template parameters (C++ core issue 150).

How on earth could the DeclContext of a template parameter affect the
handling of default template arguments?

I'm so glad you asked! The link is
Sema::getTemplateInstantiationArgs(), which determines the outer
template argument lists that correspond to a given declaration. When
we're instantiating a default template argument for a template
template parameter within the body of a template definition (not it's
instantiation, per core issue 150), we weren't getting any outer
template arguments because the context of the template template
parameter was the translation unit. Now that the context of the
template template parameter is its owning template, we get the
template arguments from the injected-class-name of the owning
template, so substitution works as it should.

llvm-svn: 127004
2011-03-04 17:52:15 +00:00
Abramo Bagnara b9893d66bc Fixed source range for function template specializations.
template <class T> void foo();
template <> void foo<int>(); /* Spec 1 */
template <> void foo<int>(); /* Spec 2 */

If we look at the main location of the first explicit specialization (Spec 1) it can be seen that it points to the name of the *second* explicit specialization (Spec 2), which is a redeclaration of Spec1.
Hence, the source range obtained for Spec1 is not only inaccurate, but also invalid (the end location comes before the start location).

llvm-svn: 127002
2011-03-04 17:20:30 +00:00