Commit Graph

933 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 7f6b029c4e Introduce SourceManager::getFileLoc which returns a file location
taking into account macro arguments.

llvm-svn: 141771
2011-10-12 07:07:40 +00:00
Richard Smith 4dd85d6fa1 Add a -Wc++0x-compat warning for C++11 keywords used as identifiers when in
C++98 mode. Only the first occurrence of each keyword will produce a warning.

llvm-svn: 141700
2011-10-11 19:57:52 +00:00
David Meyer bfdbb25af2 Allow regparm attribute for PNaCl target
llvm-svn: 141638
2011-10-11 03:12:01 +00:00
Lang Hames 4f4aa1a03a Fixed natural stack alignment for Linux x86-32. Thanks Eli.
llvm-svn: 141617
2011-10-11 00:52:51 +00:00
Lang Hames 60b2b2ee0d Update target data strings for ARM and X86 to include the natural stack
alignment parameter "S<size>" that was introduced in r141599.

llvm-svn: 141601
2011-10-10 23:44:43 +00:00
Eli Friedman 1f19100451 Add address spaces for TCE target. Patch by Pekka Jääskeläinen.
llvm-svn: 141390
2011-10-07 19:51:42 +00:00
Daniel Dunbar 2fba0979fe Basic/Diagnostics: Apparently, #pragma ... diagnostic is intended to override
the command line options (at least according to GCC's documentation). GCC 4.2
didn't appear to actually do this, but it seems like that has been fixed in
later release, so we will follow the docs.

llvm-svn: 141119
2011-10-04 21:17:24 +00:00
Argyrios Kyrtzidis 25029d499e Make sure SourceManager::getFileIDLoaded doesn't hang in release build because of invalid passed parameter.
rdar://10210140

llvm-svn: 141048
2011-10-03 23:43:01 +00:00
Justin Holewinski 794c205e52 PTX: Add some basic support for OpenCL address spaces
llvm-svn: 141008
2011-10-03 17:28:37 +00:00
Daniel Dunbar 866fcd34a6 Basic/Diagnostic: Kill off a few unnecessary functions now that refactoring is done, and add a note that the new setDiagnosticGroup{...} methods only operate on the current diagnostic state.
llvm-svn: 140771
2011-09-29 02:03:01 +00:00
Daniel Dunbar 58d0af6c5f Basic/Diagnostics: Rewrite DiagnosticIDs::getDiagnosticLevel completely to be straighter line code, use the new DiagnosticMappingInfo flags, and eliminate the odd MAP_WARNING_NO_WERROR and friend mappings.
- This fixes a host of obscure bugs with regards to how warning mapping options composed with one another, and I believe makes the code substantially easier to read and reason about.

llvm-svn: 140770
2011-09-29 01:58:05 +00:00
Daniel Dunbar fffcf21cf2 Basic/Diagnostics: Add three explicit bits to DiagnosticMappingInfo to track "no-warning-as-error", "no-error-as-fatal", and "show-in-system-header", and update DiagnosticsEngine::setDiagnosticGroup{WarningAsError,ErrorAsFatal} and GetDefaultDiagMappingInfo to set them appropriately.
- No actual functionality change for now, we still also use the diag::Mapping::{MAP_WARNING_NO_ERROR,MAP_ERROR_NO_FATAL,MAP_WARNING_SHOW_IN_SYSTEM_HEADER} for a little while longer.

llvm-svn: 140768
2011-09-29 01:52:06 +00:00
Daniel Dunbar d908c12db8 Basic/Diagnostics: Add a DiagnosticIDs::getDiagnosticsInGroup method, and use
that in DiagnosticEngine instead of the convoluted calling into DiagnosticIDs
which then calls back into the DiagnosticsEngine.

llvm-svn: 140766
2011-09-29 01:47:16 +00:00
Daniel Dunbar e8c12a2979 Basic/Diagnostic: Add a DiagSate::getOrAddMappingInfo method.
- Also, spell const_iterator as const_iterator.

llvm-svn: 140765
2011-09-29 01:42:25 +00:00
Daniel Dunbar 458edfa2b7 Basic/Diagnostics: Move setDiagnosticMapping() to using DiagnosticMappingInfo
and eliminate setDiagnosticMappingInternal.

llvm-svn: 140763
2011-09-29 01:34:47 +00:00
Daniel Dunbar a3637e6894 Basic/Diagnostics: Add a DiagnosticMappingInfo helper class, and switch to
storing mappings with that instead of straying some magic constants about the
source.

llvm-svn: 140760
2011-09-29 01:30:00 +00:00
Daniel Dunbar 9c78496d51 Basic/Diagnostics: Eliminate getDiagnosticMappingInfo method, which wasn't worth methodizing.
llvm-svn: 140759
2011-09-29 01:25:14 +00:00
Daniel Dunbar 400e7e3b39 Basic/Diagnostic: Eliminate the extra "mapping" out-parameter now that I killed the sole client.
llvm-svn: 140756
2011-09-29 01:20:28 +00:00
Daniel Dunbar aa11138543 Basic/Diagnostics: Add an isDefaultMappingAsError method, and switch TextDiagnosticPrinter to use that instead of extracting the current mapping via getDiagnosticLevel, which fixes one class of corner cases w.r.t. printing the "-Werror" diagnostic option marker.
- The TextDiagnosticPrinter code is still fragile as it is just "reverse engineering" what the diagnostic engine is doing. Not my current priority to fix though.

llvm-svn: 140752
2011-09-29 01:01:08 +00:00
Daniel Dunbar c2e5ca6e50 Basic/Diagnostic: Factor out
DiagnosticsEngine::setDiagnosticGroup{ErrorAsFatal,WarningAsError} methods which
more accurately model the correct API -- no internal change to the diagnostics
engine yet though.
 - Also, stop honoring -Werror=everything (etc.) as a valid (but oddly behaved) option.

llvm-svn: 140747
2011-09-29 00:53:47 +00:00
Daniel Dunbar 6de48ee860 Basic/Diagnostics: Split out the default warning "no-Werror" and
"show-in-system-header" bits, which is part of teasing them apart from the
diagnostic mapping kind.

llvm-svn: 140742
2011-09-29 00:34:06 +00:00
Chandler Carruth 3270e2619e Fix a typo spotted by Jonathan Sauer.
llvm-svn: 140708
2011-09-28 18:17:30 +00:00
Chandler Carruth 7d8241cf4f Attempt to silence the GCC -Wreturn-type warning...
llvm-svn: 140693
2011-09-28 10:49:06 +00:00
Chandler Carruth cd99bad4ac Generate tests for all of the x86 SIMD instruction feature set
predefines based on the output of GCC as well as the CPU predefines.

Invert tests for __AVX__, Clang's AVX feature is hard coded off still.

Switch Atom from 'SSE3' to 'SSSE3'. This matches GCC's behavior, Intel's
documentation, and ICC's documentation (such as I could dig up).

Switch Athlon and Geode to enable 3dnowa rather than just 3dnow and
nothing (resp.).

llvm-svn: 140692
2011-09-28 10:36:46 +00:00
Chandler Carruth 5d0feef373 Fix a think-o on my part that got enshrined in a FIXME by setting up the
__tune_...__ define as well.

llvm-svn: 140690
2011-09-28 09:54:11 +00:00
Chandler Carruth 3f7ed950fd Move some of the defines down to more natural locations, consolidating
the target identifying macros at the top, including subtarget macros.

llvm-svn: 140689
2011-09-28 09:54:07 +00:00
Chandler Carruth 6e20c2bd35 Teach Clang to reject 32-bit only CPUs when compiling in 64-bit mode.
Add 64-bit preprocessor macro tests.

llvm-svn: 140688
2011-09-28 09:45:08 +00:00
Chandler Carruth df5f48ac99 Simplify the control flow for predefined macro selection by using
fallthrough now that we're working with a switch. Also remove a dubious
"feature" regarding k6 processors and 3dnow and leave a fixme... Not
that anyone is likely to care about correct tuning for k6 processors
with and w/o 3dnow...

llvm-svn: 140687
2011-09-28 09:45:05 +00:00
Chandler Carruth 212334f7ab Switch the X86TargetInfo object from a string representation of the
selected CPU model to the enumeration. This parses the string
representation once using a StringSwitch on SetCPU. It returns an error
for strings which are not recognized (yay!). Finally it replaces
ridiculous if-chains with switches that cover all enumerators.

The last change required adding several missing entries to the features
function. These were obvious on inspection. Yay for a pattern that gives
warnings when we miss one.

No new test cases yet, as I want to get the 64-bit errors working first.
I'll then start fleshing out the testing more. Currently I'm primarily
testing on Linux, but I'm hoping check whether there are interesting
differences on darwin before long...

llvm-svn: 140685
2011-09-28 08:55:37 +00:00
Chandler Carruth 3ac7aeaacb Introduce an enumeration for the x86 CPUs recognized by Clang. I've
tried to give these nice doxyments, but if I've gotten any of my history
wrong, please chime in.

llvm-svn: 140684
2011-09-28 08:55:34 +00:00
Chandler Carruth 8bdcf9ea12 Clean up a bit of the uses of CPU in the TargetInfo classes. This makes
it an error if a CPU is provided for a target that doesn't implement
logic handling CPU settings, to match the ABI settings. It also removes
the CPU parameter from the getDefaultFeatures method. This parameter was
always filled in with the same value as setCPU was called with, and at
this point every single target implementation that referenced the CPU
within this function has needed to store the CPU via setCPU anyways in
order to implement other interface points.

llvm-svn: 140683
2011-09-28 05:56:05 +00:00
Chandler Carruth 5ac1e8e6b1 Begin fixing Clang's predefined macros for various architectures. This
is *very* much a WIP that I'll be refining over the next several
commits, but I need to get this checkpoint in place for sanity.

This also adds a much more comprehensive test for architecture macros,
which is roughly generated by inspecting the behavior of a trunk build
of GCC. It still requires some massaging, but eventually I'll even check
in the script that generates these so that others can use it to append
more tests for more architectures, etc.

Next up is a bunch of simplification of the Targets.cpp code, followed
by a lot more test cases once we can reject invalid architectures.

llvm-svn: 140673
2011-09-28 02:59:25 +00:00
Argyrios Kyrtzidis 04a6e5f82e Break SourceManager::translateFileLineCol into translateFile, no functionality change.
llvm-svn: 140610
2011-09-27 17:22:25 +00:00
Argyrios Kyrtzidis 4bdd6aa198 Associate the macro arguments location map with a FileID instead
of a ContentCache, since multiple FileIDs can have the same ContentCache
but the expanded macro arguments locations will be different.

llvm-svn: 140521
2011-09-26 08:01:50 +00:00
David Blaikie b5784324b3 Rename DiagnosticInfo to Diagnostic as per issue 5397
llvm-svn: 140493
2011-09-26 01:18:08 +00:00
David Blaikie e2eefaecc8 Rename DiagnosticClient to DiagnosticConsumer as per issue 5397
llvm-svn: 140479
2011-09-25 23:39:51 +00:00
David Blaikie 9c902b5502 Rename Diagnostic to DiagnosticsEngine as per issue 5397
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
David Blaikie 76bd3c80d4 Fix missing includes for llvm_unreachable
llvm-svn: 140368
2011-09-23 05:35:21 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Justin Holewinski 0542df5198 PTX: Clean up target options code
llvm-svn: 140320
2011-09-22 17:57:40 +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
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
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
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 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
Argyrios Kyrtzidis b4199b659b For SourceManager::isBeforeInTranslationUnit, a location pointing
inside a macro argument should be regarded as coming before
the location of the expanded tokens.

llvm-svn: 140053
2011-09-19 20:39:57 +00:00
Francois Pichet 0706d203cf Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag.
Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag.

llvm-svn: 139987
2011-09-17 17:15:52 +00:00
Douglas Gregor 8455e76fa1 Teach LangOptions::resetNonModularOptions to actually do what it says it does
llvm-svn: 139791
2011-09-15 14:56:27 +00:00