summaryrefslogtreecommitdiffstats
path: root/utils
Commit message (Collapse)AuthorAgeFilesLines
* Revert "r222906 - Create a new 'flag_enum' attribute."Hans Wennborg2015-01-201-6/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@226593 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Re-sort the #include lines using llvm/utils/sort_includes.pyChandler Carruth2015-01-142-4/+4
| | | | | | | No functionality changed, this is a purely mechanical cleanup to ensure the #include order remains consistent across the project. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225975 91177308-0d34-0410-b5e6-96231b3b80d8
* Attributes accepting an EnumArgument are allowed to pass a string literal, ↵Aaron Ballman2014-12-191-0/+1
| | | | | | | | or an identifier. VariadicEnumArguments now behave consistently instead of only accepting a string literal. This change affects the only attribute accepting a variadic enumeration: callable_when. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224582 91177308-0d34-0410-b5e6-96231b3b80d8
* Modify __has_attribute so that it only looks for GNU-style attributes. ↵Aaron Ballman2014-12-051-3/+0
| | | | | | Removes the ability to look for generic attributes and keywords via this macro, which has the potential to be a breaking change. However, since there is __has_cpp_attribute and __has_declspec_attribute, and given the limited usefulness of querying a generic attribute name regardless of syntax, this seems like the correct path forward. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223468 91177308-0d34-0410-b5e6-96231b3b80d8
* Create a new 'flag_enum' attribute.Sean Hunt2014-11-281-1/+6
| | | | | | | | | | | This attribute serves as a hint to improve warnings about the ranges of enumerators used as flag types. It currently has no working C++ implementation due to different semantics for enums in C++. For more explanation, see the docs and testcases. Reviewed by Aaron Ballman. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222906 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing a use of stringstream to use an LLVM helper function. Drive-by fixing ↵Aaron Ballman2014-11-171-7/+3
| | | | | | header include order. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222151 91177308-0d34-0410-b5e6-96231b3b80d8
* MinGW doesn't implement std::to_string; working around it. NFC.Aaron Ballman2014-11-141-1/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222033 91177308-0d34-0410-b5e6-96231b3b80d8
* Complete support for the SD-6 standing document (based off N4200) with ↵Aaron Ballman2014-11-141-9/+30
| | | | | | support for __has_cpp_attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221991 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Rename NewDeleteLeaks checker in the test script.Anna Zaks2014-10-311-1/+1
| | | | | | Fixup to r220289. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220976 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor tree printing in AST dumping.Richard Smith2014-10-301-26/+4
| | | | | | | | | | | | Instead of manually maintaining a flag indicating whether we're about to print out the last child of the parent node (to determine whether we print "`" or "|"), capture a callable to print that child and defer printing it until we either see a next child or finish the parent. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220930 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow constant expressions in pragma loop hints.Tyler Nowicki2014-10-121-4/+26
| | | | | | | | | Previously loop hints such as #pragma loop vectorize_width(#) required a constant. This patch allows a constant expression to be used as well. Such as a non-type template parameter or an expression (2 * c + 1). Reviewed by Richard Smith git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219589 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding some FIXMEs to the attribute emitter code regarding whether pretty ↵Aaron Ballman2014-09-151-0/+6
| | | | | | printing enumerators should use quoted string literals, or identifiers. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217781 91177308-0d34-0410-b5e6-96231b3b80d8
* When pretty printing attributes that have enumeration arguments, print the ↵Aaron Ballman2014-09-151-6/+50
| | | | | | enumerator identifier (as a string literal) instead of the internal enumerator integral value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217771 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-271-1/+1
| | | | | | just letting them be implicitly created. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216528 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix invalid test generation by utils/ABITest/ABITestGen.py when the same ↵Daniel Sanders2014-08-212-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | enum is generated more than once. When generating records/unions, the same enum type may be generated more than once (with different names). In these cases, the name of the enum values are not sufficiently unique to prevent multiple declarations. E.g: typedef enum T3 { enum0val0 } T3; typedef T3 T2[3]; typedef enum T4 { enum0val0 } T4; typedef union T1 { T2 field0; T4 field1; char field2; } T1; Added a unique suffix to enum values so that multiple identical enum types do not use the same enum value names. One example of this bug is produced by: ABITestGen.py --no-unsigned --no-vector --no-complex --no-bool \ --max-args 0 --max-record-depth 1 -o inputs/test.9921.a.c \ -T inputs/test.9921.b.c -D inputs/test.9921.driver.c \ --min=9921 --count=1 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216166 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some transient raw pointer ownership in ClangAttrEmitter::createArgumentDavid Blaikie2014-08-081-23/+28
| | | | | | | | This function might be a bit easier if it were split in two with a lot of early returns - and that setOptional bit in the outer function, but anyway. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215263 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing header guards.Benjamin Kramer2014-08-081-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215202 91177308-0d34-0410-b5e6-96231b3b80d8
* The GNU-style aligned attribute has an optional expression, but the ↵Aaron Ballman2014-08-011-3/+9
| | | | | | | | generated pretty printing logic was unaware of this. Fixed the pretty printing logic, and added a test to ensure it no longer asserts. Added a FIXME to the code about eliding the parenthesis when pretty printing such a construct. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214513 91177308-0d34-0410-b5e6-96231b3b80d8
* Automate attribute argument count semantic checking when there are variadic ↵Aaron Ballman2014-07-311-1/+13
| | | | | | | | or optional arguments present. With this, the only time you should have to manually check attribute argument counts is when HasCustomParsing is set to true, or when you have variadic arguments that aren't really variadic (like ownership_holds and friends). Updating the diagnostics in the launch_bounds test since they have been improved in that case. Adding a test for nonnull since it has little test coverage, but has truly variadic arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214407 91177308-0d34-0410-b5e6-96231b3b80d8
* Specifying the diagnostic argument through the attribute table generator ↵Aaron Ballman2014-07-161-0/+2
| | | | | | | | instead of having to enter it manually as part of the attribute subject list. This only affects attributes appertaining to ObjC interfaces and protocols. No new tests required as this is covered by existing tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213193 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typosAlp Toker2014-07-141-4/+3
| | | | | | Also consolidate 'backward compatibility' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212974 91177308-0d34-0410-b5e6-96231b3b80d8
* [ARM-BE] Generate correct NEON intrinsics for big endian systems.James Molloy2014-06-271-62/+172
| | | | | | | | | | | | | The NEON intrinsics in arm_neon.h are designed to work on vectors "as-if" loaded by (V)LDR. We load vectors "as-if" (V)LD1, so the intrinsics are currently incorrect. This patch adds big-endian versions of the intrinsics that does the "obvious but dumb" thing of reversing all vector inputs and all vector outputs. This will produce extra REVs, but we trust the optimizer to remove them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211893 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a Visualizer for VarDecl.Zachary Turner2014-06-261-6/+21
| | | | | | | | Reviewed by: Aaron Ballman Differential Revision: http://reviews.llvm.org/D4303 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211788 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing the position of the supported syntax marker when generating attribute ↵Aaron Ballman2014-06-251-1/+1
| | | | | | documentation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211692 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace some assert(0)'s with llvm_unreachable.Craig Topper2014-06-181-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211143 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace some assert(0)'s with llvm_unreachable.Craig Topper2014-06-181-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211139 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert assert(0) to llvm_unreachable to silence a warning about Addend ↵Craig Topper2014-06-181-1/+1
| | | | | | being uninitialized in default case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211138 91177308-0d34-0410-b5e6-96231b3b80d8
* Rewrite ARM NEON intrinsic emission completely.James Molloy2014-06-172-2982/+1846
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There comes a time in the life of any amateur code generator when dumb string concatenation just won't cut it any more. For NeonEmitter.cpp, that time has come. There were a bunch of magic type codes which meant different things depending on the context. There were a bunch of special cases that really had no reason to be there but the whole thing was so creaky that removing them would cause something weird to fall over. There was a 1000 line switch statement for code generation involving string concatenation, which actually did lexical scoping to an extent (!!) with a bunch of semi-repeated cases. I tried to refactor this three times in three different ways without success. The only way forward was to rewrite the entire thing. Luckily the testing coverage on this stuff is absolutely massive, both with regression tests and the "emperor" random test case generator. The main change is that previously, in arm_neon.td a bunch of "Operation"s were defined with special names. NeonEmitter.cpp knew about these Operations and would emit code based on a huge switch. Actually this doesn't make much sense - the type information was held as strings, so type checking was impossible. Also TableGen's DAG type actually suits this sort of code generation very well (surprising that...) So now every operation is defined in terms of TableGen DAGs. There are a bunch of operators to use, including "op" (a generic unary or binary operator), "call" (to call other intrinsics) and "shuffle" (take a guess...). One of the main advantages of this apart from making it more obvious what is going on, is that we have proper type inference. This has two obvious advantages: 1) TableGen can error on bad intrinsic definitions easier, instead of just generating wrong code. 2) Calls to other intrinsics are typechecked too. So we no longer need to work out whether the thing we call needs to be the Q-lane version or the D-lane version - TableGen knows that itself! Here's an example: before: case OpAbdl: { std::string abd = MangleName("vabd", typestr, ClassS) + "(__a, __b)"; if (typestr[0] != 'U') { // vabd results are always unsigned and must be zero-extended. std::string utype = "U" + typestr.str(); s += "(" + TypeString(proto[0], typestr) + ")"; abd = "(" + TypeString('d', utype) + ")" + abd; s += Extend(utype, abd) + ";"; } else { s += Extend(typestr, abd) + ";"; } break; } after: def OP_ABDL : Op<(cast "R", (call "vmovl", (cast $p0, "U", (call "vabd", $p0, $p1))))>; As an example of what happens if you do something wrong now, here's what happens if you make $p0 unsigned before the call to "vabd" - that is, $p0 -> (cast "U", $p0): arm_neon.td:574:1: error: No compatible intrinsic found - looking up intrinsic 'vabd(uint8x8_t, int8x8_t)' Available overloads: - float64x2_t vabdq_v(float64x2_t, float64x2_t) - float64x1_t vabd_v(float64x1_t, float64x1_t) - float64_t vabdd_f64(float64_t, float64_t) - float32_t vabds_f32(float32_t, float32_t) ... snip ... This makes it seriously easy to work out what you've done wrong in fairly nasty intrinsics. As part of this I've massively beefed up the documentation in arm_neon.td too. Things still to do / on the radar: - Testcase generation. This was implemented in the previous version and not in the new one, because - Autogenerated tests are not being run. The testcase in test/ differs from the autogenerated version. - There were a whole slew of special cases in the testcase generation that just felt (and looked) like hacks. If someone really feels strongly about this, I can try and reimplement it too. - Big endian. That's coming soon and should be a very small diff on top of this one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211101 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the ShowInSystemHeader bit consistently for all diagnosticsAlp Toker2014-06-161-2/+1
| | | | | | | | | | | | By describing system header suppressions directly in tablegen we eliminate special cases in getDiagnosticSeverity(). Dropping the reliance on builtin diagnostic classes when mapping also gets us closer to the goal of reusing the diagnostic machinery for custom diagnostics. No change in functionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211023 91177308-0d34-0410-b5e6-96231b3b80d8
* Adds a Pragma spelling for attributes to tablegen and makes use of it for loopTyler Nowicki2014-06-131-24/+53
| | | | | | | | | | hint attributes. Includes tests for pragma printing and for attribute order which is incorrectly reversed by ParsedAttributes. Reviewed by Aaron Ballman git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210925 91177308-0d34-0410-b5e6-96231b3b80d8
* Complete the switch from mappings to declarative diagnostic severitiesAlp Toker2014-06-121-3/+5
| | | | | | | | | This begins to address cognitive dissonance caused by treating the Note diagnostic level as a severity in the diagnostic engine. No change in functionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210758 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing an "if (this == nullptr)" check from two print methods. The conditionRichard Trieu2014-06-091-3/+5
| | | | | | | | will never be true in a well-defined context. The checking for null pointers has been moved into the caller logic so it does not rely on undefined behavior. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210498 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Attr::Clone() also clone the Inherited, IsPackExpansion and Implicit flagsHans Wennborg2014-05-311-2/+6
| | | | | | | | | | I was bitten by this when working with the dll attributes: when a dll attribute was cloned from a class template declaration to its specialization, the Inherited flag didn't get cloned. Differential Revision: http://reviews.llvm.org/D3972 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209950 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-2/+2
| | | | | | takeAs to getAs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209800 91177308-0d34-0410-b5e6-96231b3b80d8
* utils/CmpDriver: add brief documentation to indicate what this doesAlp Toker2014-05-211-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209268 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleaning up some range-based for loops so that the automatic type deduction ↵Aaron Ballman2014-05-201-74/+75
| | | | | | is more explicit about pointers and const. Did some minor drive-by const correctness fixes and identifier updates as well. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209233 91177308-0d34-0410-b5e6-96231b3b80d8
* None of these attributes require FunctionTemplate to be explicitly listed as ↵Aaron Ballman2014-05-201-6/+3
| | | | | | | | part of their subject definition. FunctionTemplateDecls are not what the attribute appertains to in the first place -- it attaches to the underlying FunctionDecl. The attribute emitter was using FunctionTemplate to map the diagnostic to "functions or methods", but that isn't a particularly clear diagnostic in these cases anyway (since they do not apply to ObjC methods). Updated the attribute emitter to remove custom logic for FunctionTemplateDecl, and updated the test cases for the change in diagnostic wording. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209209 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'.Craig Topper2014-05-075-10/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208163 91177308-0d34-0410-b5e6-96231b3b80d8
* tblgen: Modularize the diagnostic emitterTobias Grosser2014-05-061-88/+198
| | | | | | | | | | | | | | | | | | | Replace a large monolitic function, with per-table functions which all nicely fit on my screen. I also added documentation to each function that describes what kind of tables are generated and which information is contained and switched to range based for loops. Finally, I run clang-format over the moved code. I spent a significant amount of time to understand this code when reasoning about possible extensions to the diagnostic interface to support 'remark' diagnostics. This change will definitely help such an implementation, but already by itself it will save other people a lot of time when trying to understand this functionality. Even though the patch touches the full function, it is mostly mechanical. No functional change intended. The generated tblgen files are identical. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208136 91177308-0d34-0410-b5e6-96231b3b80d8
* Updated the attribute tablegen emitter for variadic arguments to emit a ↵Aaron Ballman2014-05-021-39/+34
| | | | | | range accessor in addition to the iterators. Updated code using iterators to use range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207837 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing a FIXME -- no longer using std::memcpy, since that would fail for ↵Aaron Ballman2014-05-011-3/+2
| | | | | | non-trivial types. Replaced with std::copy. No functional changes intended since all uses of this functionality either use pointers or integers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207766 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: remove HTML attribute validationDmitri Gribenko2014-04-301-16/+0
| | | | | | | | | | | | | Since the community says that a blacklist is not good enough, and I don't have enough time now to implement a proper whitelist, let's just remove the attribute validation. But, nevertheless, we can still communicate in the generated XML if our parser found an issue with the HTML. But this bit is best-effort and is specifically called out in the schema as such. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207712 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: in the generated XML file, mark HTML that is safe to passDmitri Gribenko2014-04-221-15/+26
| | | | | | | | | | | | through to the output even if the input comment comes from an untrusted source Attribute filtering is currently based on a blacklist, which right now includes all event handler attributes (they contain JavaScipt code). It should be switched to a whitelist, but going over all of the HTML5 spec requires a significant amount of time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206882 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapplying r204952 a second time.Aaron Ballman2014-03-313-20/+81
| | | | | | | | | | Clean up the __has_attribute implementation without modifying its behavior. Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes). Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205181 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r204968 and r204969; while more build bots are happy with the ↵Aaron Ballman2014-03-273-81/+20
| | | | | | results, some still have link errors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204974 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapplying r204952 with fixes which should hopefully resolve linking issues ↵Aaron Ballman2014-03-273-20/+81
| | | | | | with non-MSVC compilers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204968 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r204952, while I figure out what's going on with the makefile build.Aaron Ballman2014-03-273-81/+20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204955 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up the __has_attribute implementation without modifying its behavior. Aaron Ballman2014-03-273-20/+81
| | | | | | | | Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes). Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204952 91177308-0d34-0410-b5e6-96231b3b80d8
* When generating the Attribute dumper code, do not dead-initialize MoreChildrenArnaud A. de Grandmaison2014-03-211-1/+1
| | | | | | No functional change. This will cleanup a bunch of scan-build warnings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204529 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-111-6/+6
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203543 91177308-0d34-0410-b5e6-96231b3b80d8