summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* -Wpragma-pack: add an additional note and fixit when warningAlex Lorenz2017-07-311-1/+15
| | | | | | | | | | about unterminated push directives that are followed by a reset ('#pragma pack()') This has been suggested by Hans Wennborg. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309559 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r308327 3rd time: Add a warning for missingAlex Lorenz2017-07-281-1/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files The second recommit (r309106) was reverted because the "non-default #pragma pack value chages the alignment of struct or union members in the included file" warning proved to be too aggressive for external projects like Chromium (https://bugs.chromium.org/p/chromium/issues/detail?id=749197). This recommit makes the problematic warning a non-default one, and gives it the -Wpragma-pack-suspicious-include warning option. The first recommit (r308441) caused a "non-default #pragma pack value might change the alignment of struct or union members in the included file" warning in LLVM itself. This recommit tweaks the added warning to avoid warnings for #includes that don't have any records that are affected by the non-default alignment. This tweak avoids the previously emitted warning in LLVM. Original message: This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309386 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r309106 "Recommit r308327 2nd time: Add a warning for missing"Hans Wennborg2017-07-261-54/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The warning fires on non-suspicious code in Chromium. Reverting until a solution is figured out. > Recommit r308327 2nd time: Add a warning for missing > '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files > > The first recommit (r308441) caused a "non-default #pragma pack value might > change the alignment of struct or union members in the included file" warning > in LLVM itself. This recommit tweaks the added warning to avoid warnings for > #includes that don't have any records that are affected by the non-default > alignment. This tweak avoids the previously emitted warning in LLVM. > > Original message: > > This commit adds a new -Wpragma-pack warning. It warns in the following cases: > > - When a translation unit is missing terminating #pragma pack (pop) directives. > - When entering an included file if the current alignment value as determined > by '#pragma pack' directives is different from the default alignment value. > - When leaving an included file that changed the state of the current alignment > value. > > rdar://10184173 > > Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309186 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r308327 2nd time: Add a warning for missingAlex Lorenz2017-07-261-1/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files The first recommit (r308441) caused a "non-default #pragma pack value might change the alignment of struct or union members in the included file" warning in LLVM itself. This recommit tweaks the added warning to avoid warnings for #includes that don't have any records that are affected by the non-default alignment. This tweak avoids the previously emitted warning in LLVM. Original message: This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309106 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r308441 "Recommit r308327: Add a warning for missing '#pragma pack ↵Hans Wennborg2017-07-191-36/+1
| | | | | | | | | | | | | | | | | | | | | (pop)' and suspicious uses of '#pragma pack' in included files" This seems to have broken the sanitizer-x86_64-linux buildbot. Reverting until it's fixed, especially since this landed just before the 5.0 branch. > This commit adds a new -Wpragma-pack warning. It warns in the following cases: > > - When a translation unit is missing terminating #pragma pack (pop) directives. > - When entering an included file if the current alignment value as determined > by '#pragma pack' directives is different from the default alignment value. > - When leaving an included file that changed the state of the current alignment > value. > > rdar://10184173 > > Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308455 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r308327: Add a warning for missing '#pragma pack (pop)'Alex Lorenz2017-07-191-1/+36
| | | | | | | | | | | | | | | | | | | and suspicious uses of '#pragma pack' in included files This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308441 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r308327Alex Lorenz2017-07-181-36/+1
| | | | | | | I forgot to test clang-tools-extra which is now failing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308328 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a warning for missing '#pragma pack (pop)' and suspicious usesAlex Lorenz2017-07-181-1/+36
| | | | | | | | | | | | | | | | | | | of '#pragma pack' in included files This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308327 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for #pragma clang sectionJaved Absar2017-06-051-0/+30
| | | | | | | | | | | | | | | | | This patch provides a means to specify section-names for global variables, functions and static variables, using #pragma directives. This feature is only defined to work sensibly for ELF targets. One can specify section names as: #pragma clang section bss="myBSS" data="myData" rodata="myRodata" text="myText" One can "unspecify" a section name with empty string e.g. #pragma clang section bss="" data="" text="" rodata="" Reviewers: Roger Ferrer, Jonathan Roelofs, Reid Kleckner Differential Revision: https://reviews.llvm.org/D33412 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304705 91177308-0d34-0410-b5e6-96231b3b80d8
* The SubjectMatchRule enum should not be used as a DenseMap key to avoidAlex Lorenz2017-04-181-12/+14
| | | | | | | | | | | | UBSAN 'invalid value' failures The commit r300556 introduced a UBSAN issue that was caught by http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap. The DenseMap failed to create an empty/tombstone value as the empty/tombstone values for the SubjectMatchRule enum were not valid enum constants. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300591 91177308-0d34-0410-b5e6-96231b3b80d8
* Add #pragma clang attributeAlex Lorenz2017-04-181-0/+211
| | | | | | | | | | | | | | | | | | This is a recommit of r300539 that was reverted in r300543 due to test failures. The original commit message is displayed below: The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300556 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r300539 - Add #pragma clang attributeAlex Lorenz2017-04-181-211/+0
| | | | | | | | Some tests fail on the Windows buildbots. I will have to investigate more. This commit reverts r300539, r300540 and r300542. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300543 91177308-0d34-0410-b5e6-96231b3b80d8
* Add #pragma clang attributeAlex Lorenz2017-04-181-0/+211
| | | | | | | | | | | | | | | The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300539 91177308-0d34-0410-b5e6-96231b3b80d8
* Add #pragma clang fpAdam Nemet2017-04-041-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | This adds the new pragma and the first variant, contract(on/off/fast). The pragma has the same block scope rules as STDC FP_CONTRACT, i.e. it can be placed at the beginning of a compound statement or at file scope. Similarly to STDC FP_CONTRACT there is no need to use attributes. First an annotate token is inserted with the parsed details of the pragma. Then the annotate token is parsed in the proper contexts and the Sema is updated with the corresponding FPOptions using the shared ActOn function with STDC FP_CONTRACT. After this the FPOptions from the Sema is propagated into the AST expression nodes. There is no change here. I was going to add a 'default' option besides 'on/off/fast' similar to STDC FP_CONTRACT but then decided against it. I think that we'd have to make option uppercase then to avoid using 'default' the keyword. Also because of the scoped activation of pragma I am not sure there is really a need a for this. Differential Revision: https://reviews.llvm.org/D31276 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299470 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules][PCH] Serialize #pragma packAlex Lorenz2017-03-311-0/+1
| | | | | | | | | | | | This patch serializes the state of #pragma pack. It preserves the state of the pragma from a PCH/from modules in a file that uses that PCH/those modules. rdar://21359084 Differential Revision: https://reviews.llvm.org/D31241 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299226 91177308-0d34-0410-b5e6-96231b3b80d8
* Use FPContractModeKind universallyAdam Nemet2017-03-291-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FPContractModeKind is the codegen option flag which is already ternary (off, on, fast). This makes it universally the type for the contractable info across the front-end: * In FPOptions (i.e. in the Sema + in the expression nodes). * In LangOpts::DefaultFPContractMode which is the option that initializes FPOptions in the Sema. Another way to look at this change is that before fp-contractable on/off were the only states handled to the front-end: * For "on", FMA folding was performed by the front-end * For "fast", we simply forwarded the flag to TargetOptions to handle it in LLVM Now off/on/fast are all exposed because for fast we will generate fast-math-flags during CodeGen. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. --- This is a recommit of r299027 with an adjustment to the test CodeGenCUDA/fp-contract.cu. The test assumed that even though -ffp-contract=on is passed FE-based folding of FMA won't happen. This is obviously wrong since the user is asking for this explicitly with the option. CUDA is different that -ffp-contract=fast is on by default. The test used to "work" because contract=fast and contract=on were maintained separately and we didn't fold in the FE because contract=fast was on due to the target-default. This patch consolidates the contract=on/fast/off state into a ternary state hence the change in behavior. --- Differential Revision: https://reviews.llvm.org/D31167 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299033 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Use FPContractModeKind universally"Adam Nemet2017-03-291-6/+3
| | | | | | | | This reverts commit r299027. It's causing a test failure in clang's CodeGenCUDE/fp-contract.cu git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299029 91177308-0d34-0410-b5e6-96231b3b80d8
* Use FPContractModeKind universallyAdam Nemet2017-03-291-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | FPContractModeKind is the codegen option flag which is already ternary (off, on, fast). This makes it universally the type for the contractable info across the front-end: * In FPOptions (i.e. in the Sema + in the expression nodes). * In LangOpts::DefaultFPContractMode which is the option that initializes FPOptions in the Sema. Another way to look at this change is that before fp-contractable on/off were the only states handled to the front-end: * For "on", FMA folding was performed by the front-end * For "fast", we simply forwarded the flag to TargetOptions to handle it in LLVM Now off/on/fast are all exposed because for fast we will generate fast-math-flags during CodeGen. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. Differential Revision: https://reviews.llvm.org/D31167 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299027 91177308-0d34-0410-b5e6-96231b3b80d8
* Encapsulate FPOptions and use it consistentlyAdam Nemet2017-03-271-3/+3
| | | | | | | | | | | | | | | | | | Sema holds the current FPOptions which is adjusted by 'pragma STDC FP_CONTRACT'. This then gets propagated into expression nodes as they are built. This encapsulates FPOptions so that this propagation happens opaquely rather than directly with the fp_contractable on/off bit. This allows controlled transitioning of fp_contractable to a ternary value (off, on, fast). It will also allow adding more fast-math flags later. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. Differential Revision: https://reviews.llvm.org/D31166 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298877 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Header cleanupMehdi Amini2016-07-181-1/+1
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275882 91177308-0d34-0410-b5e6-96231b3b80d8
* Use ranges to concisely express iterationDavid Majnemer2016-06-231-2/+3
| | | | | | | No functional change is intended, this should just clean things up a little. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273522 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Initialize a variable to make buildbot green.Denis Zobnin2016-04-291-1/+1
| | | | | | | | | | In r268085 "[MS] Make #pragma pack use PragmaStack<> class." there was an uninitialized variable 'Alignment', which caused the following failure: http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/1758 Zero-initialize the variable to fix this failure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268129 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Make #pragma pack use PragmaStack<> class.Denis Zobnin2016-04-291-152/+37
| | | | | | | | | | | | | | | | Make implementation of #pragma pack consistent with other "stack" pragmas. Use PragmaStack<> class instead of old representation of internal stack. Don't change compiler's behavior. TODO: 1. Introduce diagnostics on popping named slots from pragma stacks. Reviewer: rnk Differential revision: http://reviews.llvm.org/D19727 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268085 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit "[MS] Improved implementation of stack pragmas (vtordisp, *_seg)"Denis Zobnin2016-04-291-24/+30
| | | | | | | | | | | | | | | | | | | | | | | Slightly updated version, double-checked build and tests. Improve implementation of MS pragmas that use stack + compatibility fixes. This patch: 1. Changes implementation of #pragma vtordisp to use PragmaStack class that other stack pragmas use; 2. Fixes "#pragma vtordisp()" behavior - it shouldn't affect the stack; 3. Supports "save-restore" of pragma stacks on enter / exit a C++ method body, as MSVC does. TODO: 1. Change implementation of #pragma pack to use the same approach; 2. Introduce diagnostics on popping named stack slots, as MSVC does. Reviewers: rnk, thakis Differential revision: http://reviews.llvm.org/D19361 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268029 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[MS] Improved implementation of MS stack pragmas (vtordisp, *_seg)"Denis Zobnin2016-04-281-8/+24
| | | | | | | This reverts commit r267866. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267870 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Improved implementation of MS stack pragmas (vtordisp, *_seg)Denis Zobnin2016-04-281-24/+8
| | | | | | | | | | | | | Rework implementation of several MS pragmas that use internal stack: vtordisp, {bss|code|const|data}_seg. This patch: 1. Makes #pragma vtordisp use PragmaStack class as *_seg pragmas do; 2. Fixes "#pragma vtordisp()" behavior: it shouldn't affect stack; 3. Saves/restores the stacks on enter/exit a C++ method body. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267866 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement support for [[maybe_unused]] in C++1z that is based off existing ↵Aaron Ballman2016-03-091-1/+2
| | | | | | support for unused, and treat it as an extension pre-C++1z. This also means extending the existing unused attribute so that it can be placed on an enum and enumerator, in addition to the other subjects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263025 91177308-0d34-0410-b5e6-96231b3b80d8
* Serialize `#pragma detect_mismatch`.Nico Weber2016-03-021-3/+6
| | | | | | | | This is like r262493, but for pragma detect_mismatch instead of pragma comment. The two pragmas have similar behavior, so use the same approach for both. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262506 91177308-0d34-0410-b5e6-96231b3b80d8
* Serialize `#pragma comment`.Nico Weber2016-03-021-17/+6
| | | | | | | | | | | | | | | `#pragma comment` was handled by Sema calling a function on ASTConsumer, and CodeGen then implementing this function and writing things to its output. Instead, introduce a PragmaCommentDecl AST node and hang one off the TranslationUnitDecl for every `#pragma comment` line, and then use the regular serialization machinery. (Since PragmaCommentDecl has codegen relevance, it's eagerly deserialized.) http://reviews.llvm.org/D17799 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262493 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce -fsanitize-stats flag.Peter Collingbourne2016-01-161-1/+1
| | | | | | | | | This is part of a new statistics gathering feature for the sanitizers. See clang/docs/SanitizerStats.rst for further info and docs. Differential Revision: http://reviews.llvm.org/D16175 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257971 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement section pragma feedback on r205810Reid Kleckner2015-03-041-0/+3
| | | | | | | Mostly short-circuits some conditionals. Adds target validation of sections passed to these pragmas. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231317 91177308-0d34-0410-b5e6-96231b3b80d8
* The prefix 'Ms-' should be 'MS-'David Majnemer2015-02-021-1/+1
| | | | | | | Clang is otherwise consistent that Microsoft be abbreviated as MS, not Ms. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227842 91177308-0d34-0410-b5e6-96231b3b80d8
* MS Compat: mark globals emitted in read-only sections constHans Wennborg2014-10-161-10/+10
| | | | | | | | | | | | | | | | | | | | They cannot be written to, so marking them const makes sense and may improve optimisation. As a side-effect, SectionInfos has to be moved from Sema to ASTContext. It also fixes this problem, that occurs when compiling ATL: warning LNK4254: section 'ATL' (C0000040) merged into '.rdata' (40000040) with different attributes The ATL headers are putting variables in a special section that's marked read-only. However, Clang currently can't model that read-onlyness in the IR. But, by making the variables const, the section does become read-only, and the linker warning is avoided. Differential Revision: http://reviews.llvm.org/D5812 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219960 91177308-0d34-0410-b5e6-96231b3b80d8
* Return true from UnifySection when emitting a diagnosticEhsan Akhgari2014-09-221-1/+1
| | | | | | | | | | | | Test Plan: I noticed this through code inspection. The callers use the return value to remove the SectionAttr if a diagnostic is emitted, but I don't think the failure to do so is observable right now. Reviewers: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5438 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218265 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-301-2/+2
| | | | | | const from some other StringRefs since its implicitly const already. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216825 91177308-0d34-0410-b5e6-96231b3b80d8
* -fms-extensions: Implement half of #pragma init_segReid Kleckner2014-07-221-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This pragma is very rare. We could *hypothetically* lower some uses of it down to @llvm.global_ctors, but given that GlobalOpt isn't able to optimize prioritized global ctors today, there's really no point. If we wanted to do this in the future, I would check if the section used in the pragma started with ".CRT$XC" and had up to two characters after it. Those two characters could form the 16-bit initialization priority that we support in @llvm.global_ctors. We would have to teach LLVM to lower prioritized global ctors on COFF as well. This should let us compile some silly uses of this pragma in WebKit / Blink. Reviewers: rsmith, majnemer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4549 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213593 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-9/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209613 91177308-0d34-0410-b5e6-96231b3b80d8
* Implemented support for "pragma clang optimize on/off", based on attribute ↵Dario Domizioli2014-05-231-0/+28
| | | | | | | | | | | | | | | | | | 'optnone'. This patch implements support for selectively disabling optimizations on a range of function definitions through a pragma. The implementation is that all function definitions in the range are decorated with attribute 'optnone'. #pragma clang optimize off // All function definitions in here are decorated with 'optnone'. #pragma clang optimize on // Compilation resumes as normal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209510 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bunch of mislayered clang/Lex includes from SemaAlp Toker2014-05-031-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207896 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS-ABI] Add support for #pragma section and related pragmasWarren Hunt2014-04-081-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the msvc pragmas section, bss_seg, code_seg, const_seg and data_seg as well as support for __declspec(allocate()). Additionally it corrects semantics and adds diagnostics for __attribute__((section())) and the interaction between the attribute and the msvc pragmas and declspec. In general conflicts should now be well diganosed within and among these features. In supporting the pragmas new machinery for uniform lexing for msvc pragmas was introduced. The new machinery always lexes the entire pragma and stores it on an annotation token. The parser is responsible for parsing the pragma when the handling the annotation token. There is a known outstanding bug in this implementation in C mode. Because these attributes and pragmas apply _only_ to definitions, we process them at the time we detect a definition. Due to tentative definitions in C, we end up processing the definition late. This means that in C mode, everything that ends up in a BSS section will end up in the _last_ BSS section rather than the one that was live at the time of tentative definition, even if that turns out to be the point of actual definition. This issue is not known to impact anything as of yet because we are not aware of a clear use or use case for #pragma bss_seg but should be fixed at some point. Differential Revision=http://reviews.llvm.org/D3065#inline-16241 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205810 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Expand and eliminate the LLVM_ENUM_INT_TYPE() macroAlp Toker2014-03-021-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202606 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Implement #pragma vtordisp() and clang-cl /vdNReid Kleckner2014-02-121-5/+36
| | | | | | | | | | | | | | | | | These features are new in VS 2013 and are necessary in order to layout std::ostream correctly. Currently we have an ABI incompatibility when self-hosting with the 2013 stdlib in our convertible_fwd_ostream wrapper in gtest. This change adds another implicit attribute, MSVtorDispAttr, because implicit attributes are currently the best way to make sure the information stays on class templates through instantiation. Reviewers: majnemer Differential Revision: http://llvm-reviews.chandlerc.com/D2746 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201274 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Add support for the -vm{b,g,s,m,v} flagsDavid Majnemer2014-02-111-1/+1
| | | | | | | | | | These flags control the inheritance model initially used by the translation unit. Differential Revision: http://llvm-reviews.chandlerc.com/D2741 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201175 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Add support for #pragma pointers_to_membersDavid Majnemer2014-02-101-0/+7
| | | | | | | | | | | | | | | | | | | | Introduce a notion of a 'current representation method' for pointers-to-members. When starting out, this is set to 'best case' (representation method is chosen by examining the class, selecting the smallest representation that would work given the class definition or lack thereof). This pragma allows the translation unit to dictate exactly what representation to use, similar to how the inheritance model keywords operate. N.B. PCH support is forthcoming. Differential Revision: http://llvm-reviews.chandlerc.com/D2723 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201105 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a -Wmicrosoft warning about an unrepresentable enum valueReid Kleckner2014-02-031-1/+1
| | | | | | In MSVC, enums are always signed unless you explicitly specify the type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200719 91177308-0d34-0410-b5e6-96231b3b80d8
* Distinguish between attributes explicitly written at the request of the ↵Aaron Ballman2014-01-161-7/+6
| | | | | | | | user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute. Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199378 91177308-0d34-0410-b5e6-96231b3b80d8
* Tablegen now generates a StringSwitch for attributes containing enumeration ↵Aaron Ballman2013-09-111-13/+4
| | | | | | arguments to map strings to the proper enumeration value. This makes error checking more consistent and reduces the amount of hand-written code required. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190545 91177308-0d34-0410-b5e6-96231b3b80d8
* Omit llvm:: before StringRef and SmallString. We have using directive in ↵Robert Wilhelm2013-08-101-3/+2
| | | | | | include/clang/Basic/LLVM.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188139 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding support for MSVC #pragma detect_mismatch functionality by emitting a ↵Aaron Ballman2013-06-041-0/+6
| | | | | | FAILIFMISMATCH linker command into the object file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183178 91177308-0d34-0410-b5e6-96231b3b80d8
* Suffixing #pragma comment(lib) library names with .lib if necessary. This ↵Aaron Ballman2013-05-241-2/+1
| | | | | | matches MSVC behavior, as well as allows us to properly link libraries such as the ones provided by the MSDN examples. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182647 91177308-0d34-0410-b5e6-96231b3b80d8