[cfe-commits] r86697 - /cfe/trunk/tools/driver/driver.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 11 02:10:39 PST 2009
Fixed in r86829, thanks!
- Daniel
On Tue, Nov 10, 2009 at 1:53 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Nov 10, 2009, at 10:47 AM, Daniel Dunbar wrote:
>
>> Author: ddunbar
>> Date: Tue Nov 10 12:47:41 2009
>> New Revision: 86697
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=86697&view=rev
>> Log:
>> Driver: Run 'clang' in C++ mode based on the name it was invoked by. We
>> match
>> anything that ends with ++ or ++-FOO (e.g., c++, clang++, clang++-1.1) as
>> being
>> a "C++ compiler".
>>
>> This allows easy testing of the C++ compiler by 'ln -s clang clang++', or
>> by 'cp
>> clang clang++'.
>>
>> Based on patch by Roman Divacky.
>>
>> Modified:
>> cfe/trunk/tools/driver/driver.cpp
>>
>> Modified: cfe/trunk/tools/driver/driver.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=86697&r1=86696&r2=86697&view=diff
>>
>>
>> ==============================================================================
>> --- cfe/trunk/tools/driver/driver.cpp (original)
>> +++ cfe/trunk/tools/driver/driver.cpp Tue Nov 10 12:47:41 2009
>> @@ -197,6 +197,15 @@
>> llvm::sys::getHostTriple().c_str(),
>> "a.out", IsProduction, Diags);
>>
>> + // Check for ".*++" or ".*++-[^-]*" to determine if we are a C++
>> + // compiler. This matches things like "c++", "clang++", and
>> "clang++-1.1".
>> + //
>> + // Note that we intentionally want to use argv[0] here, to support
>> "clang++"
>> + // being a symlink.
>> + llvm::StringRef ProgName(llvm::sys::Path(argv[0]).getBasename());
>
> I don't think this is safe, the temporary is destroyed at the end of the
> statement. Try:
>
> std::string BaseName = llvm::sys::Path(argv[0]).getBasename();
>>
>> + llvm::StringRef ProgName(BaseName);
>
> or something.
>
> -Chris
>
>
>
>> + if (ProgName.endswith("++") ||
>> ProgName.rsplit('-').first.endswith("++"))
>> + TheDriver.CCCIsCXX = true;
>> +
>> llvm::OwningPtr<Compilation> C;
>>
>> // Handle QA_OVERRIDE_GCC3_OPTIONS and CCC_ADD_ARGS, used for editing a
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
More information about the cfe-commits
mailing list