Commit Graph

21348 Commits

Author SHA1 Message Date
John McCall cbc038a6c3 ANSI C requires that a call to an unprototyped function type succeed
if the definition has a non-variadic prototype with compatible
parameters.  Therefore, the default rule for such calls must be to
use a non-variadic convention.  Achieve this by casting the callee to
the function type with which it is required to be compatible, unless
the target specifically opts out and insists that unprototyped calls
should use the variadic rules.  The only case of that I'm aware of is
the x86-64 convention, which passes arguments the same way in both
cases but also sets a small amount of extra information;  here we seek
to maintain compatibility with GCC, which does set this when calling
an unprototyped function.

Addresses PR10810 and PR10713.

llvm-svn: 140241
2011-09-21 08:08:30 +00:00
Francois Pichet 3b4de99158 [microsoft] Move missing typename warning from -fms-extensions to -fms-compatibility. Also allow the missing typename warning at function scope.
llvm-svn: 140240
2011-09-21 07:59:49 +00:00
Benjamin Kramer 5ce7f109cf Fix MSVC9 build by providing a full comparator object to lower_bound.
llvm-svn: 140238
2011-09-21 06:42:26 +00:00
Richard Trieu cf24656ea4 Change:
assert(!"error message");

To:

  assert(0 && "error message");

which is more consistant across the code base.

llvm-svn: 140232
2011-09-21 02:50:14 +00:00
Richard Trieu e4f3180fec Change "ivar" to true for a boolean function argument. Since string literals are cast to true, this should no effect on behavior.
llvm-svn: 140231
2011-09-21 02:46:06 +00:00
Akira Hatanaka 94ab554749 Add case labels for Mips64 architectures.
llvm-svn: 140226
2011-09-21 02:13:07 +00:00
Anna Zaks 15ca5e7a21 [analyzer] Fix a bug where PathDiagnosticLocation did not generate a valid range and add asserts to check validity of locations early on. Ignore invalid ranges in PathDiagnosticPiece (they could be added by checker writers).
Addresses radar://10124836 and radar://radar10102244.

llvm-svn: 140218
2011-09-21 00:35:58 +00:00
Argyrios Kyrtzidis 712512bb36 [ARC] Allow forming 'id*' in an unevaluated context. Fixes rdar://10148540.
llvm-svn: 140212
2011-09-20 23:49:22 +00:00
Argyrios Kyrtzidis b573542e10 [PCH] Don't store the source range for each preprocessed entity since
we already have the range in the PPEntityOffsets array.

llvm-svn: 140209
2011-09-20 23:27:41 +00:00
Argyrios Kyrtzidis 86ec600f57 [PCH] Merge ASTReader::LoadPreprocessedEntity with ReadPreprocessedEntity
and don't store the ID for each preprocessed entity.

llvm-svn: 140208
2011-09-20 23:27:38 +00:00
Argyrios Kyrtzidis 45e8cf5732 [libclang] When pointing at a macro expansion inside a macro argument,
return a cursor for the inner macro.

llvm-svn: 140207
2011-09-20 23:27:33 +00:00
Anna Zaks d70da08160 [analyzer] Refactor PathDiagnosticLocation: Remove SourceRange member from PathDiagnosticLocation - FullSourceLoc Loc and PathDiagnosticRange Range are sufficient.
llvm-svn: 140206
2011-09-20 23:27:32 +00:00
Anna Zaks 6800ab437c [analyzer] Remove dead code. (This code is trying to implement the idea that PathDiagnosticClient could implement DiagnosticClient and has been dead for a while).
llvm-svn: 140198
2011-09-20 22:30:48 +00:00
Argyrios Kyrtzidis 7c2b28a16f In SourceManager::translateLineCol, handle the case where we are pointing
directly at the end of the source file.

llvm-svn: 140192
2011-09-20 22:14:54 +00:00
Argyrios Kyrtzidis 0d48fb89c0 The location of the name in MacroDefinition is the beginning of its range,
don't store an extra location for it.

llvm-svn: 140190
2011-09-20 22:14:48 +00:00
Francois Pichet b3642c2c7a Move Microsoft access specifier bug emulation from -fms-extensions to -fm-compatibility.
llvm-svn: 140189
2011-09-20 22:08:26 +00:00
Bob Wilson 3e42bc55db For i386 kext fallback to llvm-gcc, search paths for several Darwin versions.
This replaces the hack to read UNAME_RELEASE from the environment when
identifying the OS version on Darwin, and it's more flexible.  It's also
horribly ugly, but at least this consolidates the ugliness to touch less of
the code so that it will be easier to rip out later.

llvm-svn: 140187
2011-09-20 22:00:38 +00:00
Anna Zaks c29bed3989 [analyzer] Refactor PathDiagnosticLocation: Make PathDiagnosticLocation(SourceLocation...) private. Most of the effort here goes to making BugReport refer to a PathDiagnosticLocation instead of FullSourceLocation.
(Another step closer to the goal of having Diagnostics which can recover from invalid SourceLocations.)

llvm-svn: 140182
2011-09-20 21:38:35 +00:00
Anna Zaks b2dfc2b7be [analyzer] Refactor PathDiagnosticLocation: Use the pre-computed Range and Location for profile.
llvm-svn: 140180
2011-09-20 21:25:00 +00:00
Chad Rosier d3a0f954a3 [driver] Default to arm mode when using the integrated assembler.
rdar://10125227

llvm-svn: 140179
2011-09-20 20:44:06 +00:00
Richard Trieu 02e25db543 Fix a problem in digraph handling where "[:" might be treated as "<::" and
erronously trigger the digraph correction fix-it.  Include a new test to catch
this in the future.

llvm-svn: 140175
2011-09-20 20:03:50 +00:00
Akira Hatanaka bef1745c9c Define Mips64 TargetInfo classes.
llvm-svn: 140174
2011-09-20 19:21:49 +00:00
Akira Hatanaka f6da331e15 Clean up TargetInfo class hierarchy. Define a base class from which TargetInfos
of Mips32 big and little endian derive.

llvm-svn: 140170
2011-09-20 19:00:23 +00:00
Akira Hatanaka ec11b4fa5a Create a MipsTargetCodeGenInfo object for mips64/mips64el. The size of the
UnwindException structure is 32 for mips64. 

llvm-svn: 140165
2011-09-20 18:30:57 +00:00
Anna Zaks 83128bc101 [analyzer] Refactor PathDiagnosticLocation: Use PointerUnion of LocationContext and AnalysisContext to support creation of PathDiagnosticLocations for checkers which no context sensitivity.
llvm-svn: 140162
2011-09-20 18:23:52 +00:00
Akira Hatanaka 0486db08bd Add a parameter to MipsTargetCodeGenInfo's constructor.
llvm-svn: 140161
2011-09-20 18:23:28 +00:00
Douglas Gregor 75644d5729 Introduce an egregious hack for modules to cope with headers that come
from unfriendly (== not at all modularized) directories. This is
temporary, and it only affects module construction until I'll figured
out how to deal with system headers.

llvm-svn: 140159
2011-09-20 18:13:03 +00:00
Eric Christopher 5507159245 Remove __WCHAR_UNSIGNED__ and anything that used it.
llvm-svn: 140155
2011-09-20 18:05:01 +00:00
DeLesley Hutchins 08e094aee3 Test commit
llvm-svn: 140149
2011-09-20 17:25:59 +00:00
Anna Zaks de03d72a7b [analyzer] Refactor PathDiagnosticLocation: Lazily query LocationContext for a ParentMap as needed.
llvm-svn: 140147
2011-09-20 16:37:36 +00:00
Anna Zaks 22fec1c4d9 [analyzer] Remove LocationContext and a dependency from PathDiagnosticLoaction.
llvm-svn: 140146
2011-09-20 16:23:37 +00:00
Ivan Krasin 96a806199d Clarify PNaCl target characteristics: set LongDoubleWidth, PtrDiffType, IntPtrType,
change __builtin_va_list to from a structure to int[4] (same alignment
and size, but with a simpler representation). Patch by David Meyer!

llvm-svn: 140144
2011-09-20 14:56:54 +00:00
Peter Collingbourne 9a8f1534d9 Remove redundant break statements, and replace asserts with llvm_unreachable
Per John's review comments for r140068.

llvm-svn: 140142
2011-09-20 12:40:26 +00:00
Chandler Carruth 9a797578dc Fix a pretty nasty bug in noreturn destructors that cascaded into lots
of false positive warnings that depend on noreturn destructors pruning
the CFGs, but only in C++0x mode!

This was really surprising as the debugger quickly reveals that the
attributes are parsed correctly (and using the same code) in both modes.
The warning fires in the same way in both modes. But between parsing and
building the destructor declaration with the noreturn attribute and the
warning, it magically disappears. The key? The 'noexcept' appears!

When we were rebuilding the destructor type with the computed implicit
noexcept we completely dropped the old type on the floor. This almost
makes sense (as the arguments and return type to a destructor aren't
exactly unpredictable), but lost any function type attributes as well.
The fix is simple, we build the new type off of the old one rather than
starting fresh.

Testing this is a bit awkward. I've done it by running the
noreturn-sensitive tests in both modes, which previous failed and now
passes, but if anyone has ideas about how to more specifically and
thoroughly test that the extended info on a destructor is preserved when
adding noexcept, I'm all ears.

llvm-svn: 140138
2011-09-20 04:55:26 +00:00
Anna Zaks 745486a5da [analyzer] Refactor PathDiagnosticLocation: Pre-compute Range and Location with gen methods on object creation instead of computing on demand. This would allow to remove dependency on the other members which help with construction and might not even be valid at later stages (to be removed later on).
llvm-svn: 140131
2011-09-20 01:51:40 +00:00
Anna Zaks de8c5eddb9 [analyzer] Use more create methods in the PathDiagnostic, cleanup.
llvm-svn: 140130
2011-09-20 01:38:47 +00:00
Bill Wendling 5d7469e3e4 Don't assume that the clause is a GlobalVariable. It could be a constant.
llvm-svn: 140123
2011-09-20 00:40:19 +00:00
Anna Zaks 6e76384c82 [analyzer] BugReport has a profile method, so reuse it here.
llvm-svn: 140100
2011-09-19 23:44:31 +00:00
Anna Zaks c2b3c1f14b [analyzer] Constify a method.
llvm-svn: 140091
2011-09-19 23:17:48 +00:00
Eli Friedman 6b9c41ea68 Add list initialization for complex numbers in C. Essentially, this allows "_Complex float x = {1.0f, 2.0f};". See changes to docs/LanguageExtensions.html for a longer description.
<rdar://problem/9397672>.

llvm-svn: 140090
2011-09-19 23:17:44 +00:00
Bill Wendling 58e58fead1 The eh.selector intrinsic isn't used anymore. Replace the check here with a
check for the landingpad instruction instead. This check looks at each of the
clauses in the landingpad instruction. If it's a catch clause, it compares the
name directly with the global. If it's a filter clause, it has to look through
each value in the filer to see if any have the prefix.

llvm-svn: 140075
2011-09-19 22:08:36 +00:00
Argyrios Kyrtzidis a35c4441b3 Fix gcc build.
llvm-svn: 140073
2011-09-19 22:02:08 +00:00
Peter Collingbourne 2dbb708b8a OpenCL: introduce support for function scope __local variables
llvm-svn: 140068
2011-09-19 21:14:35 +00:00
Argyrios Kyrtzidis 5733271925 In libclang, when visiting preprocessed entities in a source range, use
PreprocessingRecord's getPreprocessedEntitiesInRange.

Also remove all the stuff that were added in ASTUnit that are unnecessary now
that we do a binary search for preprocessed entities and deserialize only
what is necessary.

llvm-svn: 140063
2011-09-19 20:40:48 +00:00
Argyrios Kyrtzidis 7f44836998 Introduce local_begin()/local_end() methods in PreprocessingRecord which
return iterators for local, non-loaded, preprocessed entities.

llvm-svn: 140062
2011-09-19 20:40:42 +00:00
Argyrios Kyrtzidis 27bf76d6d2 In CodeGenAction::ExecuteAction() use SourceManager::translateFileLineCol()
instead of getLocation() since we don't care about expanded macro arguments.

llvm-svn: 140061
2011-09-19 20:40:38 +00:00
Argyrios Kyrtzidis 7c06d8666b [libclang] When getting a source location from a file:line:col triplet
check whether the requested location points inside the precompiled preamble,
in which case the returned source location will be a "loaded" one.

llvm-svn: 140060
2011-09-19 20:40:35 +00:00
Argyrios Kyrtzidis 532c5196b0 Break SourceManager::translateFileLineCol into translateLineCol that returns the
source location of line:col of a specific FileID.

llvm-svn: 140059
2011-09-19 20:40:29 +00:00
Argyrios Kyrtzidis 64f6381097 Introduce PreprocessingRecord::getPreprocessedEntitiesInRange()
which will do a binary search and return a pair of iterators
for preprocessed entities in the given source range.

Source ranges of preprocessed entities are stored twice currently in
the PCH/Module file but this will be fixed in a subsequent commit.

llvm-svn: 140058
2011-09-19 20:40:25 +00:00
Argyrios Kyrtzidis e6e67deeed Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.
It already works (and is useful with) macro locs as well.

llvm-svn: 140057
2011-09-19 20:40:19 +00:00