Write a CodeQL query that finds coroutine methods that take parameters by reference, where those parameters are used after any co_await suspension point.
import cpp
import os | |
import sys | |
import subprocess | |
import urllib.request | |
import argparse | |
from pathlib import Path | |
wasdk = { | |
"name": "Microsoft.WindowsAppSDK", | |
"version": "1.7.250127003-experimental3", |
#include <winrt/base.h> | |
/* Assume this type: | |
runtimeclass Foo { | |
String Name; | |
UInt32 Id { get; }; | |
Foo[] GetMoreFoos(); | |
} |
// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there. | |
// | |
#include <iostream> | |
#include <map> | |
#include <chrono> | |
#include <unordered_map> | |
#include <array> | |
#include <string> | |
#include <functional> |
// https://godbolt.org/z/xnd359j99 | |
#include <optional> | |
#include <mutex> | |
#include <functional> | |
template<typename T> struct default_lazy_init { | |
T operator()() const { | |
return T{}; | |
} |
#include <vector> | |
#include <span> | |
#include <variant> | |
#include <memory> | |
template<typename T, int internal = 25> struct small_vector_optimization : std::span<T const> | |
{ | |
small_vector_optimization(std::span<T const> src) | |
{ | |
if (src.size() <= internal) |
// This is replacement for std::format on systems that don't have std::locale support, | |
// but do have std::to_chars locale invariant. | |
template <typename... Args> | |
std::string myformat(std::format_string<Args...> fmt, Args&&... args) | |
{ | |
std::string output; | |
auto formatArgStore = std::make_format_args(args...); | |
auto formatArgs = std::format_args(formatArgStore); | |
std::string_view fmtString = fmt.get(); | |
int nextIndex = 0; |
#include <tuple> | |
#include <iostream> | |
#include <algorithm> | |
#include <string_view> | |
#include <array> | |
#include <stdexcept> | |
#include <optional> | |
// This is a bijection lookup helper that given an array of pairs finds the key or | |
// the value. The keys should be sorted. |
#include <random> | |
#include <string> | |
#include <vector> | |
#include <span> | |
#include <winrt/windows.storage.streams.h> | |
#include <winrt/windows.security.cryptography.h> | |
#include <winrt/windows.security.cryptography.core.h> | |
#include <winrt/windows.security.cryptography.certificates.h> | |
namespace winrt { |
#include <vector> | |
#include <algorithm> | |
#include <iterator> | |
#include <functional> | |
// Given a container that supports "begin(c)" / "end(c)", uses std::transform plus a | |
// provided transmutor function to produce an output vector of the results. The | |
// type of the vector returned is derived from the return type of the transmutor | |
// operation. | |
template<typename Z, typename Q> |