summaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCXX/member-function-pointers.cpp
AgeCommit message (Collapse)Author
2023-08-28[clang] Remove rdar links; NFCAaron Ballman
We have a new policy in place making links to private resources something we try to avoid in source and test files. Normally, we'd organically switch to the new policy rather than make a sweeping change across a project. However, Clang is in a somewhat special circumstance currently: recently, I've had several new contributors run into rdar links around test code which their patch was changing the behavior of. This turns out to be a surprisingly bad experience, especially for newer folks, for a handful of reasons: not understanding what the link is and feeling intimidated by it, wondering whether their changes are actually breaking something important to a downstream in some way, having to hunt down strangers not involved with the patch to impose on them for help, accidental pressure from asking for potentially private IP to be made public, etc. Because folks run into these links entirely by chance (through fixing bugs or working on new features), there's not really a set of problematic links to focus on -- all of the links have basically the same potential for causing these problems. As a result, this is an omnibus patch to remove all such links. This was not a mechanical change; it was done by manually searching for rdar, radar, radr, and other variants to find all the various problematic links. From there, I tried to retain or reword the surrounding comments so that we would lose as little context as possible. However, because most links were just a plain link with no supporting context, the majority of the changes are simple removals. Differential Review: https://reviews.llvm.org/D158071
2023-07-17Revert "Remove rdar links; NFC"Mehdi Amini
This reverts commit d618f1c3b12effd0c2bdb7d02108d3551f389d3d. This commit wasn't reviewed ahead of time and significant concerns were raised immediately after it landed. According to our developer policy this warrants immediate revert of the commit. https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy Differential Revision: https://reviews.llvm.org/D155509
2023-07-07Remove rdar links; NFCAaron Ballman
This removes links to rdar, which is an internal bug tracker that the community doesn't have visibility into. See further discussion at: https://discourse.llvm.org/t/code-review-reminder-about-links-in-code-commit-messages/71847
2022-10-06[CodeGenCXX] Convert some tests to opaque pointers (NFC)Nikita Popov
Conversion done using the script at https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34. These are tests where the conversion worked out of the box and no manual fixup was performed.
2022-04-07[OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC)Nikita Popov
This adds -no-opaque-pointers to clang tests whose output will change when opaque pointers are enabled by default. This is intended to be part of the migration approach described in https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322/9. The patch has been produced by replacing %clang_cc1 with %clang_cc1 -no-opaque-pointers for tests that fail with opaque pointers enabled. Worth noting that this doesn't cover all tests, there's a remaining ~40 tests not using %clang_cc1 that will need a followup change. Differential Revision: https://reviews.llvm.org/D123115
2021-04-21Delete le32/le64 targetsFangrui Song
They are unused now. Note: NaCl is still used and is currently expected to be needed until 2022-06 (https://blog.chromium.org/2020/08/changes-to-chrome-app-support-timeline.html). Differential Revision: https://reviews.llvm.org/D100981
2020-12-31[test] Add {{.*}} to make ELF tests immune to ↵Fangrui Song
dso_local/dso_preemptable/(none) differences For a default visibility external linkage definition, dso_local is set for ELF -fno-pic/-fpie and COFF and Mach-O. Since default clang -cc1 for ELF is similar to -fpic ("PIC Level" is not set), this nuance causes unneeded binary format differences. To make emitted IR similar, ELF -cc1 -fpic will default to -fno-semantic-interposition, which sets dso_local for default visibility external linkage definitions. To make this flip smooth and enable future (dso_local as definition default), this patch replaces (function) `define ` with `define{{.*}} `, (variable/constant/alias) `= ` with `={{.*}} `, or inserts appropriate `{{.*}} `.
2020-02-03Revert "[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition"Fangrui Song
This reverts commit 789a46f2d742e11edaade28cb59a0f4d2a1d770e. Accidentally committed.
2020-02-03[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interpositionFangrui Song
Summary: Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults to -fsemantic-interposition). Users need to specify -fsemantic-interposition to get semantic interposition behavior. Semantic interposition is currently a best-effort feature. There may still be some cases where it is not handled well. Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D73865
2015-09-03[WebAssembly] Initial WebAssembly support in clangDan Gohman
This implements basic support for compiling (though not yet assembling or linking) for a WebAssembly target. Note that ABI details are not yet finalized, and may change. Differential Revision: http://reviews.llvm.org/D12002 llvm-svn: 246814
2015-02-27Update Clang tests to handle explicitly typed load changes in LLVM.David Blaikie
llvm-svn: 230795
2015-02-18Change representation of member function pointers for MIPS targetsZoran Jovanovic
Differential Revision: http://reviews.llvm.org/D7148 llvm-svn: 229680
2013-08-15CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin
tests fail. llvm-svn: 188447
2013-07-24Use ARM-style representation for C++ method pointers under PNaCl/EmscriptenMark Seaborn
Before this change, Clang uses the x86 representation for C++ method pointers when generating code for PNaCl. However, the resulting code will assume that function pointers are 0 mod 2. This assumption is not safe for PNaCl, where function pointers could have any value (especially in future sandboxing models). So, switch to using the ARM representation for PNaCl code, which makes no assumptions about the alignment of function pointers. Since we're changing the "le32" target, this change also applies to Emscripten. The change is beneficial for Emscripten too. Emscripten has a workaround to make function pointers 0 mod 2. This change would allow the workaround to be removed. See: https://code.google.com/p/nativeclient/issues/detail?id=3450 llvm-svn: 187051
2012-05-01Restructure some of the member-pointer tests, implicitlyJohn McCall
removing some that were added without a triple (and moving their tests into files that appropriately test multiple architectures). llvm-svn: 155920
2012-02-15Split reinterpret_casts of member pointers out from CK_BitCast; thisJohn McCall
is general goodness because representations of member pointers are not always equivalent across member pointer types on all ABIs (even though this isn't really standard-endorsed). Take advantage of the new information to teach IR-generation how to do these reinterprets in constant initializers. Make sure this works when intermingled with hierarchy conversions (although this is not part of our motivating use case). Doing this in the constant-evaluator would probably have been better, but that would require a *lot* of extra structure in the representation of constant member pointers: you'd really have to track an arbitrary chain of hierarchy conversions and reinterpretations in order to get this right. Ultimately, this seems less complex. I also wasn't quite sure how to extend the constant evaluator to handle foldings that we don't actually want to treat as extended constant expressions. llvm-svn: 150551
2011-08-12Update clang tests for r137527.Eli Friedman
llvm-svn: 137535
2011-07-09clang side to match the LLVM IR type system rewrite patch.Chris Lattner
llvm-svn: 134831
2011-03-15Reorganize the emission of (unfoldable) constant casts a bit, andJohn McCall
make sure that upcasts of member pointer types are covered as constants. Fixed rdar://problem/9130221 llvm-svn: 127702
2010-08-23Abstract out everything having to do with member pointers into the ABIJohn McCall
class; they should just be completely opaque throughout IR gen now, although I haven't really audited that. Fix a bug apparently inherited from gcc-4.2 where we failed to null-check member data pointers when performing derived-to-base or base-to-derived conversions on them. llvm-svn: 111789
2010-08-22Eliminate a stale assertion. Fixes Clang self-host.Douglas Gregor
llvm-svn: 111782
2010-08-22Clean up a very silly use of first-class aggregates.John McCall
llvm-svn: 111777
2010-08-22Experiment with using first-class aggregates to represent member functionJohn McCall
pointers. I find the resulting code to be substantially cleaner, and it makes it very easy to use the same APIs for data member pointers (which I have conscientiously avoided here), and it avoids a plethora of potential inefficiencies due to excessive memory copying, but we'll have to see if it actually works. llvm-svn: 111776
2010-08-22Abstract out member-pointer creation. I'm really unhappy about the currentJohn McCall
duplication between the constant and non-constant paths in all of this. Implement ARM ABI semantics for member pointer constants and conversion. llvm-svn: 111772
2010-05-03If we're generating code to create a pointer-to-member functionDouglas Gregor
aggregate and the result of the aggregate is unused, bail out early. Fixes PR7027. llvm-svn: 102942
2010-05-03When computing the address of a virtual member function pointer, use the ↵Anders Carlsson
pointer width instead of hardcoding for 64-bit. llvm-svn: 102921
2010-02-07Use the right type when taking the address of a non-virtual member function ↵Anders Carlsson
pointer. Fixes PR6258. llvm-svn: 95524
2010-02-04Calculate offset correctly when taking the address of a virtual member function.Anders Carlsson
llvm-svn: 95305
2010-01-16Make the AST explicitly represent the cast of the first operand of a Eli Friedman
pointer-to-member operator. llvm-svn: 93592
2010-01-05When emitting member function pointers, use the canonical decl if the member ↵Anders Carlsson
function is virtual. Fixes PR5940. llvm-svn: 92680
2009-12-15Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar
- This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
2009-12-11Move the code for converting a member pointer to a bool so that it is usableEli Friedman
for logical not. llvm-svn: 91112
2009-12-11Fix for PR5718: implement equality comparisons for member function pointers.Eli Friedman
llvm-svn: 91108
2009-11-27Some member pointer casting tests.Eli Friedman
llvm-svn: 89989
2009-11-23Convert the && and || operands to bool using standard conversions. Fixes PR5593.Anders Carlsson
llvm-svn: 89704
2009-11-23Handle converting member pointers to bool.Anders Carlsson
llvm-svn: 89692
2009-11-11Fix some tests in -Asserts mode.Daniel Dunbar
- FileCheck is a *huuuuge* improvement here. - Still feels like we could use a better tool for this though, either teach llvm-dis to spit out the FileCheck syntax, or provide another tool to turn a .ll into a "matchable" input. - Also on my Christmas list is better FileCheck diagnostics with missing variables or mismatches. llvm-svn: 86800
2009-10-18Use CK_BitCast for member function pointer casts. Fixes PR5138.Anders Carlsson
llvm-svn: 84438
2009-10-13Don't assume that the LHS and RHS of a member pointer expression is a ↵Anders Carlsson
DeclRefExpr. Fixes PR5177. llvm-svn: 83986
2009-10-03Implement code generation of member function pointer calls. Fixes PR5121.Anders Carlsson
llvm-svn: 83271
2009-10-03Teach AggExprEmitter about pointers to member functions.Anders Carlsson
llvm-svn: 83266
2009-10-03Handle base-to-derived casts of member function pointers in CGExprConstant.cppAnders Carlsson
llvm-svn: 83265
2009-10-03Handle members to function pointers in CGExprConstant.Anders Carlsson
llvm-svn: 83264
2009-10-03Rewrite member function pointer test not to rely on -O2.Anders Carlsson
llvm-svn: 83262
2009-09-29Forgot test.Anders Carlsson
llvm-svn: 83044