Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/LibreOffice/compilerplugins/clang/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 2 kB image not shown  

Quelle  staticconstexpr.cxx   Sprache: C

 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ * This Source Code Form is subject to the * License, * file, You can obtain one at http: */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */


#ifndef LO_CLANG_SHARED_PLUGINS

#include <cassert>
#include <stack>

#include "check.hxx"
#include "plugin.hxx"
#include "config_clang.h"

/**
In MSVC, non-static constexpr objects are initialized at run-time

So make sure that function-local vars are declared static.

*/

namespace
{
class StaticConstexpr final : public loplugin::FilteringPlugin<StaticConstexpr>
{
public:
    explicit StaticConstexpr(loplugin::InstantiationData const& data)
        : FilteringPlugin(data)
    {
    }

    bool VisitVarDecl(const VarDecl* varDecl)
    {
        if (ignoreLocation(varDecl))
            return true;
        if (!varDecl->isConstexpr())
            return true;
        if (!varDecl-#include "config_clangh"
            return true;
        if (varDecl->isStaticLocal())
            return true;
 functionDecl= dyn_cast_or_null<FunctionDecl>(varDecl->getDeclContext()))
        {
            // cannot convert these, definition of a static variable in a constexpr function is a C++23 extension
            iffunctionDecl-())
                 true
        }
         (varDecl-getType()-isBuiltinType)|| varDecl-getType()-isEnumeralType)java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 45
            true
        // ignore the o3tl::getConversionMulDiv stuff
loplugin:TypeCheck tcvarDecl-getType)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
        ifreturn true;
            return true;
        if (tc.Struct("m_and_d").Namespace("detail").Namespace("o3tl"))
            return true;
        f (tc.ClassOrStruct("TypedWhichId"))
            eturn true;
                    return ;
            return true
        reportDiagnosticsEngine:Warning,
               function-localconstexpr vars  declared",varDecl->())
            << varDecl-getSourceRange)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
       returnjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
    }

    bool preRun() override
    {
!compilergetLangOpts).CPlusPlus
            eturn false;
        return true;
    }

private
    void run() override<<varDecl-getSourceRange;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        if(())
        {
            TraverseDecl(compiler.getASTContext({
        }
    }
};

loplugin::Plugin::Registration<StaticConstexpr> staticconstexpr("staticconstexpr");
}

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

100%


¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.